如何修复 cosmos os 中的鼠标管理器
how to fix mouse manager in cosmos os
我正在制作一个 cosmos os 项目,想制作一个鼠标光标,但它在 运行
之前继续崩溃
canvas = FullScreenCanvas.GetFullScreenCanvas();
canvas.Clear(System.Drawing.Color.Aqua);
Sys.MouseManager.ScreenWidth = (uint)canvas.Mode.Columns;
Sys.MouseManager.ScreenHeight = (uint)canvas.Mode.Rows;
Pen pen = new Pen(System.Drawing.Color.Red);
uint X = Sys.MouseManager.X;
uint Y = Sys.MouseManager.Y;
canvas.DrawLine(pen, X, Y, X + 5, Y);
canvas.DrawLine(pen, X, Y, X, Y - 5);
canvas.DrawLine(pen, X, Y, X + 5, Y - 5);
}
我希望它 运行 并且有一个光标,但它在它之前崩溃了 运行
问题不在于鼠标管理器。
我不知道是什么困扰着 Cosmos,但这就是你解决它的方法:
try
{
Canvas canvas = FullScreenCanvas.GetFullScreenCanvas();
Sys.MouseManager.ScreenWidth = (uint)canvas.Mode.Columns;
Sys.MouseManager.ScreenHeight = (uint)canvas.Mode.Rows;
Pen pen = new Pen(Color.Red);
int X = (int)Sys.MouseManager.X;
int Y = (int)Sys.MouseManager.Y;
canvas.DrawLine(pen, X, Y, X + 5, Y);
canvas.DrawLine(pen, X, Y, X, Y - 5);
canvas.DrawLine(pen, X, Y, X + 5, Y - 5);
}
catch (Exception ex)
{
System.Console.WriteLine(ex.Message);
}
希望它对你有用:)
我正在制作一个 cosmos os 项目,想制作一个鼠标光标,但它在 运行
之前继续崩溃 canvas = FullScreenCanvas.GetFullScreenCanvas();
canvas.Clear(System.Drawing.Color.Aqua);
Sys.MouseManager.ScreenWidth = (uint)canvas.Mode.Columns;
Sys.MouseManager.ScreenHeight = (uint)canvas.Mode.Rows;
Pen pen = new Pen(System.Drawing.Color.Red);
uint X = Sys.MouseManager.X;
uint Y = Sys.MouseManager.Y;
canvas.DrawLine(pen, X, Y, X + 5, Y);
canvas.DrawLine(pen, X, Y, X, Y - 5);
canvas.DrawLine(pen, X, Y, X + 5, Y - 5);
}
我希望它 运行 并且有一个光标,但它在它之前崩溃了 运行
问题不在于鼠标管理器。
我不知道是什么困扰着 Cosmos,但这就是你解决它的方法:
try
{
Canvas canvas = FullScreenCanvas.GetFullScreenCanvas();
Sys.MouseManager.ScreenWidth = (uint)canvas.Mode.Columns;
Sys.MouseManager.ScreenHeight = (uint)canvas.Mode.Rows;
Pen pen = new Pen(Color.Red);
int X = (int)Sys.MouseManager.X;
int Y = (int)Sys.MouseManager.Y;
canvas.DrawLine(pen, X, Y, X + 5, Y);
canvas.DrawLine(pen, X, Y, X, Y - 5);
canvas.DrawLine(pen, X, Y, X + 5, Y - 5);
}
catch (Exception ex)
{
System.Console.WriteLine(ex.Message);
}
希望它对你有用:)