Cursor 构造函数

定义

初始化 Cursor 类的新实例。Initializes a new instance of the Cursor class.

重载

Cursor(Stream)

从指定的 Stream 初始化 Cursor 类的新实例。Initializes a new instance of the Cursor class from the specified Stream.

Cursor(String)

从指定的 .ani 或 .cur 文件中初始化 Cursor 类的新实例****。Initializes a new instance of the Cursor class from the specified .ani or a .cur file.

Cursor(Stream, Boolean)

初始化 Cursor 类的新实例。Initializes a new instance of the Cursor class.

Cursor(String, Boolean)

初始化 Cursor 类的新实例。Initializes a new instance of the Cursor class.

Cursor(Stream)

从指定的 Stream 初始化 Cursor 类的新实例。Initializes a new instance of the Cursor class from the specified Stream.

public:
 Cursor(System::IO::Stream ^ cursorStream);
public Cursor (System.IO.Stream cursorStream);
new System.Windows.Input.Cursor : System.IO.Stream -> System.Windows.Input.Cursor
Public Sub New (cursorStream As Stream)

参数

cursorStream
Stream

包含光标的 StreamThe Stream that contains the cursor.

例外

cursorStreamnullcursorStream is null.

此构造函数无法创建临时文件。This constructor was unable to create a temporary file.

注解

对于 Stream ,WPF 会将数据写入临时文件,然后 Cursor 从文件中加载。For a Stream, WPF writes the data to a temporary file and then loads the Cursor from the file. 如果此构造函数无法创建临时文件, IOException 可能会引发。If this constructor is unable to create a temporary file, an IOException might be thrown. 例如, IOException 如果不能使用唯一的临时文件,可能会引发。For example, an IOException might be thrown if a unique temporary file is not available. 若要解决此错误,请尝试删除不需要的临时文件。To resolve this error, try deleting unneeded temporary files.

另请参阅

Cursor(String)

从指定的 .ani 或 .cur 文件中初始化 Cursor 类的新实例****。Initializes a new instance of the Cursor class from the specified .ani or a .cur file.

public:
 Cursor(System::String ^ cursorFile);
public Cursor (string cursorFile);
new System.Windows.Input.Cursor : string -> System.Windows.Input.Cursor
Public Sub New (cursorFile As String)

参数

cursorFile
String

包含光标的文件。The file that contains the cursor.

例外

cursorFilenullcursorFile is null.

cursorFile 不是 .ani 或 .cur 文件名****。cursorFile is not an .ani or .cur file name.

另请参阅

Cursor(Stream, Boolean)

初始化 Cursor 类的新实例。Initializes a new instance of the Cursor class.

public:
 Cursor(System::IO::Stream ^ cursorStream, bool scaleWithDpi);
public Cursor (System.IO.Stream cursorStream, bool scaleWithDpi);
new System.Windows.Input.Cursor : System.IO.Stream * bool -> System.Windows.Input.Cursor
Public Sub New (cursorStream As Stream, scaleWithDpi As Boolean)

参数

cursorStream
Stream

包含光标的 StreamThe Stream that contains the cursor.

scaleWithDpi
Boolean

如果要使用 dpi 进行缩放,则为 true;否则为 falsetrue if to scale with dpi; otherwise, false.

Cursor(String, Boolean)

初始化 Cursor 类的新实例。Initializes a new instance of the Cursor class.

public:
 Cursor(System::String ^ cursorFile, bool scaleWithDpi);
public Cursor (string cursorFile, bool scaleWithDpi);
new System.Windows.Input.Cursor : string * bool -> System.Windows.Input.Cursor
Public Sub New (cursorFile As String, scaleWithDpi As Boolean)

参数

cursorFile
String

包含光标的 StreamThe Stream that contains the cursor.

scaleWithDpi
Boolean

如果要使用 dpi 进行缩放,则为 true;否则为 falsetrue if to scale with dpi; otherwise, false.

适用于