| You are here: | About>Computing & Technology>Visual Basic> Using VB.NET> GDI+ Graphics in Visual Basic 2005 .NET |
![]() | Visual Basic |
GDI+ Graphics in Visual Basic 2005 .NETJan 27 2007 Using CreateGraphics to get a Graphics ObjectThe second method to get a Graphics object for your code uses a CreateGraphics method that is available with many components. The code looks like this: Private Sub Button1_Click( _ There are a couple of differences here. This is in the Button1.Click event because when Form1 repaints itself in the Load event, our graphics are lost. So we have to add them in a later event. If you code this, you'll notice that the graphics are lost when Form1 has to be redrawn. (Mimimize and maximize again to see this.) That's a big advantage to using the first method. Most references recommend using the first method since your graphics will be repainted automatically. GDI+ can be tricky! Part 2 of our series discusses GDI+ vector graphics and uses the Paint event of a Panel control to draw trigonometric functions. |
Las Vegas on a BudgetFind a BargainHotel DealsCheap EatsFree AttractionsEntertainment for Less |
All Topics | Email Article | | | ![]() |
| Advertising Info | News & Events | Work at About | SiteMap | Reprints | Help | Our Story | Be a Guide |
| User Agreement | Ethics Policy | Patent Info. | Privacy Policy | ©2008 About, Inc., A part of The New York Times Company. All rights reserved. |


