DrawString to PictureBox Got Exception VB.Net
device with pocket pc platform, I got exception. There is no specific error.
How come ?
grpDraw.DrawString("123",
New Font("Courier New", 8.25, FontStyle.Regular), New SolidBrush(Color.Black), 5, 5) End SubWhen I clicked on the button in pocket pc device. I got an exception of NotSupportedException. I have .Net Compact 2.0.
There is something very wrong in your description. As far as I know, PcitureBox.CreateGraphics is not supported so I am having trouble accepting your assertion that this code works in the emulator; can you try that again please?
If you insist that it works in the emulator then I'd check that the PPC you are using is 2003 and above since CF 2.0 is not supported on earlier versions (2000 or 2002). It also helps to use breakpoints so you can tell the forum exactly which statement causes the exception.
I suspect you'll find this code doesn't work anywhere. If you change the first statement to use Me.CreateGraphics then it will work but your "123" text will be drawn on the form, not the picturebox.
To draw on the picturebox, handle its Paint event and put the code in there; again change the first statement to be grpDraw = e.Graphics
Good luck!
Cheers
Daniel