「Pointクラス」の版間の差分

提供: AB開発Wiki
ナビゲーションに移動検索に移動
(PointF変換演算子を追加)
(ページ Point クラスPointクラス へ移動: #127)
 
(同じ利用者による、間の3版が非表示)
21行目: 21行目:
 
  Sub Point()
 
  Sub Point()
 
  Sub Point(initX As Long, initY As Long)
 
  Sub Point(initX As Long, initY As Long)
  Sub Point(ByRef pt As Point)
+
  Sub Point(pt As Point)
  Sub Point(ByRef sz As Size)
+
  Sub Point(sz As Size)
 
  Sub Point(dw As DWord)
 
  Sub Point(dw As DWord)
 
引数無しのコンストラクタはXとYを0へ初期化します。ほかはそれぞれ、XをinitX, pt.X, sz.Width, LOWORD(dw)で、YをinitY, pt.Y, sz.Height, HIWORD(dw)で初期化します。
 
引数無しのコンストラクタはXとYを0へ初期化します。ほかはそれぞれ、XをinitX, pt.X, sz.Width, LOWORD(dw)で、YをinitY, pt.Y, sz.Height, HIWORD(dw)で初期化します。
 
==== 代入 ====
 
Sub Operator = (ByRef pt As Point)
 
X = pt.X : Y = pt.Yを行います。
 
  
 
==== Operator + ====
 
==== Operator + ====
53行目: 49行目:
  
 
==== Add ====
 
==== Add ====
  Function Add(pt As Point) As Point
+
  Static Function Add(pt1 As Point, pt2 As Point) As Point
  Function Add(sz As Size) As Point
+
  Static Function Add(pt As Point, sz As Size) As Point
Xにpt.Xまたはsz.Widthを加え、Yにpt.Yまたはsz.Yを加えた値を持つ新しいPointのインスタンスを作成し、それを返します。
+
pt1とpt2、またはptとszを加算した新しいPointのインスタンスを作成し、それを返します。
  
 
==== Substract ====
 
==== Substract ====
  Function Substract(pt As Point) As Point
+
  Static Function Substract(pt1 As Point, pt2 As Point) As Point
  Function Substract(sz As Size) As Point
+
  Static Function Substract(pt As Point, sz As Size) As Point
Xにpt.Xまたはsz.Widthを引き、Yにpt.Yまたはsz.Yを引いた値を持つ新しいPointのインスタンスを作成し、それを返します。
+
pt1とpt2、またはptとszを減算した新しいPointのインスタンスを作成し、それを返します。
  
 
==== Offset ====
 
==== Offset ====
73行目: 69行目:
 
==== Ceiling ====
 
==== Ceiling ====
 
  Static Function Ceiling(ptf As PointF) As Point
 
  Static Function Ceiling(ptf As PointF) As Point
[[PointF クラス|PointF]]のインスタンスをPointへ変換します。XとYは[[Math クラス#Ceiling|Math.Ceiling]]を行った後、整数へ型変換されます。
+
[[PointFクラス|PointF]]のインスタンスをPointへ変換します。XとYは[[Mathクラス#Ceiling|Math.Ceiling]]を行った後、整数へ型変換されます。
  
 
==== Round ====
 
==== Round ====
 
  Static Function Round(ptf As PointF) As Point
 
  Static Function Round(ptf As PointF) As Point
[[PointF クラス|PointF]]のインスタンスをPointへ変換します。XとYは[[Math クラス#Round|Math.Round]]を行った後、整数へ型変換されます。
+
[[PointFクラス|PointF]]のインスタンスをPointへ変換します。XとYは[[Mathクラス#Round|Math.Round]]を行った後、整数へ型変換されます。
  
 
==== Truncate ====
 
==== Truncate ====
 
  Static Function Truncate(ptf As PointF) As Point
 
  Static Function Truncate(ptf As PointF) As Point
[[PointF クラス|PointF]]のインスタンスをPointへ変換します。XとYは[[Math クラス#Truncate|Math.Truncate]]を行った後、整数へ型変換されます。
+
[[PointFクラス|PointF]]のインスタンスをPointへ変換します。XとYは[[Mathクラス#Truncate|Math.Truncate]]を行った後、整数へ型変換されます。
  
 
== 関連項目 ==
 
== 関連項目 ==
* [[PointF クラス]]
+
* [[PointFクラス]]
 +
 
 +
[[Category:System.Drawing名前空間]]

2007年8月5日 (日) 12:04時点における最新版

Pointは整数で座標を表すクラスです。

クラスの機能

プロパティ

X

Function X() As Long
Sub X(newX As Long)

X座標の値を参照・設定します。

Y

Function Y() As Long
Sub Y(newY As Long)

Y座標の値を参照・設定します。

IsEmpty

Function IsEmpty() As BOOL

座標の値が空の場合(X, Y共に0の場合)に0以外の値を返します。空でない場合は0を返します。

メソッド

コンストラクタ

Sub Point()
Sub Point(initX As Long, initY As Long)
Sub Point(pt As Point)
Sub Point(sz As Size)
Sub Point(dw As DWord)

引数無しのコンストラクタはXとYを0へ初期化します。ほかはそれぞれ、XをinitX, pt.X, sz.Width, LOWORD(dw)で、YをinitY, pt.Y, sz.Height, HIWORD(dw)で初期化します。

Operator +

Function Operator + (pt As Point) As Point
Function Operator + (sz As Size) As Point

Add(pt)またはAdd(sz)を呼び、その結果を返します。

Operator -

Function Operator - (pt As Point) As Point
Function Operator - (sz As Size) As Point

Substract(pt)またはSubstract(sz)を呼び、その結果を返します。

Operator ==

Function Operator == (pt As Point) As BOOL

Equals(pt)を返します。

Operator <>

Function Operator <> (pt As Point) As BOOL

Not Equals(pt)を返します。

PointF変換演算子

Function Operator () As PointF

このインスタンスをPointFに変換してその結果を返します。

Add

Static Function Add(pt1 As Point, pt2 As Point) As Point
Static Function Add(pt As Point, sz As Size) As Point

pt1とpt2、またはptとszを加算した新しいPointのインスタンスを作成し、それを返します。

Substract

Static Function Substract(pt1 As Point, pt2 As Point) As Point
Static Function Substract(pt As Point, sz As Size) As Point

pt1とpt2、またはptとszを減算した新しいPointのインスタンスを作成し、それを返します。

Offset

Sub Offset(pt As Point)
Sub Offset(dx As Long, dy As Long)

Xにpt.Xまたはdx、Yにpt.Yまたはdyの値を加えてこのPointの値を平行移動します。

Equals

Function Equals(pt As Point) As BOOL

このPointのインスタンスとptが同じ座標を指しているかどうかを返します。This.X = pt.X And This.Y = pt.Yの結果を返します。

Ceiling

Static Function Ceiling(ptf As PointF) As Point

PointFのインスタンスをPointへ変換します。XとYはMath.Ceilingを行った後、整数へ型変換されます。

Round

Static Function Round(ptf As PointF) As Point

PointFのインスタンスをPointへ変換します。XとYはMath.Roundを行った後、整数へ型変換されます。

Truncate

Static Function Truncate(ptf As PointF) As Point

PointFのインスタンスをPointへ変換します。XとYはMath.Truncateを行った後、整数へ型変換されます。

関連項目