Guest blade001 Posted February 18, 2005 Report Posted February 18, 2005 (edited) Hi, I am developing a hangman game for smartphone 2003 using vb.net (not using C# as i dont know much about it). I tried different methods to draw lines and shape such as circle, square boxs on the screen and always getting an error messege. I am using the creatgraphics() method and it doesn't seem to like it. Any one know any way round this. Please help. I would really appreciate it. Edited February 18, 2005 by blade001
Guest Peter Foot Posted February 18, 2005 Report Posted February 18, 2005 Hi, I am developing a hangman game for smartphone 2003 using vb.net (not using C# as i dont know much about it). I tried different methods to draw lines and shape such as circle, square boxs on the screen and always getting an error messege. I am using the creatgraphics() method and it doesn't seem to like it. Any one know any way round this. Please help. I would really appreciate it. <{POST_SNAPBACK}> Make sure you are calling CreateGraphics within your OnPaint handler, you cannot call it anywhere within your code. Peter
Guest blade001 Posted March 1, 2005 Report Posted March 1, 2005 (edited) Hi, I a, using VB not C#. I am calling the creatgraphics() like I normally do for any other programs and still not having any success with it. I have tried running the program on my pc and it works but I get a error messege when I run the program in emulator and on my phone. Example Code Public Class Form1 Inherits System.Windows.Forms.Form Dim drawArea As Graphics Friend WithEvents lbl_Exit As System.Windows.Forms.Label Friend WithEvents blb_Draw As System.Windows.Forms.Label #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call drawArea = Me.pic_Hangman.CreateGraphics() End Sub Private Function Draw() Dim myPen As New Pen(Color.Black) drawArea.DrawEllipse(myPen, New Rectangle(33, 45, 40, 50)) End Function Now when I execute the Draw function I get a error messege. Is there any thing I am missing or it just can not be done? Please help. Edited March 1, 2005 by blade001
Guest blade001 Posted April 11, 2005 Report Posted April 11, 2005 Anyone have any idea how to do this?? Please help. I have some free time this week. So I can work on it again. Please let me know if anyone know anything about it at all. I would really appreciate that.
Guest Peter Foot Posted April 13, 2005 Report Posted April 13, 2005 Anyone have any idea how to do this?? Please help. I have some free time this week. So I can work on it again. Please let me know if anyone know anything about it at all. I would really appreciate that. <{POST_SNAPBACK}> Unlike the desktop you can only call CreateGraphics in specific places in your code. Setup a method to handle to Paint event for your form. Here use the Graphics object passed in the PaintEventArgs Peter
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now