1
Reply

Drawing on a Form from another class.

random 0

random 0

Feb 21 2005 12:42 PM
1.7k
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?

Answers (1)