Graphics.TranslateClip 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將此區域 Graphics 的截波區域以指定水平與垂直方向的量平移。
多載
| 名稱 | Description |
|---|---|
| TranslateClip(Int32, Int32) |
將此區域 Graphics 的截波區域以指定水平與垂直方向的量平移。 |
| TranslateClip(Single, Single) |
將此區域 Graphics 的截波區域以指定水平與垂直方向的量平移。 |
TranslateClip(Int32, Int32)
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
將此區域 Graphics 的截波區域以指定水平與垂直方向的量平移。
public:
void TranslateClip(int dx, int dy);
public void TranslateClip(int dx, int dy);
member this.TranslateClip : int * int -> unit
Public Sub TranslateClip (dx As Integer, dy As Integer)
參數
- dx
- Int32
翻譯的 X 座標。
- dy
- Int32
翻譯的 Y 座標。
範例
以下程式碼範例是為 Windows Forms 設計的,並需要 PaintEventArgse,這是 Paint 事件處理程序的參數。 此程式碼會執行下列動作:
為裁切區域建立一個矩形。
將裁剪區域設為矩形。
將截波區域平移為向量(50, 50)。
用實心黑色刷子填滿一個大矩形。
結果是一個平移的、小巧的黑色長方形。
public:
void TranslateClipInt( PaintEventArgs^ e )
{
// Create rectangle for clipping region.
Rectangle clipRect = Rectangle(0,0,100,100);
// Set clipping region of graphics to rectangle.
e->Graphics->SetClip( clipRect );
// Translate clipping region.
int dx = 50;
int dy = 50;
e->Graphics->TranslateClip( dx, dy );
// Fill rectangle to demonstrate translated clip region.
e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
}
private void TranslateClipInt(PaintEventArgs e)
{
// Create rectangle for clipping region.
Rectangle clipRect = new Rectangle(0, 0, 100, 100);
// Set clipping region of graphics to rectangle.
e.Graphics.SetClip(clipRect);
// Translate clipping region.
int dx = 50;
int dy = 50;
e.Graphics.TranslateClip(dx, dy);
// Fill rectangle to demonstrate translated clip region.
e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub TranslateClipInt(ByVal e As PaintEventArgs)
' Create rectangle for clipping region.
Dim clipRect As New Rectangle(0, 0, 100, 100)
' Set clipping region of graphics to rectangle.
e.Graphics.SetClip(clipRect)
' Translate clipping region.
Dim dx As Integer = 50
Dim dy As Integer = 50
e.Graphics.TranslateClip(dx, dy)
' Fill rectangle to demonstrate translated clip region.
e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
500, 300)
End Sub
適用於
TranslateClip(Single, Single)
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
將此區域 Graphics 的截波區域以指定水平與垂直方向的量平移。
public:
void TranslateClip(float dx, float dy);
public void TranslateClip(float dx, float dy);
member this.TranslateClip : single * single -> unit
Public Sub TranslateClip (dx As Single, dy As Single)
參數
- dx
- Single
翻譯的 X 座標。
- dy
- Single
翻譯的 Y 座標。
範例
以下程式碼範例是為 Windows Forms 設計的,並需要 PaintEventArgse,這是 Paint 事件處理程序的參數。 此程式碼會執行下列動作:
為裁切區域建立一個矩形。
將裁剪區域設為矩形。
將裁剪區域換成一個向量(50.0F, 50.0F)。
用實心黑色刷子填滿一個大矩形。
結果是一個平移的、小巧的黑色長方形。
public:
void TranslateClipFloat( PaintEventArgs^ e )
{
// Create rectangle for clipping region.
RectangleF clipRect = RectangleF(0.0F,0.0F,100.0F,100.0F);
// Set clipping region of graphics to rectangle.
e->Graphics->SetClip( clipRect );
// Translate clipping region.
float dx = 50.0F;
float dy = 50.0F;
e->Graphics->TranslateClip( dx, dy );
// Fill rectangle to demonstrate translated clip region.
e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
}
private void TranslateClipFloat(PaintEventArgs e)
{
// Create rectangle for clipping region.
RectangleF clipRect = new RectangleF(0.0F, 0.0F, 100.0F, 100.0F);
// Set clipping region of graphics to rectangle.
e.Graphics.SetClip(clipRect);
// Translate clipping region.
float dx = 50.0F;
float dy = 50.0F;
e.Graphics.TranslateClip(dx, dy);
// Fill rectangle to demonstrate translated clip region.
e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub TranslateClipFloat(ByVal e As PaintEventArgs)
' Create rectangle for clipping region.
Dim clipRect As New RectangleF(0.0F, 0.0F, 100.0F, 100.0F)
' Set clipping region of graphics to rectangle.
e.Graphics.SetClip(clipRect)
' Translate clipping region.
Dim dx As Single = 50.0F
Dim dy As Single = 50.0F
e.Graphics.TranslateClip(dx, dy)
' Fill rectangle to demonstrate translated clip region.
e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
500, 300)
End Sub