Re: Drawing a string
From: Peter Foot [MVP] (feedback_at_no-spam.inthehand.com)
Date: 09/24/04
- Next message: Paul [Paradise Solutions]: "OpenNETCF.Data.Csv - Limitations?"
- Previous message: Paul [Paradise Solutions]: "Re: Build Errors During deploy but not complie (kind of)"
- In reply to: Cyberdot: "Re: Drawing a string"
- Next in thread: Steven Licciardi: "Re: Drawing a string"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 24 Sep 2004 14:29:39 +0100
No, why don't you ditch the picturebox and do all the painting in the
OnPaint method of your form, get the graphics object you are passed, draw
the image then the text
Peter
-- Peter Foot Windows Embedded MVP www.inthehand.com | www.opennetcf.org Do have an opinion on the effectiveness of Microsoft Windows Mobile and Embedded newsgroups? Let us know! https://www.windowsembeddedeval.com/community/newsgroups "Cyberdot" <Cyberdot@discussions.microsoft.com> wrote in message news:D5B6DEA5-B5D2-4B89-991C-F29C1EF1AF8F@microsoft.com... > Yeah, I tried it and it works. But now I have another problem. I have a > picturebox on the same position where I want to draw the string, and it > looks > like the picture box is in front of the string I've drawn. Is there a > method > to get the graphics handler for a picturebox? > > Thx, > Cyberdot > > "Peter Foot [MVP]" wrote: > >> Because you haven't instantiated g, just created a variable to hold a >> Graphics object. You can use >> >> g = Me.CreateGraphics() >> >> To get the Graphics instance for your form, which you will then be able >> to >> draw with. You would probably be best to add this drawing code into your >> OnPaint override for the form, then invalidate the form when the value >> changes. >> >> Peter >> >> -- >> Peter Foot >> Windows Embedded MVP >> www.inthehand.com | www.opennetcf.org >> >> Do have an opinion on the effectiveness of Microsoft Windows Mobile and >> Embedded newsgroups? Let us know! >> https://www.windowsembeddedeval.com/community/newsgroups >> >> "Cyberdot" <Cyberdot@discussions.microsoft.com> wrote in message >> news:44F9F156-0629-4DA3-B0D7-CFEAFA40DD51@microsoft.com... >> > Hello, >> > I've got a little problem. I want to draw a string to my form with the >> > follówing code: >> > >> > Public Sub titleSetTime(ByVal newTime As String) >> > Dim g As System.Drawing.Graphics >> > g.DrawString(newTime, New System.Drawing.Font("Microsoft Sans >> > Serif", 10, System.Drawing.FontStyle.Regular), New >> > SolidBrush(SystemColors.ControlText), 200, 2) >> > End Sub >> > >> > But if I try this, I get a SystemNullReferenceExeption. Does sombody >> > know >> > why? >> > >> > Thx, >> > Cyberdot >> >> >>
- Next message: Paul [Paradise Solutions]: "OpenNETCF.Data.Csv - Limitations?"
- Previous message: Paul [Paradise Solutions]: "Re: Build Errors During deploy but not complie (kind of)"
- In reply to: Cyberdot: "Re: Drawing a string"
- Next in thread: Steven Licciardi: "Re: Drawing a string"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|