SizeF::Addition Operator (SizeF, SizeF)
.NET Framework (current version)
Adds the width and height of one SizeF structure to the width and height of another SizeF structure.
Assembly: System.Drawing (in System.Drawing.dll)
Parameters
- sz1
-
Type:
System.Drawing::SizeF
The first SizeF structure to add.
- sz2
-
Type:
System.Drawing::SizeF
The second SizeF structure to add.
Return Value
Type: System.Drawing::SizeFA Size structure that is the result of the addition operation.
The following code example adds a shadow to a ListBox by using the following members:
Addition
This example is designed to be used with a Windows Form. To run this example, paste this code into a form and call the AddShadow method when handling the form's Paint event. Verify that the form contains a ListBox named listBox1.
private: void AddShadow( PaintEventArgs^ e ) { // Create two SizeF objects. SizeF shadowSize = listBox1->Size; SizeF addSize = SizeF(10.5F,20.8F); // Add them together and save the result in shadowSize. shadowSize = shadowSize + addSize; // Get the location of the ListBox and convert it to a PointF. PointF shadowLocation = listBox1->Location; // Add two points to get a new location. shadowLocation = shadowLocation + System::Drawing::Size( 5, 5 ); // Create a rectangleF. RectangleF rectFToFill = RectangleF(shadowLocation,shadowSize); // 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}; e->Graphics->FillRectangles( shadowBrush, temp0 ); // Dispose of the brush. delete shadowBrush; }
.NET Framework
Available since 1.1
Available since 1.1
Show: