clsGpGraphics ClassThe Graphics class provides methods for drawing lines, curves, figures, images, and text. A Graphics object stores attributes of the display device and attributes of the items to be drawn.
|
Name | Description |
---|
Name | Description |
---|
Name | Type | Description |
---|---|---|
CompositingMode | (GpCompositingMode) | Gets or sets the composition mode of the graphics object |
CompositingQuality | (GpCompositingQuality) | Gets or sets the composition quality |
hGraphics | (Long) | Gets or sets the a reference to the internal handle |
InterpolationMode | (GpInterpolationMode) | Gets or sets the interpolation mode |
isValid | (Boolean) | Returns True if the internal handle is valid |
PageScale | (Single) | Gets or sets the Page scale |
PageUnit | (GpUnit) | Gets or sets the Page unit |
PixelOffsetMode | (GpPixelOffsetMode) | Gets or sets the Pixel offset mode |
SmoothingMode | (GpSmoothingMode) | Gets or sets the Smoothing mode of this graphics object |
Name | Type | Description |
---|---|---|
Clear_Color | (GpStatus) | Clears the graphics with the given color |
Clear_RawColor | (GpStatus) | Clears the graphics with the given ARGB color (use the [clsGpSession] class for conversion functions) |
CreateFromHDC | (GpStatus) | Creates a Graphics object that is associated with a specified device context. |
CreateFromHwnd | (GpStatus) | Creates a Graphics object that is associated with a specified window. |
CreateFromImage | (GpStatus) | Creates a graphics object that is associated with the given image |
CreateFromStdPicture | (GpStatus) | Creates a graphics object that is associated with the given image |
CreateHalftonePalette | (clsGdiHandle) | Creates a halftone palette useful when rendering a bitmap to a low-color device context |
Dispose | Releases resources useb by this class | |
DrawArcI | (GpStatus) | Draws an arc. The arc is part of an ellipse. |
DrawBezier | (GpStatus) | Draws a Bézier spline using single coordinates |
DrawBezierI | (GpStatus) | Draws a Bézier spline using long coordinates |
DrawBeziers | (GpStatus) | Draws a sequence of connected Bézier splines |
DrawBeziersI | (GpStatus) | Draws a sequence of connected Bézier splines |
DrawEllipseI | (GpStatus) | Draws an ellipse |
DrawFillRRectI | (GpStatus) | Draws a round rectangle with the specified curve size |
DrawImageI | (GpStatus) | Draws an image at a specified location |
DrawImagePointRectI | (GpStatus) | Draws an image |
DrawImageRectI | (GpStatus) | Draws an image and optionally scale it |
DrawImageRectRectI | (GpStatus) | Draws an image |
DrawLine | (GpStatus) | Draws a line that connects two points |
DrawLineI | (GpStatus) | Draws a line that connects two points |
DrawLines | (GpStatus) | Draws a sequence of connected lines |
DrawLinesI | (GpStatus) | Draws a sequence of connected lines |
DrawPath | (GpStatus) | Draws the given path with the given pen |
DrawPieI | (GpStatus) | Draws a pie |
DrawPixel | (GpStatus) | Draws a pixel at specified coordinates |
DrawPolygonI | (GpStatus) | Draws a polygon |
DrawRectangleI | (GpStatus) | Draws a rectangle. |
FillEllipseI | (GpStatus) | Uses a brush to fill the interior of an ellipse that is specified by coordinates and dimensions |
FillPath | (GpStatus) | Fills the given path with the given brush |
FillPieI | (GpStatus) | Uses a brush to fill the interior of a pie |
FillPolygon | (GpStatus) | Uses a brush to fill the interior of a polygon created by a pointer to an array of POINTF structs (a struct where x and y are single) |
FillPolygon2I | (GpStatus) | Uses a brush to fill the interior of a polygon created by a pointer to an array of POINTL structs (a struct where x and y are long) |
FillRectangleI | (GpStatus) | Uses a brush to fill the interior of a rectangle |
Flush | (GpStatus) | Flushes GDI+ operations |
GetHDC | (Long) | The GetHDC method gets a handle to the device context associated with this Graphics object (returns a standard GDI handle) |
ReleaseHDC | (GpStatus) | The ReleaseHDC method releases a device context handle obtained by a previous call to the GetHDC method of this Graphics object. |
ResetTransform | (GpStatus) | The ResetTransform method sets the world transformation matrix of this Graphics object to the identity matrix |
Restore | (GpStatus) | The Restore method sets the state of this Graphics object to the state stored by a previous call to the [Save] method of this Graphics object |
RotateTransform | (GpStatus) | The RotateTransform method updates the world transformation matrix of this Graphics object with the product of itself and a rotation matrix. |
Save | (clsGpGraphicsState) | The Save method saves the current state (transformations, clipping region, and quality settings) of this Graphics object. You can restore the state later by calling the [Restore] method |
ScaleTransform | (GpStatus) | The ScaleTransform method updates this Graphics object's world transformation matrix with the product of itself and a scaling matrix |
TranslateTransform | (GpStatus) | Updates this Graphics object's world transformation matrix with the product of itself and a translation matrix. |
Option Explicit
'
'Draw a ctlUniImage control on a form before trying this sample
'
Dim moHexWrapper As New clsCommonWrapper
Private Sub Form_Load()
'This object contains useful GDI Plus conversion functions
Dim oSes As clsGpSession
Set oSes = moHexWrapper.GetGDIPlusSession()
'Create a new bitmap
Dim oBmp As New clsGpBitmap
oBmp.Create ctlUniImageWL1.ClientWidth, ctlUniImageWL1.ClientHeight, PixelFormat32bppARGB
Dim oGr As New clsGpGraphics
'Create the Pen for drawing the ellipse
Dim oP As New clsGpPen
oP.Create1_RawColor oSes.ColorFromRGB(vbRed, 128)
'Create the brush for filling the ellipse
Dim oBr As New clsGpBrush
oBr.CreateHatchBrush_RawColor HatchStyle50Percent, oSes.ColorFromRGB(vbWhite), oSes.ColorFromRGB(vbYellow)
'Create an instance of the Graphics object that contains drawing functions
Set oGr = oBmp.CreateGraphics(, PixelOffsetModeHighQuality, SmoothingModeAntiAlias)
'Fills the ellipse with the brush
oGr.FillEllipseI oBr, 0, 0, oBmp.GetWidth(), oBmp.GetHeight()
'Draws the ellipse border
oGr.DrawEllipseI oP, 0, 0, oBmp.GetWidth(), oBmp.GetHeight()
'Get a Picture object from our GDIPlus bitmap
Dim oPic As StdPicture
Set oPic = oBmp.Picture(vbWhite)
'Set to our UniImage widget
Set ctlUniImageWL1.Picture = oPic
End Sub