开发者

.net "Canvas" control

I'm trying to (for educational purposes) creat开发者_运维百科e a image format, in order to display I'd like to be able to do something like SetPixel on some control to draw a pixel in the display area. How can I do this?


The most appropriate class for you is Bitmap which you can draw stright on form via Graphics class. Here is example:

    private void Form1_Paint(object sender, PaintEventArgs e)
    {
        Bitmap bmp = new Bitmap(640, 480);
        bmp.SetPixel(10, 12, Color.Green);

        e.Graphics.DrawImage(bmp, new Point(0, 0));
    }


Not sure if this is in line with what you are trying to do. But you could use the GDI+ libraries (System.Drawing) to get started. You will want to use the Bitmap class, and use the SetPixel() methods to "draw" on the image. Then you can use the PictureBox control and just keep updating it to the bitmap you are manipulating.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜