[StructLayout(LayoutKind.Sequential)]
struct POINT {
public int x;
public int y;
public POINT(int x, int y) {
this.x = x;
this.y = y;
}
public Point ToPoint() {
return new Point(x, y);
}
public static POINT FromPoint(Point pt) {
return new POINT(pt.X, pt.Y);
}
public override string ToString() {
return string.Format("{{X={0}, Y={1}}}", x, y);
}
}
<StructLayout(LayoutKind.Sequential)> Structure POINT
Public x As Integer
Public y As Integer
Public Sub New(ByVal x As Integer, ByVal y As Integer)
Me.x = x
Me.y = y
End Sub
Public Function ToPoint() As System.Drawing.Point
Return New System.Drawing.Point(x, y)
End Function
Public Shared Function FromPoint(ByVal pt As System.Drawing.Point) As POINT
Return New Point(pt.X, pt.Y)
End Function
Public Overrides Function ToString() As String
Return String.Format("{{X={0}, Y={1}}}", x, y)
End Function
End Structure
None.
Please add some!
Please add some!