語言

Point.Parse(String) 方法

定義

從指定的 Point構造 a 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 的結構。

例外狀況

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

適用於