做一个随机函数生成点的座标,然后更改bmp中相应点象素的颜色值。

解决方案 »

  1.   

    大侠,麻烦说清楚点啊,如何更改bmp中相应点象素的颜色值啊?
      

  2.   

    假设你的图片控件是 p1,
    System.Drawing.Graphics  dc = this.p1.CreateGraphics()
    控件的图形设备都得手了,下面怎么画应该不难了吧。
      

  3.   

    如果不是在控件上显示用,只是想修改文件
    可以看一下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 坐标。 

    要设置的像素的 y 坐标。 
    color 
    Color 结构,它表示要分配给指定像素的颜色。 
    返回值
    此方法不返回值。