Tôi cần có kích thước hình chữ nhật của con trỏ cửa sổ cổ điển.Cách lấy kích thước con trỏ trong C#
Làm cách nào để có được kích thước con trỏ trong C#?
Tôi cần có kích thước hình chữ nhật của con trỏ cửa sổ cổ điển.Cách lấy kích thước con trỏ trong C#
Làm cách nào để có được kích thước con trỏ trong C#?
Bạn có thể sử dụng Cursor.Size:
int cursorWidth = Cursor.Size.Width;
int cursorHeight = Cursor.Size.Height;
Vâng, đó thực sự là đơn giản!
Hy vọng điều này sẽ hữu ích!
Một ví dụ nhỏ: Reference
if(this.Cursor != Cursors.Hand &
Cursor.Current == Cursors.Default)
{
// Draw the cursor stretched.
Graphics graphics = this.CreateGraphics();
Rectangle rectangle = new Rectangle(
new Point(10,10), new Size(cursor.Size.Width * 2,
cursor.Size.Height * 2));
cursor.DrawStretched(graphics, rectangle);
// Draw the cursor in normal size.
rectangle.Location = new Point(
rectangle.Width + rectangle.Location.X,
rectangle.Height + rectangle.Location.Y);
rectangle.Size = cursor.Size;
cursor.Draw(graphics, rectangle);
// Dispose of the cursor.
cursor.Dispose();
}
cung cấp thông tin sâu thăm MSDN Link: http://msdn.microsoft.com/en-us/library/system.windows.forms.cursor.size.aspx
Đối với WPF bạn có thể thấy: http://stackoverflow.com/questions/8038853/how-can- i-define-the-cursor-size-in-wpf –