Home
Explore
Tags
Contribute
Home
»
VB.NET
»
GDI+ IN VB.NET
Understanding the GDI+ Paint Event in VB.NET
Posted in
VB.NET
|
GDI+ IN VB.NET
on
November 03, 2019
Tags:
GDI+
,
Paint Event in GDI+
,
VB.NET
In this article you will learn how to Understand the Paint Event in GDI+.
5344
In previous articles, you learned how to draw graphics shapes, curves, and images. In all of these cases, the Graphics object is responsible for the drawing. When we're drawing graphics objects from within a menu or button click event handler, a call to the Invalidate method becomes imperative. I we don't call this method, the form will not paint itself, but if we write the same code on a form's OnPaint or paint event handler, there is no need to invalidate the form. In this section we will find out why that's so.
Understanding the Paint Event
Paint event functionality is defined in System.Windows.Forms.Control class, which is the base class for Windows Forms controls such as Label, ListBox, DataGrid, and TreeView. A paint event is fired when a control is redrawn. The Form class itself is inherited from the Control class. Figure 13.1 shows the Form class hierarchy.
The PaintEventArgs class provides data for the paint event. It provides two read-only properties: ClipRectangle and Graphics.ClipRectangle indicates the rectangle in which to paint, and the Graphics property indicates the Graphics object associated with the paint event of a particular control (including the form itself). Always be careful when you're dealing with the paint event because it is unpredictable and called automatically.
The Control class also provides OnPaint methods, which can be overridden in the derived classes to fire the paint event. The signature of the OnPaint method is defined as follows
Protected Overridable Sub OnPaint(e As PaintEventArgs)
End Sub
FIGURE 13.1: The Form class hierarchy
As this definition shows, OnPaint takes a PaintEventArgs object as its only argument. The Graphics property of PaintEventArgs is used to get the Graphics object associated with a control - including the form.
Related Articles
Add GDI+ Paint Event Handler and Controls in VB.NET
WPF Grid Using VB.NET
Image Animation in VB.NET using GDI+
Introduction of DataGrid Control in VB.NET
Handling Mouse Events in VB.NET
Silverlight Paint TextBox in VB.NET
ADO .NET Handling Events & Connection Events in VB.NET
Event Handling in windows programming using VB.NET
Create ASP .NET Web Application in GDI+ using VB.NET
TextBox keypress event in VB.NET
Categories
ACTIVE DIRECTOTRY IN VB.NET
ALGORITHMS AND VB.NET
ARRAY IN VB.NET
ASP.NET AJAX IN VB.NET
ASP.NET USING VB.NET
ASSEMBLIES IN VB.NET
COM INTEROP IN VB.NET
CRYPTOGRAPHY IN VB.NET
CRYSTAL REPORTS IN VB.NET
DATABASE & DBA
DEPLOYMENT IN VB.NET
DESIGN & ARCHITECTURE
DIRECTX WITH VB.NET
ENTERPRISE DEVELOPMENT
FILE IN VB.NET
GAMES IN VB.NET
GDI+ IN VB.NET
GENERAL
LINQ WITH VB.NET
MOBILE DEV IN VB.NET
MULTITHREADING IN VB.NET
NETWORKIN WITH VB.NET
OFFICE AND VB.NET
PRINTING IN VB.NET
REMOTING IN VB.NET
REPORTS IN VB.NET
SECURITY IN VB.NET
SILVERLIGHT USING VB.NET
Speech in VB.NET
STRING IN VB.NET
TABLET PC
VB.NET ADO.NET
VB.NET ARTICLE
VB.NET EXCEPTION HANDLING
VB.NET FAQ
VB.NET HOW DO I
VB.NET LANGUAGE
VB.NET TUTORIALS
VB.NET WINDOWS SERVICES
VBA
VISUAL BASIC 10
VISUAL BASIC LANGUAGE
WCF WITH VB.NET
WEB CONTROL IN VB.NET
WEB DEV IN VB.NET
WEB FORM WITH VB.NET
WEB SERVICES IN VB.NET
WINDOWS CONTROLS
WINDOWS FORMS IN VB.NET
WORKFLOW IN VB.NET
WPF IN VB.NET
XAML IN VB.NET
XML IN VB.NET
More Articles
Stroke Caps in GDI+ using VB.NET
Basic GDI+ Objects in VB.NET
Transformation in GDI+ in VB.NET
Drawing Images in GDI+ in VB.NET
Working with GDI+ Fonts in VB.NET
GDI+ Pie Chart in VB.NET
Using GDI+ Graphics Paths in VB.NET
Drawing Lines in GDI+ using VB.NET
Printing Text in GDI+ using VB.NET
Designing GUI Applications in GDI+ using VB.NET
Printer Settings in GDI+ and VB.NET
No GDI Calls between GetHdc and ReleaseHdc in VB.NET
GDI Managed Environment in VB.NET
Use GDI+ System Brushes and Pens in VB.NET
Select Method carefully in GDI+ using VB.NET
Use Graphics Paths in GDI+ using VB.NET
SetStyle Method in GDI+ using VB.NET
Overriding the GDI+ OnPaint Method in VB.NET
GDI+ Double Buffering and Flicker-Free Drawing in VB.NET
GDi+ Scope and Type of Variable and Performance in VB.NET
Add GDI+ Paint Event Handler and Controls in VB.NET
Understanding the GDI+ Paint Event in VB.NET
Create ASP .NET Web Application in GDI+ using VB.NET
Working with Text and Strings in VB.NET
GDI+ Transforming Text in VB.NET
GDI+ LinearGradientBrush and PathGradientBrush in VB.NET
Drawing GDI+ Images on the Web in VB.NET
Drawing Simple Graphics in VB.NET
Graphics Web Application in GDI+ usnig VB.NET
Adding GDI+ Web Controls to a Web Form in VB.NET
Customizing Page Settings in GDI+ using VB.NET
DetailsCustom Controlling and Print Controller in VB.NET
Drawing Graphics Shapes in VB.NET
The DocumentName Property and Marginal Printing in VB.NET
Draw 2D graphics line,tringle,ellipse,polygon in VB.NET
Print Dialogs in GDI+ using VB.NET
Printing Graphics in GDI+ using VB.NET
Printing Text in GDI+ using VB.NET
A GDI+ Printer Settings Example in VB.NET
GDI+ Pinting Application in VB.NET
Printer Settings in GDI+ using VB.NET
GDI+ PaperSize Class in VB.NET
Printing in GDI+ using VB.NET
GDI+ Text Transformation in VB.NET
Color Transformation and the Color Matrix in VB.NET
Image Transformation in GDI+ using VB.NET
GDI+ Scaling, Shearing and Rotating Colors in VB.NET
GDI+ Miscellaneous Advanced 2D Topics in VB.NET
Mixed Blending in GDI+ using VB.Net
Compositing Mode and Blending in VB.NET
© 2020 DotNetHeaven. All rights reserved.
TERMS & CONDITIONS
|
CONTACT US
|
REPORT ABUSE