YOU CAN CODE!

 

With The Case Of UCanCode.net  Release The Power OF  Visual C++ !   HomeProducts | PurchaseSupport | Downloads  
Download Evaluation
Pricing & Purchase?
E-XD++Visual C++/ MFC Products
Overview
Features Tour 
Electronic Form Solution
Visualization & HMI Solution
Power system HMI Solution
CAD Drawing and Printing Solution

Bar code labeling Solution
Workflow Solution

Coal industry HMI Solution
Instrumentation Gauge Solution

Report Printing Solution
Graphical modeling Solution
GIS mapping solution

Visio graphics solution
Industrial control SCADA &HMI Solution
BPM business process Solution

Industrial monitoring Solution
Flowchart and diagramming Solution
Organization Diagram Solution

Graphic editor Source Code
UML drawing editor Source Code
Map Diagramming Solution

Architectural Graphic Drawing Solution
Request Evaluation
Purchase
ActiveX COM Products
Overview
Download
Purchase
Technical Support
  General Q & A
Discussion Board
Contact Us

Links

Get Ready to Unleash the Power of UCanCode .NET


UCanCode Software focuses on general application software development. We provide complete solution for developers. No matter you want to develop a simple database workflow application, or an large flow/diagram based system, our product will provide a complete solution for you. Our product had been used by hundreds of top companies around the world!

"100% source code provided! Free you from not daring to use components because of unable to master the key technology of components!"


Introduction to GDI+ in .NET
GDI+
and DrawArc and DrawPath

By c#corner

In this article, we’ll see basics of GDI+ and how GDI+ is much better interface than its predecessor GDI.

 

The Graphics Class

The Graphics class is center of all GDI+ classes. After discussing graphics class, I'll discuss some common GDI+ objects and their representation and then we'll see some sample applications to apply this theory in our applications and how it works.

The Graphics class plays a vital role in GDI+. No matter where you go, you go through this class ;). The Graphics class encapsulates GDI+ drawing surfaces. Before drawing any object (for example circle, or rectangle ) we have to create a surface using Graphics class.

There're different of ways to get a graphics object in your application. You can either get a graphics object on your form's paint event or by overriding OnPaint() method of a form. These both have one argument of type System.Windows.Forms.PaintEventArgs. You call its Graphics member to get the graphics object in your application. For example:

protected overrides sub OnPaint(ByVal e As 
                          System.Windows.Forms.PaintEventArgs)
      Dim g As Graphics = e.Graphics
End Sub 

Now you've the Graphics object. Now you can do any thing you want. The Graphics class has tons of methods to drawing graphics objects such as fonts, pens, lines, path and polygons, images and ellipse and so on. Some of the graphics class members are described in the following table -

DrawArc This method draws an arc.
DrawBezier, DrawBeziers, DrawCurve These methods draw a simple and bazier curves. These curvers can be closed, cubic and so on.
DrawEllipse Draws an ellipse or circle.
DrawImage Draws an image.
DrawLine Draws a line.
DrawPath Draws the path (lines with GraphicsPath )
DrawPie Draws the outline of a pie section.
DrawPolygon Draws the outline of a polygon.
DrawRectangle Draws the outline of a rectangle.
DrawString Draws a string.
FillEllipse Fills the interior of an ellipse defined by a bounding rectangle.
FillPath Fills the interior of a path.
FillPie Fills the interior of a pie section.
FillPolygon Fills the interior of a polygon defined by an array of points.
FillRectangle Fills the interior of a rectangle with a Brush
FillRectangles Fills the interiors of a series of rectangles with a Brush
FillRegion Fills the interior of a Region.

Now say, if you want to draw an ellipse using the same method we've described above, you override OnPaint method and write the following code -

protected overrides sub OnPaint(ByVal e As 
                              System.Windows.Forms.PaintEventArgs)

Dim g As Graphics = e.Graphics
  Dim pn As Pen = New Pen(Color.Green, 10)
  g.DrawLine(pn, 100, 10, 30, 10)
  g.DrawEllipse(New Pen(Color.Red, 20), 20, 40, 20, 20)
  End Sub

That will draw a ellipse. Before we see more samples, let's discuss some GDI+ objects.

GDI+ Font, Brush and Bitmap

GDI+ GraphicsPath and LinearGradientBrush

GDI+ Printing.

GDI+ and DrawArc and DrawPath

GDI+ Color and ARGB with Example

 

 

 

Copyright ?1998-2022 UCanCode.Net Software , all rights reserved.
Other product and company names herein may be the trademarks of their respective owners.

Please direct your questions or comments to webmaster@ucancode.net