Graphicsクラス
Graphicsは、各種の描画を行うクラスです。
クラスの機能
プロパティ
Clip
描画領域を限定する領域を取得・設定します。
Const Function Clip() As Region Sub Clip(region As /*Const*/ Region)
参考:Regionクラス
ClipBounds
描画領域を限定する領域に概説する四角形を取得・設定します。
Const Function ClipBounds() As RectangleF Sub ClipBounds(rc As RectangleF)
GetClipBounds/SetClipBoundsを呼びます。
CompositingMode
描画方法を取得・設定します。
Function CompositingMode() As CompositingMode Sub CompositingMode(mode As CompositingMode)
GetCompositingMode/SetCompositingModeを呼びます。
CompositingQuality
描画品質を取得・設定します。
Function CompositingQuality() As CompositingQuality Sub CompositingQuality(cq As CompositingQuality)
GetCompositingQuality/SetCompositingQualityを呼びます。
DpiX
水平方向の解像度を取得します。
Const Function DpiX() As Single
- 戻り値
- このインスタンスが使用している水平方向の解像度
DqiY
垂直方向の解像度を取得します。
Const Function DpiY() As Single
- 戻り値
- このインスタンスが使用している垂直方向の解像度
InterpolationMode
補間方法取得・設定します。
Const Function InterpolationMode() As InterpolationMode Sub InterpolationMode(im As InterpolationMode)
GetInterpolationMode/SetInterpolationModeを呼びます。
IsClipEmpty
Const Function IsClipEmpty() As BOOL
IsVisibleClipEmpty
Const Function IsVisibleClipEmpty() As BOOL
PageScale
Function PageScale(scale As Single) As Status Const Function PageScale() As Single
PageUnit
Const Function PageUnit() As GraphicsUnit Function PageUnit(unit As GraphicsUnit) As Status
PixelOffsetMode
Function PixelOffsetMode() As PixelOffsetMode Sub PixelOffsetMode(mode As PixelOffsetMode)
RenderingOrigin
Function RenderingOrigin() As Point Sub RenderingOrigin(pt As Point)
SmoothingMode
Function SmoothingMode() As SmoothingMode Sub SmoothingMode(mode As SmoothingMode)
TextContrast
Function TextContrast() As DWord Sub TextContrast(contrast As DWord)
TextRenderingHint
Function TextRenderingHint() As TextRenderingHint Sub TextRenderingHint(mode As TextRenderingHint)
Transform
Function Transform() As Matrix Sub Transform(ByRef matrix As Matrix)
ワールド変換行列を取得・設定します。
VisibleClipBounds
Function VisibleClipBounds() As RectangleF
メソッド
コンストラクタ
Sub Graphics(hdc As HDC) Sub Graphics(hdc As HDC, hdevice As HANDLE) Sub Graphics(hwnd As HWND) Sub Graphics(hwnd As HWND, icm As BOOL) Sub Graphics(image As Image)
デストラクタ
Sub ~Graphics()
FromHDC
Static Function FromHDC(hdc As HDC) As Graphics Static Function FromHDC(hdc As HDC, hdevice As HANDLE) As Graphics
引数が対応するコンストラクタを使用し、Newで新しいGraphicsインスタンスを作成します。
- 戻り値
- 作成されたインスタンス。
FromHWND
Static Function FromHWND(hwnd As HWND) As Graphics Static Function FromHWND(hwnd As DWord, icm As BOOL) As Graphics
引数が対応するコンストラクタを使用し、Newで新しいGraphicsインスタンスを作成します。
- 戻り値
- 作成されたインスタンス。
FromImage
Static Function FromImage(image As Image) As Graphics
引数が対応するコンストラクタを使用し、Newで新しいGraphicsインスタンスを作成します。
- 戻り値
- 作成されたインスタンスへのポインタ。
Flush
Sub Flush() Sub Flush(intention As FlushIntention)
GetHDC
Function GetHDC() As HDC
ReleaseHDC
Sub ReleaseHDC(hdc As HDC)
SetRenderingOrigin
Function SetRenderingOrigin(x As Long, y As Long) As Status
GetRenderingOrigin
Const Function GetRenderingOrigin(ByRef x As Long, ByRef y As Long) As Status
SetCompositingMode
Function SetCompositingMode(compositingMode As CompositingMode) As Status
GetCompositingMode
Const Function GetCompositingMode() As CompositingMode
SetCompositingQuality
Function SetCompositingQuality(compositingQuality As CompositingQuality)
GetCompositingQuality
Const Function GetCompositingQuality() As CompositingQuality
SetTextRenderingHint
Function SetTextRenderingHint(newMode As TextRenderingHint) As Status
GetTextRenderingHint
Const Function GetTextRenderingHint() As TextRenderingHint
SetTextContrast
Function SetTextContrast(contrast As DWord) As Status
GetTextContrast
Const Function GetTextContrast() As DWord
GetInterpolationMode
Const Function GetInterpolationMode() As InterpolationMode
SetInterpolationMode
Function SetInterpolationMode(interpolationMode As InterpolationMode) As Status
GetSmoothingMode
Const Function GetSmoothingMode() As SmoothingMode
SetSmoothingMode
Function SetSmoothingMode(smoothingMode As SmoothingMode) As Status
GetPixelOffsetMode
Const Function GetPixelOffsetMode() As PixelOffsetMode
SetPixelOffsetMode
Function SetPixelOffsetMode(pixelOffsetMode As PixelOffsetMode) As Status
SetTransform
Function SetTransform(matrix As /*Const*/ *Matrix) As Status
ResetTransform
Function ResetTransform() As Status
MultiplyTransform
Function MultiplyTransform(matrix As /*Const*/ Matrix) As Status Function MultiplyTransform(matrix As /*Const*/ Matrix, order As MatrixOrder) As Status
TranslateTransform
Function TranslateTransform(dx As Single, dy As Single) As Status Function TranslateTransform(dx As Single, dy As Single, order As MatrixOrder) As Status
ScaleTransform
Function ScaleTransform(sx As Single, sy As Single) As Status Function ScaleTransform(sx As Single, sy As Single, order As MatrixOrder) As Status
RotateTransform
Function RotateTransform(angle As Single, order As MatrixOrder) As Status
GetTransform
Const Function GetTransform(matrix As Matrix) As Status
TransformPoints
Const Function TransformPoints(destSpace As CoordinateSpace, srcSpace As CoordinateSpace, pts As PointF, count As Long) As Status Const Function TransformPoints(destSpace As CoordinateSpace, srcSpace As CoordinateSpace, pts As Point, count As Long) As Status
GetNearestColor
Const Function GetNearestColor(ByRef color As Color) As Status
DrawLine
Function DrawLine(pen As /*Const*/ Pen, x1 As Single, y1 As Single, x2 As Single, y2 As Single) As Status Function DrawLine(pen As /*Const*/ Pen, pt1 As /*Const*/ PointF, pt2 As /*Const*/ PointF) As Status Function DrawLine(pen As /*Const*/ Pen, x1 As Long, y1 As Long, x2 As Long, y2 As Long) As Status Function DrawLine(pen As /*Const*/ Pen, pt1 As /*Const*/ Point, pt2 As /*Const*/ Point) As Status
DrawLines
Function DrawLines(pen As /*Const*/ Pen, points As /*Const*/ *PointF, count As Long) As Status Function DrawLines(pen As /*Const*/ Pen, points As /*Const*/ *Point, count As Long) As Status
DrawArc
Function DrawArc(pen As /*Const*/ Pen, x As Single, y As Single, width As Single, height As Single, startAngle As Single, sweepAngle As Single) As Status Function DrawArc(pen As /*Const*/ Pen, rect As /*Const*/ RectangleF, startAngle As Single, sweepAngle As Single) As Status Function DrawArc(pen As /*Const*/ Pen, x As Long, y As Long, width As Long, height As Long, startAngle As Single, sweepAngle As Single) As Status Function DrawArc(pen As /*Const*/ Pen, rect As /*Const*/ RectangleF, startAngle As Single, sweepAngle As Single) As Status
DrawBezier
Function DrawBezier(pen As /*Const*/ Pen, x1 As Single, y1 As Single, x2 As Single, y2 As Single, x3 As Single, y3 As Single, x4 As Single, y4 As Single) As Status Function DrawBezier(pen As /*Const*/ Pen, pt1 As /*Const*/ PointF, pt2 As /*Const*/ PointF, pt3 As /*Const*/ PointF, pt4 As /*Const*/ PointF) As Status Function DrawBezier(pen As /*Const*/ Pen, x1 As Long, y1 As Long, x2 As Long, y2 As Long, x3 As Long, y3 As Long, x4 As Long, y4 As Long) As Status Function DrawBezier(pen As /*Const*/ Pen, pt1 As /*Const*/ Point, pt2 As /*Const*/ Point, pt3 As /*Const*/ Point, pt4 As /*Const*/ Point) As Status
DrawBeziers
Function DrawBeziers(pen As /*Const*/ Pen, points As /*Const*/ *PointF, count As Long) As Status Function DrawBeziers(pen As /*Const*/ Pen, points As /*Const*/ *Point count As Long) As Status
DrawRectangle
Function DrawRectangle(pen As /*Const*/ Pen, rect As /*Const*/ RectangleF) As Status Function DrawRectangle(pen As /*Const*/ Pen, x As Single, y As Single, width As Single, height As Single) As Status Function DrawRectangle(pen As /*Const*/ Pen, rect As /*Const*/ Rectangle) As Status Function DrawRectangle(pen As /*Const*/ Pen, x As Long, y As Long, width As Long, height As Long) As Status
DrawRectangles
Function DrawRectangles(pen As /*Const*/ Pen, rects As /*Const*/ *RectangleF, count As Long) As Status Function DrawRectangles(pen As /*Const*/ Pen, rects As /*Const*/ *Rectangle, count As Long) As Status
DrawEllipse
Function DrawEllipse(pen As /*Const*/ Pen, rect As /*Const*/ RectangleF) As Status Function DrawEllipse(pen As /*Const*/ Pen, x As Single, y As Single, width As Single, height As Single) As Status Function DrawEllipse(pen As /*Const*/ Pen, rect As /*Const*/ Rectangle) As Status Function DrawEllipse(pen As /*Const*/ Pen, x As Long, y As Long, width As Long, height As Long) As Status
DrawPie
Function DrawPie(pen As /*Const*/ Pen, rect As /*Const*/ RectangleF, startAngle As Single, sweepAngle As Single) As Status Function DrawPie(pen As /*Const*/ Pen, x As Single, y As Single, width As Single, height As Single, startAngle As Single, sweepAngle As Single) As Status Function DrawPie(pen As /*Const*/ Pen, rect As /*Const*/ Rectangle, startAngle As Single, sweepAngle As Single) As Status Function DrawPie(pen As /*Const*/ Pen, x As Long, y As Long, width As Long, height As Long, startAngle As Single, sweepAngle As Single) As Status
DrawPolygon
Function DrawPolygon(pen As /*Const*/ Pen, points As /*Const*/ *PointF, count As Long) As Status Function DrawPolygon(pen As /*Const*/ Pen, points As /*Const*/ *Point, count As Long) As Status
DrawPath
Function DrawPath(pen As /*Const*/ Pen, path As /*Const*/ GraphicsPath) As Status
DrawCurve
Function DrawCurve(pen As /*Const*/ Pen, points As /*Const*/ *PointF, count As Long) As Status Function DrawCurve(pen As /*Const*/ Pen, points As /*Const*/ *PointF, count As Long, tension As Single) As Status Function DrawCurve(pen As /*Const*/ Pen, points As /*Const*/ *PointF, count As Long, offset As Long, numberOfSegments As Long) As Status Function DrawCurve(pen As /*Const*/ Pen, points As /*Const*/ *PointF, count As Long, offset As Long, numberOfSegments As Long, tension As Single) As Status Function DrawCurve(pen As /*Const*/ Pen, points As /*Const*/ *Point, count As Long) As Status Function DrawCurve(pen As /*Const*/ Pen, points As /*Const*/ *Point, count As Long, tension As Single) As Status Function DrawCurve(pen As /*Const*/ Pen, points As /*Const*/ *Point, count As Long, offset As Long, numberOfSegments As Long) As Status Function DrawCurve(pen As /*Const*/ Pen, points As /*Const*/ *Point, count As Long, offset As Long, numberOfSegments As Long, tension As Single) As Status
DrawClosedCurve
Function DrawClosedCurve(pen As /*Const*/ Pen, points As /*Const*/ *PointF, count As Long) As Status Function DrawClosedCurve(pen As /*Const*/ Pen, points As /*Const*/ *PointF, count As Long, tension As Single) As Status Function DrawClosedCurve(pen As /*Const*/ Pen, points As /*Const*/ *Point, count As Long) As Status Function DrawClosedCurve(pen As /*Const*/ Pen, points As /*Const*/ *Point, count As Long, tension As Single) As Status
Clear
Function Clear(color As /*Const*/ Color) As Status
FillRectangle
Function FillRectangle(brush As /*Const*/ Brush, rect As /*Const*/ RectangleF) As Status Function FillRectangle(brush As /*Const*/ Brush, x As Single, y As Single, width As Single, height As Single) As Status Function FillRectangle(brush As /*Const*/ Brush, rect As /*Const*/ Rectangle) As Status Function FillRectangle(brush As /*Const*/ Brush, x As Long, y As Long, width As Long, height As Long) As Status
FillRectangles
Function FillRectangles(brush As /*Const*/ Brush, rects As /*Const*/ *RectangleF, count As Long) As Status Function FillRectangles(brush As /*Const*/ Brush, rects As /*Const*/ *Rectangle, count As Long) As Status
FillPolygon
Function FillPolygon(brush As /*Const*/ Brush, points As /*Const*/ *PointF, count As Long) As Status Function FillPolygon(brush As /*Const*/ Brush, points As /*Const*/ *PointF, count As Long, fillMode As FillMode) As Status Function FillPolygon(brush As /*Const*/ Brush, points As /*Const*/ *Point, count As Long) As Status Function FillPolygon(brush As /*Const*/ Brush, points As /*Const*/ *Point, count As Long, fillMode As FillMode) As Status
FillEllipse
Function FillEllipse(brush As /*Const*/ Brush, rect As /*Const*/ RectangleF) As Status Function FillEllipse(brush As /*Const*/ Brush, x As Single, y As Single, width As Single, height As Single) As Status Function FillEllipse(brush As /*Const*/ Brush, rect As /*Const*/ Rectangle) As Status Function FillEllipse(brush As /*Const*/ Brush, x As Long, y As Long, width As Long, height As Long) As Status
FillPie
Function FillPie(brush As /*Const*/ Brush, rect As /*Const*/ RectangleF, startAngle As Single, sweepAngle As Single) As Status Function FillPie(brush As /*Const*/ Brush, x As Single, y As Single, width As Single, height As Single, startAngle As Single, sweepAngle As Single) As Status Function FillPie(brush As /*Const*/ Brush, rect As /*Const*/ Rectangle, startAngle As Single, sweepAngle As Single) As Status Function FillPie(brush As /*Const*/ Brush, x As Long, y As Long, width As Long, height As Long, startAngle As Single, sweepAngle As Single) As Status
FillPath
Function FillPath(brush As /*Const*/ Brush, path As /*Const*/ GraphicsPath) As Status
FillClosedCurve
Function FillClosedCurve(brush As /*Const*/ Brush, points As /*Const*/ *PointF, count As Long) As Status Function FillClosedCurve(brush As /*Const*/ Brush, points As /*Const*/ *PointF, count As Long, fillMode As FillMode) As Status Function FillClosedCurve(brush As /*Const*/ Brush, points As /*Const*/ *PointF, count As Long, fillMode As FillMode, tension As Single) As Status Function FillClosedCurve(brush As /*Const*/ Brush, points As /*Const*/ *Point, count As Long) As Status Function FillClosedCurve(brush As /*Const*/ Brush, points As /*Const*/ *Point, count As Long, fillMode As FillMode) As Status Function FillClosedCurve(brush As /*Const*/ Brush, points As /*Const*/ *Point, count As Long, fillMode As FillMode, tension As Single) As Status
FillRegion
Function FillRegion(brush As /*Const*/ Brush, region As /*Const*/ Region) As Status
DrawString
Function DrawString(str As PCWSTR, length As Long, font As /*Const*/ Font, layoutRect As /*Const*/ RectangleF) As Status Function DrawString(str As PCWSTR, length As Long, font As /*Const*/ Font, layoutRect As /*Const*/ RectangleF, stringFormat As /*Const*/ StringFormat, brush As /*Const*/ Brush) As Status Function DrawString(str As PCWSTR, length As Long, font As /*Const*/ Font, layoutRect As /*Const*/ RectangleF, stringFormat As /*Const*/ StringFormat, brush As /*Const*/ Brush) As Status Function DrawString(str As PCWSTR, length As Long, font As /*Const*/ Font, origin As /*Const*/ PointF) As Status Function DrawString(str As PCWSTR, length As Long, font As /*Const*/ Font, origin As /*Const*/ PointF, brush As /*Const*/ Brush) As Status Function DrawString(str As PCWSTR, length As Long, font As /*Const*/ Font, origin As /*Const*/ PointF) As Status Function DrawString(str As PCWSTR, length As Long, font As /*Const*/ Font, origin As /*Const*/ PointF, stringFormat As /*Const*/ StringFormat) As Status Function DrawString(str As PCWSTR, length As Long, font As /*Const*/ Font, origin As /*Const*/ PointF, stringFormat As /*Const*/ StringFormat, brush As /*Const*/ Brush) As Status
MeasureString
Const Function MeasureString(str As PCWSTR, length As Long, font As /*Const*/ Font, layoutRect As /*Const*/ RectangleF, stringFormat As /*Const*/ StringFormat, boundingBox As RectangleF) As Status Const Function MeasureString(str As PCWSTR, length As Long, font As /*Const*/ Font, layoutRect As /*Const*/ RectangleF, stringFormat As /*Const*/ StringFormat, boundingBox As RectangleF, codepointsFitted As Long) As Status Const Function MeasureString(str As PCWSTR, length As Long, font As /*Const*/ Font, layoutRect As /*Const*/ RectangleF, stringFormat As /*Const*/ StringFormat, boundingBox As RectangleF, codepointsFitted As Long, linesFilled As Long) As Status Const Function MeasureString(str As PCWSTR, length As Long, font As /*Const*/ Font, layoutRectSize As /*Const*/ SizeF, stringFormat As /*Const*/ StringFormat, size As SizeF) As Status Const Function MeasureString(str As PCWSTR, length As Long, font As /*Const*/ Font, layoutRectSize As /*Const*/ SizeF, stringFormat As /*Const*/ StringFormat, size As SizeF, codepointsFitted As Long) As Status Const Function MeasureString(str As PCWSTR, length As Long, font As /*Const*/ Font, layoutRectSize As /*Const*/ SizeF, stringFormat As /*Const*/ StringFormat, size As SizeF, codepointsFitted As Long, linesFilled As Long) As Status Const Function MeasureString(str As PCWSTR, length As Long, font As /*Const*/ Font, origin As /*Const*/ PointF, stringFormat As /*Const*/ StringFormat, boundingBox As RectangleF) As Status Const Function MeasureString(str As PCWSTR, length As Long, font As /*Const*/ Font, layoutRect As /*Const*/ RectangleF, boundingBox As RectangleF) As Status Const Function MeasureString(str As PCWSTR, length As Long, font As /*Const*/ Font, origin As /*Const*/ PointF, boundingBox As RectangleF) As Status
MeasureCharacterRanges
Const Function MeasureCharacterRanges(str As PCWSTR, length As Long, font As /*Const*/ Font, layoutRect As /*Const*/ RectangleF, stringFormat As /*Const*/ StringFormat, regionCount As Long, regions As *Region) As Status
DrawDriverString
Function DrawDriverString(text As /*Const*/ Word, length As Long, font As /*Const*/ Font, brush As /*Const*/ Brush, positions As /*Const*/ *PointF, flags As Long) As Status Function DrawDriverString(text As /*Const*/ Word, length As Long, font As /*Const*/ Font, brush As /*Const*/ Brush, positions As /*Const*/ *PointF, flags As Long, matrix As /*Const*/ Matrix) As Status
MeasureDriverString
Const Function MeasureDriverString(text As /*Const*/ Word, length As Long, font As /*Const*/ Font, positions As /*Const*/ *PointF, flags As Long, matrix As /*Const*/ Matrix, boundingBox As RectangleF) As Status
DrawCachedBitmap
Function DrawCachedBitmap(cb As CachedBitmap, x As Long, y As Long) As Status
DrawImage
詳しくはGraphics.DrawImageをご覧ください。
EnumerateMetafile
詳しくはGraphics.EnumerateMetafileをご覧ください。
SetClip
Function SetClip(g As /*Const*/ Graphics) As Status Function SetClip(rc As /*Const*/ RectangleF) As Status Function SetClip(rc As /*Const*/ Rectangle) As Status Function SetClip(path As /*Const*/ GraphicsPath) As Status Function SetClip(region As /*Const*/ Region) As Status Function SetClip(g As /*Const*/ Graphics, combineMode As CombineMode) As Status Function SetClip(rc As /*Const*/ RectangleF, combineMode As CombineMode) As Status Function SetClip(rc As /*Const*/ Rectangle, combineMode As CombineMode) As Status Function SetClip(path As /*Const*/ GraphicsPath, combineMode As CombineMode) As Status Function SetClip(region As /*Const*/ Region, combineMode As CombineMode) As Status Function SetClip(hrgn As HRGN, combineMode As CombineMode) As Status
IntersectClip
Function IntersectClip(rc As /*Const*/ RectangleF) As Status Function IntersectClip(rc As /*Const*/ Rectangle) As Status Function IntersectClip(region As /*Const*/ Region) As Status
ExcludeClip
Function ExcludeClip(rc As /*Const*/ RectangleF) As Status Function ExcludeClip(rc As /*Const*/ Rectangle) As Status Function ExcludeClip(region As /*Const*/ Region) As Status
ResetClip
Function ResetClip() As Status
TranslateClip
Function TranslateClip(dx As Single, dy As Single) As Status Function TranslateClip(dx As Long, dy As Long) As Status
GetClip
Const Function GetClip(region As Region) As Status
GetClipBounds
Const Function GetClipBounds(rc As RectangleF) As Status Const Function GetClipBounds(rc As Rectangle) As Status
GetVisibleClipBounds
Const Function GetVisibleClipBounds(ByRef rc As RectangleF) As Status Const Function GetVisibleClipBounds(ByRef rc As Rectangle) As Status
IsVisible
Const Function IsVisible(x As Long, y As Long) As BOOL Const Function IsVisible(pt As /*Const*/ Point) As BOOL Const Function IsVisible(x As Long, y As Long, width As Long, height As Long) As BOOL Const Function IsVisible(rc As /*Const*/ Rectangle) As BOOL Const Function IsVisible(x As Single, y As Single) As BOOL Const Function IsVisible(point As /*Const*/ PointF) As BOOL Const Function IsVisible(x As Single, y As Single, width As Single, height As Single) As BOOL Const Function IsVisible(rect As /*Const*/ RectangleF) As BOOL
Save
Const Function Save() As GraphicsState
Restore
Function Restore(gstate As GraphicsState)
BeginContainer
Function BeginContainer(dstrect As /*Const*/ RectangleF, srcrect As /*Const*/ RectangleF, unit As GraphicsUnit) As GraphicsContainer Function BeginContainer(dstrect As /*Const*/ Rectangle, srcrect As /*Const*/ Rectangle, unit As GraphicsUnit) As GraphicsContainer Function BeginContainer() As GraphicsContainer
EndContainer
Function EndContainer(state As GraphicsContainer) As Status
AddMetafileComment
Function AddMetafileComment(data As /*Const*/ *Byte, sizeData As DWord)
GetHalftonePalette
Static Function GetHalftonePalette() As HPALETTE
GetLastStatus
Const Function GetLastStatus() As Status
備考
その他のGraphicsとの相違
.NET Framework 2.0のSystem.Graphics.Graphics クラスに存在する次のメソッドは、実装されません。
- ReleaseDCの引数を取らないオーバーロード
- FromHdcInternal
- FromHow
- FromHwndInternal
- ReleaseHdcInternal
次のメソッドは、現在実装されていませんが、将来的に実装される予定です。
- CopyFromScreenの全てのオーバーロード
- DrawIconの全てのオーバーロード
- DrawIconUnstretchedの全てのオーバーロード
- DrawImageUnscaled
- DrawImageUnscaledAndClipped
次のメソッドはオーバーロードの引数が大きく異なっています。将来的に修正される予定です。
- DrawString
- MeasureString
その他のメソッドも引数の型が一部異なっています(GetDCなど)。
ネイティブC++用のGdiplus::Graphics クラスに存在するメソッド(オーバーロードされている場合はその全て)は、全て対応するものが存在しますが、一部はプロパティに分類されているものもあります(無論メソッドとして呼び出すことも可能です)。