我正在使用 windows mobile 并想在屏幕上画线或写名字?
我搜索了 GDI+ 或相关但无法完成。我怎样才能画线?我的鼠标按下事件代码如下,但它不平滑,并且线条中的间隙不正确的线条绘制。
int radius = 3; //Set the number of pixel you wan to use here
//Calculate the numbers based on radius
int x0 = Math.Max(e.X - (radius / 2), 0),
y0 = Math.Max(e.Y - (radius / 2), 0),
x1 = Math.Min(e.X + (radius / 2), pbBackground.Width),
y1 = Math.Min(e.Y + (radius / 2), pbBackground.Height);
Bitmap bm = (Bitmap)pbBackground.Image; //Get the bitmap (assuming it is stored that way)
for (int ix = x0; ix < x1; ix++)
{
for (int iy = y0; iy < y1; iy++)
{
bm.SetPixel(ix, iy, Color.Black); //Change the pixel color, maybe should be relative to bitmap
}
}
pbBackground.Refresh();