Point.op_Subtraction メソッド
アセンブリ: System.Drawing (system.drawing.dll 内)

戻り値
指定の Size 構造体の負の値だけ平行移動される Point 構造体。

PointConverter と op_Subtraction 演算子を使用する方法を次のコード例に示します。この例は、Windows フォームでの使用を意図してデザインされています。このコードをフォームに貼り付け、フォームの Paint イベントを処理するときに PaintEventArgs の e を渡して ShowPointConverter メソッドを呼び出します。
Private Sub ShowPointConverter(ByVal e As PaintEventArgs) ' Create the PointConverter. Dim converter As System.ComponentModel.TypeConverter = _ System.ComponentModel.TypeDescriptor.GetConverter(GetType(Point)) Dim point1 As Point = _ CType(converter.ConvertFromString("200, 200"), Point) ' Use the subtraction operator to get a second point. Dim point2 As Point = Point.op_Subtraction(point1, _ New Size(190, 190)) ' Draw a line between the two points. e.Graphics.DrawLine(Pens.Black, point1, point2) End Sub
private void ShowPointConverter(PaintEventArgs e) { // Create the PointConverter. System.ComponentModel.TypeConverter converter = System.ComponentModel.TypeDescriptor.GetConverter(typeof(Point)); Point point1 = (Point) converter.ConvertFromString("200, 200"); // Use the subtraction operator to get a second point. Point point2 = point1 - new Size(190, 190); // Draw a line between the two points. e.Graphics.DrawLine(Pens.Black, point1, point2); }
void ShowPointConverter( PaintEventArgs^ e ) { // Create the PointConverter. System::ComponentModel::TypeConverter^ converter = System::ComponentModel::TypeDescriptor::GetConverter( Point::typeid ); Point point1 = *dynamic_cast<Point^>(converter->ConvertFromString( "200, 200" )); // Use the subtraction operator to get a second point. Point point2 = point1 - System::Drawing::Size( 190, 190 ); // Draw a line between the two points. e->Graphics->DrawLine( Pens::Black, point1, point2 ); }
private void ShowPointConverter(PaintEventArgs e) { // Create the PointConverter. PointConverter converter = new PointConverter(); Point point1 = (Point)converter.ConvertFromString("200, 200"); // Use the subtraction operator to get a second point. Point point2 = Point.op_Subtraction(point1 , new Size(190, 190)); // Draw a line between the two points. e.get_Graphics().DrawLine(Pens.get_Black(), point1, point2); } //ShowPointConverter

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- Point.op_Subtraction メソッドのページへのリンク