Share via


Point.Parse(String) 方法

定義

從指定的 Point 建構 String

public:
 static System::Windows::Point Parse(System::String ^ source);
public static System.Windows.Point Parse (string source);
static member Parse : string -> System.Windows.Point
Public Shared Function Parse (source As String) As Point

參數

source
String

點的字串表示。

傳回

Point

對等的 Point 結構。

例外狀況

source 不是由兩個以逗號或空格分隔的雙精度浮點數值所組成。

source 不包含兩個數字。

-或- source 含有太多分隔符號。

範例

下列範例示範如何使用 Parse 方法,將 String 點的表示轉換成 Point 結構。

private Point parseExample()
{

    // Converts a string representation of a point into a Point structure
    // using the Parse static method.
    // pointResult is equal to (1,3).
    Point pointResult = Point.Parse("1,3");

    return pointResult;
}
Private Function parseExample() As Point

    ' Converts a string representation of a point into a Point structure
    ' using the Parse static method.
    ' pointResult is equal to (1,3).
    Dim pointResult As Point = Point.Parse("1,3")

    Return pointResult

End Function

適用於