假设你的图片控件是 p1, System.Drawing.Graphics dc = this.p1.CreateGraphics() 控件的图形设备都得手了,下面怎么画应该不难了吧。
如果不是在控件上显示用,只是想修改文件 可以看一下msdn上System.Drawing.Bitmap 类的帮助,其中有SetPixel()函数设置 Bitmap 对象中指定像素的颜色。[Visual Basic] Public Sub SetPixel( _ ByVal x As Integer, _ ByVal y As Integer, _ ByVal color As Color _ )[C#] public void SetPixel( int x, int y, Color color );[C++] public: void SetPixel( int x, int y, Color color );[JScript] public function SetPixel( x : int, y : int, color : Color );参数 x 要设置的像素的 x 坐标。 y 要设置的像素的 y 坐标。 color Color 结构,它表示要分配给指定像素的颜色。 返回值 此方法不返回值。
System.Drawing.Graphics dc = this.p1.CreateGraphics()
控件的图形设备都得手了,下面怎么画应该不难了吧。
可以看一下msdn上System.Drawing.Bitmap 类的帮助,其中有SetPixel()函数设置 Bitmap 对象中指定像素的颜色。[Visual Basic]
Public Sub SetPixel( _
ByVal x As Integer, _
ByVal y As Integer, _
ByVal color As Color _
)[C#]
public void SetPixel(
int x,
int y,
Color color
);[C++]
public: void SetPixel(
int x,
int y,
Color color
);[JScript]
public function SetPixel(
x : int,
y : int,
color : Color
);参数
x
要设置的像素的 x 坐标。
y
要设置的像素的 y 坐标。
color
Color 结构,它表示要分配给指定像素的颜色。
返回值
此方法不返回值。