Rect.Union Methode
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee maakt u een rechthoek die precies groot genoeg is om een bepaalde rechthoek en een opgegeven punt of tweede rechthoek te bevatten.
Overloads
| Name | Description |
|---|---|
| Union(Point) |
Breidt de huidige rechthoek precies genoeg uit om het opgegeven punt te bevatten. |
| Union(Rect) |
Breidt de huidige rechthoek precies genoeg uit om de opgegeven rechthoek te bevatten. |
| Union(Rect, Point) |
Hiermee maakt u een rechthoek die precies groot genoeg is om de opgegeven rechthoek en het opgegeven punt op te nemen. |
| Union(Rect, Rect) |
Hiermee maakt u een rechthoek die precies groot genoeg is om de twee opgegeven rechthoeken te bevatten. |
Union(Point)
Breidt de huidige rechthoek precies genoeg uit om het opgegeven punt te bevatten.
public:
void Union(System::Windows::Point point);
public void Union(System.Windows.Point point);
member this.Union : System.Windows.Point -> unit
Public Sub Union (point As Point)
Parameters
- point
- Point
Het punt dat moet worden opgenomen.
Voorbeelden
In het volgende voorbeeld ziet u hoe u de Union(Point) methode gebruikt om de huidige rechthoek precies genoeg uit te vouwen om een bepaalde Pointrechthoek te bevatten.
private Rect unionExample1()
{
// Initialize new rectangle.
Rect myRectangle = new Rect();
// The Location property specifies the coordinates of the upper left-hand
// corner of the rectangle.
myRectangle.Location = new Point(10, 5);
// Set the Size property of the rectangle with a width of 200
// and a height of 50.
myRectangle.Size = new Size(200, 50);
// The Union method expands the current rectangle exactly enough to contain
// the specified point. myRectangle expands to a location of 0,0 and a size
// of 210,55.
myRectangle.Union(new Point(0,0));
// Returns 0,0,210,55
return myRectangle;
}
Zie ook
Van toepassing op
Union(Rect)
Breidt de huidige rechthoek precies genoeg uit om de opgegeven rechthoek te bevatten.
public:
void Union(System::Windows::Rect rect);
public void Union(System.Windows.Rect rect);
member this.Union : System.Windows.Rect -> unit
Public Sub Union (rect As Rect)
Parameters
- rect
- Rect
De rechthoek die moet worden opgenomen.
Voorbeelden
In het volgende voorbeeld ziet u hoe u de Union(Rect) methode gebruikt om de huidige rechthoek precies genoeg uit te vouwen om de opgegeven rechthoek te bevatten.
private Rect unionExample2()
{
// Initialize new rectangle.
Rect myRectangle = new Rect();
// The Location property specifies the coordinates of the upper left-hand
// corner of the rectangle.
myRectangle.Location = new Point(10, 5);
// Set the Size property of the rectangle with a width of 200
// and a height of 50.
myRectangle.Size = new Size(200, 50);
// Create second rectangle.
Rect myRectangle2 = new Rect();
myRectangle2.Location = new Point(0, 0);
myRectangle2.Size = new Size(200, 50);
// The Union method expands the current rectangle exactly enough to contain
// the specified rectangle. myRectangle expands to a location of 0,0 and a size
// of 210,55.
myRectangle.Union(myRectangle2);
// Returns 0,0,210,55
return myRectangle;
}
Zie ook
Van toepassing op
Union(Rect, Point)
Hiermee maakt u een rechthoek die precies groot genoeg is om de opgegeven rechthoek en het opgegeven punt op te nemen.
public:
static System::Windows::Rect Union(System::Windows::Rect rect, System::Windows::Point point);
public static System.Windows.Rect Union(System.Windows.Rect rect, System.Windows.Point point);
static member Union : System.Windows.Rect * System.Windows.Point -> System.Windows.Rect
Public Shared Function Union (rect As Rect, point As Point) As Rect
Parameters
- rect
- Rect
De rechthoek die moet worden opgenomen.
- point
- Point
Het punt dat moet worden opgenomen.
Retouren
Een rechthoek die precies groot genoeg is om de opgegeven rechthoek en het opgegeven punt te bevatten.
Voorbeelden
In het volgende voorbeeld ziet u hoe u de Union(Rect, Point) methode gebruikt om een rechthoek te maken die precies groot genoeg is om een bepaalde rechthoek en een bepaalde Pointrechthoek te bevatten.
private Rect unionExample3()
{
// Initialize new rectangle.
Rect myRectangle = new Rect();
// The Location property specifies the coordinates of the upper left-hand
// corner of the rectangle.
myRectangle.Location = new Point(10, 5);
// Set the Size property of the rectangle with a width of 200
// and a height of 50.
myRectangle.Size = new Size(200, 50);
// Create second rectangle.
Rect myRectangle2 = new Rect();
myRectangle2.Location = new Point(0, 0);
myRectangle2.Size = new Size(200, 50);
// The Union method expands the current rectangle exactly enough to contain
// the specified rectangle and the specified Point. In this example, returnRect
// expands to a location of 0,0 and a size of 250,60.
Rect returnRect = Rect.Union(myRectangle2, new Point(250,60));
// Returns 0,0,250,60
return returnRect;
}
Zie ook
Van toepassing op
Union(Rect, Rect)
Hiermee maakt u een rechthoek die precies groot genoeg is om de twee opgegeven rechthoeken te bevatten.
public:
static System::Windows::Rect Union(System::Windows::Rect rect1, System::Windows::Rect rect2);
public static System.Windows.Rect Union(System.Windows.Rect rect1, System.Windows.Rect rect2);
static member Union : System.Windows.Rect * System.Windows.Rect -> System.Windows.Rect
Public Shared Function Union (rect1 As Rect, rect2 As Rect) As Rect
Parameters
- rect1
- Rect
De eerste rechthoek die moet worden opgenomen.
- rect2
- Rect
De tweede rechthoek die moet worden opgenomen.
Retouren
De resulterende rechthoek.
Voorbeelden
In het volgende voorbeeld ziet u hoe u de Union(Rect, Rect) methode gebruikt om een rechthoek te maken die precies groot genoeg is om twee opgegeven rechthoeken te bevatten.
private Rect unionExample4()
{
// Initialize new rectangle.
Rect myRectangle = new Rect();
// The Location property specifies the coordinates of the upper left-hand
// corner of the rectangle.
myRectangle.Location = new Point(10, 5);
// Set the Size property of the rectangle with a width of 200
// and a height of 50.
myRectangle.Size = new Size(200, 50);
// Create second rectangle.
Rect myRectangle2 = new Rect();
myRectangle2.Location = new Point(0, 0);
myRectangle2.Size = new Size(200, 50);
// Create a third rectangle.
Rect myRectangle3 = new Rect();
myRectangle3.Location = new Point(210, 60);
myRectangle3.Size = new Size(50, 50);
// The Union method expands the current rectangle exactly enough to contain
// the two specified rectangles. In this example, returnRect expands to
// a location of 0,0 and a size of 260,110.
Rect returnRect = Rect.Union(myRectangle2, myRectangle3);
// Returns 0,0,260,110
return returnRect;
}