Region.Translate Metoda
Definice
Důležité
Některé informace platí pro předběžně vydaný produkt, který se může zásadně změnit, než ho výrobce nebo autor vydá. Microsoft neposkytuje žádné záruky, výslovné ani předpokládané, týkající se zde uváděných informací.
Odsadí souřadnice o Region zadanou hodnotu.
Přetížení
Translate(Int32, Int32) |
Odsadí souřadnice o Region zadanou hodnotu. |
Translate(Single, Single) |
Odsadí souřadnice o Region zadanou hodnotu. |
Translate(Int32, Int32)
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
Odsadí souřadnice o Region zadanou hodnotu.
public:
void Translate(int dx, int dy);
public void Translate (int dx, int dy);
member this.Translate : int * int -> unit
Public Sub Translate (dx As Integer, dy As Integer)
Parametry
Příklady
Následující příklad kódu je navržený pro použití s model Windows Forms a vyžaduje PaintEventArgse
, což je parametr obslužné rutiny Paint události. Kód provede následující akce:
Vytvoří obdélník a nakreslí ho na obrazovku modře.
Vytvoří oblast z obdélníku.
Použije překlad na oblast.
Vyplní přeloženou oblast červenou a vykreslí přeloženou oblast na obrazovku červeně.
Všimněte si, že červený obdélník je od původního obdélníku posunutý modře dolů a doprava.
void TranslateExample( PaintEventArgs^ e )
{
// Create the first rectangle and draw it to the screen in blue.
Rectangle regionRect = Rectangle(100,50,100,100);
e->Graphics->DrawRectangle( Pens::Blue, regionRect );
// Create a region using the first rectangle.
System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect );
// Apply the translation to the region.
myRegion->Translate( 150, 100 );
// Fill the transformed region with red and draw it to the screen in red.
SolidBrush^ myBrush = gcnew SolidBrush( Color::Red );
e->Graphics->FillRegion( myBrush, myRegion );
}
public void TranslateExample(PaintEventArgs e)
{
// Create the first rectangle and draw it to the screen in blue.
Rectangle regionRect = new Rectangle(100, 50, 100, 100);
e.Graphics.DrawRectangle(Pens.Blue, regionRect);
// Create a region using the first rectangle.
Region myRegion = new Region(regionRect);
// Apply the translation to the region.
myRegion.Translate(150, 100);
// Fill the transformed region with red and draw it to the screen in red.
SolidBrush myBrush = new SolidBrush(Color.Red);
e.Graphics.FillRegion(myBrush, myRegion);
}
Public Sub TranslateExample(ByVal e As PaintEventArgs)
' Create the first rectangle and draw it to the screen in blue.
Dim regionRect As New Rectangle(100, 50, 100, 100)
e.Graphics.DrawRectangle(Pens.Blue, regionRect)
' Create a region using the first rectangle.
Dim myRegion As New [Region](regionRect)
' Apply the translation to the region.
myRegion.Translate(150, 100)
' Fill the transformed region with red and draw it to the
' screen in red.
Dim myBrush As New SolidBrush(Color.Red)
e.Graphics.FillRegion(myBrush, myRegion)
End Sub
Platí pro
Translate(Single, Single)
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
Odsadí souřadnice o Region zadanou hodnotu.
public:
void Translate(float dx, float dy);
public void Translate (float dx, float dy);
member this.Translate : single * single -> unit
Public Sub Translate (dx As Single, dy As Single)
Parametry
Příklady
Příklad kódu najdete v Translate(Single, Single) metodě .
Platí pro
Váš názor
https://aka.ms/ContentUserFeedback.
Připravujeme: V průběhu roku 2024 budeme postupně vyřazovat problémy z GitHub coby mechanismus zpětné vazby pro obsah a nahrazovat ho novým systémem zpětné vazby. Další informace naleznete v tématu:Odeslat a zobrazit názory pro