Drawing on a Form from another class.
Writing my first Windows program in C# with Visual Studio.net 2003...
I am trying to obtain a Graphics object to allow drawing on a Panel control (verticalPanel) from within a created class (VerticalClass). The following code works from within the main form (MainForm), but not from within VerticalClass:
Graphics g = Graphics.FromHwnd(verticalPanel.Handle);
I have also tried this:
Graphics g = verticalPanel.CreateGraphics();
I have also tried naming the namespace and form in the code above with no success.
What am I missing?