I am trying to draw a rectangle on a windows mobile phone.
- Draw the rectangle
- Fill the rectangle with a color
- Draw it on to the phone.
- Give it a event handler that when a user clicks something happens.
I am unsure how do steps 2, 3 and 4. I see that there is a drawing class called rectangle but I don’t know how to get it on the form.
I then don’t know how I could give it a event handler. I am planning to dynamically make like 12 of these so I have to somehow tell which one is clicked and the color it contains in it.
Thanks
Edit so far I have this but I don’t see it on my form.
Graphics surface = this.CreateGraphics();
Pen pen = new Pen(Color.Black, 1f);
System.Drawing.Rectangle test = new Rectangle(0, 0, 500, 500);
surface.DrawRectangle(pen, test);
It sounds like you want a colored button. I think the easiest way to do this is to inherit from Control and override its Paint event.
Now just hook into the native control Click event.
Or if you want fancier controls, take a look at this library
http://code.msdn.microsoft.com/uiframework