## 重载

 Addition(PointF, SizeF) 按指定的 PointF 平移 SizeF。Translates the PointF by the specified SizeF. Addition(PointF, Size) 将 PointF 平移给定 Size。Translates a PointF by a given Size.

``````public:
static System::Drawing::PointF operator +(System::Drawing::PointF pt, System::Drawing::SizeF sz);``````
``public static System.Drawing.PointF operator + (System.Drawing.PointF pt, System.Drawing.SizeF sz);``
``static member ( + ) : System.Drawing.PointF * System.Drawing.SizeF -> System.Drawing.PointF``
``Public Shared Operator + (pt As PointF, sz As SizeF) As PointF``

#### 参数

pt
PointF

sz
SizeF

SizeF，它指定要增加到 PointF 的 x 坐标和 y 坐标的数。The SizeF that specifies the numbers to add to the x- and y-coordinates of the PointF.

### 示例

``````private void OpAdditionExample(PaintEventArgs e)
{
PointF point1 = new PointF(120.5F, 120F);
SizeF size1 = new SizeF(120.5F, 30.5F);
RectangleF rect1 = new RectangleF(point1, size1);
if (new PointF(rect1.Right, rect1.Bottom) == point1 + size1)
e.Graphics.DrawString("They are equal", this.Font, Brushes.Black, rect1);
else
e.Graphics.DrawString("They are not equal", this.Font, Brushes.Red, rect1);
}
``````
``````Private Sub OpAdditionExample(ByVal e As PaintEventArgs)
Dim size1 As New SizeF(120.5F, 30.5F)
Dim point1 As New PointF(20.5F, 20F)
Dim rect1 As New RectangleF(point1, size1)
If New PointF(rect1.Right, rect1.Bottom) = point1 + size1 Then
e.Graphics.DrawString("They are equal", Me.Font, Brushes.Black, rect1)
Else
e.Graphics.DrawString("They are not equal", Me.Font, Brushes.Red, rect1)
End If

End Sub
``````

### 注解

Addition 运算符将指定大小的 Width 添加到 PointF 的 x 坐标，将 Height 添加到 PointF的 y 坐标。The Addition operator adds the Width of the specified size to the x-coordinate of the PointF and the Height to the y-coordinate of the PointF.

PointF 平移给定 SizeTranslates a PointF by a given Size.

``````public:
static System::Drawing::PointF operator +(System::Drawing::PointF pt, System::Drawing::Size sz);``````
``public static System.Drawing.PointF operator + (System.Drawing.PointF pt, System.Drawing.Size sz);``
``static member ( + ) : System.Drawing.PointF * System.Drawing.Size -> System.Drawing.PointF``
``Public Shared Operator + (pt As PointF, sz As Size) As PointF``

#### 参数

pt
PointF

sz
Size

Size，它指定要添加到 `pt` 的坐标的数字对。A Size that specifies the pair of numbers to add to the coordinates of `pt`.

### 示例

• 下面的代码示例使用 Addition 运算符将阴影添加到 ListBoxThe following code example adds a shadow to a ListBox using the Addition operator. 此示例旨在与 Windows 窗体一起使用。This example is designed to be used with a Windows Form. 若要运行此示例，请将此代码粘贴到窗体中，并在处理窗体的 Paint 事件时调用 `AddShadow` 方法。To run this example, paste this code into a form and call the `AddShadow` method when handling the form's Paint event. 请确保该窗体包含一个名为 `listBox1`ListBoxMake sure the form contains a ListBox named `listBox1`.
``````private:
{
// Create two SizeF objects.

// Get the location of the ListBox and convert it to a PointF.

// Add two points to get a new location.

// Create a rectangleF.

// Create a custom brush using a semi-transparent color, and
// then fill in the rectangle.
Color customColor = Color::FromArgb( 50, Color::Gray );
SolidBrush^ shadowBrush = gcnew SolidBrush( customColor );
array<RectangleF>^ temp0 = {rectFToFill};

// Dispose of the brush.
}
``````
``````private void AddShadow(PaintEventArgs e)
{

// Create two SizeF objects.
SizeF addSize = new SizeF(10.5F, 20.8F);

// Get the location of the ListBox and convert it to a PointF.

// Add two points to get a new location.

// Create a rectangleF.
RectangleF rectFToFill =

// Create a custom brush using a semi-transparent color, and
// then fill in the rectangle.
Color customColor = Color.FromArgb(50, Color.Gray);

// Dispose of the brush.
}
``````
``````Private Sub AddShadow(ByVal e As PaintEventArgs)

' Create two SizeF objects.
Dim shadowSize As SizeF = Size.op_Implicit(listBox1.Size)
Dim addSize As New SizeF(10.5F, 20.8F)

' Get the location of the ListBox and convert it to a PointF.
Dim shadowLocation As PointF = Point.op_Implicit(listBox1.Location)

' Add a Size to the Point to get a new location.

' Create a rectangleF.

' Create a custom brush using a semi-transparent color, and
' then fill in the rectangle.
Dim customColor As Color = Color.FromArgb(50, Color.Gray)
Dim shadowBrush As SolidBrush = New SolidBrush(customColor)