Home
Explore
Tags
Contribute
Home
»
VB.NET
»
ACTIVE DIRECTOTRY IN VB.NET
Drawing GDI+ Ellipses and Circles in VB.NET
Posted in
VB.NET
|
ACTIVE DIRECTOTRY IN VB.NET
on
November 06, 2019
Tags:
DrawEllipse
,
VB.NET
,
ellipse
In this article I will explain you how to draw Ellipses and Circles in GDI+.
4992
FIGURE 3.5: An ellipse
Drawing Ellipses and Circles
An ellipse is a circular boundary within a rectangle, where each opposite point has the same distance from a fixed point, called the center of the ellipse. An ellipse within a square is called a circle. Figure 3.5 shows an ellipse with its height, width, and center indicated.
To draw an ellipse, you need to specify the outer rectangle. GDI+ takes care of the rest. DrawEllipse draws an ellipse defined by a rectangle specified by a pair of coordinates, a height, and a width (an ellipse with equal height and width is a circle).
To draw an ellipse, an application creates a pen and four coordinates (or a rectangle), and then calls DrawEllipse. Listing 3.5 draws ellipses with different options.
LISTING 3.5: Drawing ellipses
Private
Sub
Form1_Paint(
ByVal
sender
As
System.Object,
ByVal
e
As
System.Windows.Forms.PaintEventArgs)
Handles
MyBase
.Paint
' Create Pens
Dim
redPen
As
New
Pen(Color.Red, 6)
Dim
bluePen
As
New
Pen(Color.Blue, 4)
Dim
greenPen
As
New
Pen(Color.Green, 2)
' Create a rectangle
Dim
rect
As
New
Rectangle(80, 80, 50, 50)
' Draw ellipses
e.Graphics.DrawEllipse(greenPen, 100.0F, 100.0F, 10.0F, 10.0F)
e.Graphics.DrawEllipse(redPen, rect)
e.Graphics.DrawEllipse(bluePen, 60, 60, 90, 90)
e.Graphics.DrawEllipse(greenPen, 40.0F, 40.0F, 130.0F, 130.0F)
'Dispose of objects
redPen.Dispose()
greenPen.Dispose()
bluePen.Dispose()
End
Sub
Figure 3.6 shows the output from Listing 3.5
FIGURE 3.6: Drawing ellipse
Conclusion
Hope the article would have helped you in understanding drawing Ellipses and Circles in GDI+. Read other articles on GDI+ on the website.
Related Articles
Working with GDI+ Brushes using VB.NET
GDI+ Brushes using VB.NET
Select Method carefully in GDI+ using VB.NET
Drawing Simple Graphics in VB.NET
WPF Column Chart in VB.NET
Draw an Ellipse in WPF using VB.NET
Image Animation in VB.NET using GDI+
Drawing GDI+ Images on the Web in VB.NET
GDI+ Double Buffering and Flicker-Free Drawing in VB.NET
GDI+ Pie Chart 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
ASP.Net 4 Login Control in VB.NET
User Input Validations using ErrorProvider in VB.NET
ASP Lock and Unlock Methods in ASP.NET using VB.NET
RegularExpressionValidator control in ASP.NET using VB.NET
Cascading Style Sheets (CSS) in ASP.NET using VB.NET
Drawing GDI+ Ellipses and Circles in VB.NET
Bind data to DropDownList in ASP.NET using VB.NET
WPF Use Trigger in VB.NET
SQL Server 2005 Joins in VB.NET
WPF RadioButton control in VB.NET
RadioButton WPF in VB.NET
WPF Media Player in VB.NET
Type Conversions in VB.NET
WPF Controls Overview in VB.NET
Using Silverlight Border Control
© 2020 DotNetHeaven. All rights reserved.
TERMS & CONDITIONS
|
CONTACT US
|
REPORT ABUSE