random 0

random 0

  • NA
  • 7
  • 0

Drawing on a Form from another class.

Feb 21 2005 12:42 PM
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)