作者:VB.NET开发
项目:System.Drawin
Private Sub TruncateAndRoundSizes()
' Create a SizeF.
Dim theSize As New SizeF(75.9, 75.9)
' Round the Size.
Dim roundedSize As Size = Size.Round(theSize)
' Truncate the Size.
Dim truncatedSize As Size = Size.Truncate(theSize)
'Print out the values on two labels.
Label1.Text = "Rounded size = " & roundedSize.ToString()
Label2.Text = "Truncated size = " & truncatedSize.ToString
End Sub
作者:VB程序
项目:System.Drawin
' 导入命名空间
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms
public class Test
public Shared Sub Main
Dim pt1 As New PointF(30.6F, 30.8F)
Dim pt2 As New PointF(50.3F, 60.7F)
Dim pt3 As New PointF(110.3F, 80.5F)
Dim sz1 As New SizeF(pt1)
Dim sz2 As New SizeF(pt2)
Dim sz3 As New SizeF(pt3)
Dim sz4 As Size = Size.Round(sz1)
Console.WriteLine(sz4.ToString())
End Sub
End class