|
-
Jun 25th, 2007, 09:02 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] [02/03] Drawn size of string
I copied code from this thread:
And, I changed it to this
Dim g As Graphics
Dim sz As New SizeF
sz = g.MeasureString("Test String", Me.Font)
But I am getting the "Object reference not set to an instance of an object" error. I don't have much experience with the Graphics class, and I can't for the life of me figure out what to do. Simply putting new in front of Graphics doesn't work. As you can see from the link, that post used e.Graphics, but I am doing this in a different event (Mouse Up), which doesn't have e.Graphics. Any ideas?
Thanks
VB.Net 2008
.Net Framework 2.0
"Must you breathe? 'Cause I need heaven..."
-
Jun 25th, 2007, 09:17 AM
#2
Re: [02/03] Drawn size of string
You call the method me.CreateGraphics like this
Code:
Dim g As Graphics
Dim sz As New SizeF
g = Me.CreateGraphics
sz = g.MeasureString("Test String", Me.Font)
Please mark you thread resolved using the Thread Tools as shown
-
Jun 25th, 2007, 09:24 AM
#3
Thread Starter
Fanatic Member
Re: [02/03] Drawn size of string
VB.Net 2008
.Net Framework 2.0
"Must you breathe? 'Cause I need heaven..."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|