我曾这样试过:
Bitmap bit = new Bitmap(1, 1);//建立一个1*1像素的Bitmap
bit.SetPixel(Point.X, Point.Y, defPen.Color);//在Point处画defPen指定颜色这样子会报错“[System.ArgumentException] {"值不在预期的范围内。"}”
Bitmap bit = new Bitmap(1, 1);//建立一个1*1像素的Bitmap
bit.SetPixel(Point.X, Point.Y, defPen.Color);//在Point处画defPen指定颜色这样子会报错“[System.ArgumentException] {"值不在预期的范围内。"}”
static extern int GetPixel(IntPtr hdc, int XPos, int YPos);
[DllImport("gdi32.dll")]
static extern int SetPixel(IntPtr hdc, int X, int Y, int crColor);public int ColorToRGB(Color crColor)
{
return crColor.B << 16 | crColor.G << 8 | crColor.R;
}
private void button1_Click(object sender, EventArgs e)
{
Graphics vGraphics = Graphics.FromHwnd(Handle);
SetPixel(vGraphics.GetHdc(), 10, 10, ColorToRGB(Color.Red));
}
A:画点是不能用的,有画点的方法,如FillPie()
Q:用.net怎么样做出动态绘图的效果?
A:应该使用GraphicsPath类,而且MSDN上有现成实例,跟你要求的一模一样
回jcyluck,谢谢你的建议,我会参考一下MSDN
http://msdn.microsoft.com/zh-cn/library/bb531278(v=vs.90).aspx