I am developing a windows mobile application for a warehouse. Since the base functionalities have been achieved, I'm working on improving the overall appearance of the application. I'm struggling with few things, and I'd greatly appreciate any help (I'm fairly new to C#, but willing to learn :-).
First of all, I cannot get the overridden OnPaint method to work, not even on the emulator, so I guess I am missing something. Do I need to do anything else than this ? ::
public partial class Form1 : Form {
protected override void OnPaint(PaintEventArgs e) {
base.OnPaint(e);
/*some basic painting here */
}}
Second problem originated when I tried to make a listbox selectable "as a one". I don't want the user to click on particular items in it, just a whole listbox. To give you some idea, I want to display a few of listboxes like this one in a list :
Is there a way to make them selectable like a normal items in the List?
I couldn't work this one out, so I've tried different approach --> make a bitmap out of those listboxes, and load the bitmaps in a list.
Since compact framework doesn't have built-in neat methods like entity does (DrawToBitmap), I tried this approach (Pocket PC: Draw control to bitmap), but it did not do any good - after getting this to 'work', it changes nothing. I also tried this, from a code snippet that used a screen capture, with no success either.
System.Drawing.Bitmap destinationBmp = new System.Drawing.Bitmap(System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width,
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height);
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(destinationBmp);
GraphicsEx gx = GraphicsEx.FromGraphics(g);
//gx.CopyFromScreen(0, 0, 0, 0, Forms.Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
//gx.CopyFromScreen(0, hehe.Top, 0, hehe.Bottom + 10, hehe.Size, CopyPixelOperation.SourceCopy);
gx.CopyGraphics(listbox, listbox.Bounds);
g.DrawImage(destinationBmp, 0, 200);
What am I missing? Or maybe is a there a better way to do this?