vb.net中更改表单的像素颜色的问题 [英] Problem with change form's pixel color in vb.net

查看:68
本文介绍了vb.net中更改表单的像素颜色的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我正在尝试更改表单的像素颜色,但没有任何改变.

Hi I''m trying to change the color of pixels for my form but nothing changed.

<pre lang="vb"><br />
       private sub mybtn_click()  <br />
       Dim MyPixel As System.Drawing.Bitmap<br />
       Dim myColor As System.Drawing.Color<br />
        myColor = System.Drawing.Color.FromArgb(0, 0, 0)<br />
        MyPixel = New Bitmap(Me.Width, Me.Height)<br />
        For i As Integer = 0 To 100<br />
            For j As Integer = 0 To 100<br />
                MyPixel.SetPixel(i, j, myColor)<br />
                <br />
            Next j<br />
        Next <br />
end sub<br />
</pre>


运行后,当我单击我的btn时,我的像素颜色更改了,但是我看不到新颜色.为什么?


after run when i click on my btn my pixels color changed but i can''t see the new color. why?

推荐答案

好,您设置像素的颜色,但是您无处将新的位图绘制到窗体上.
Well, you set the pixels'' colour, but you nowhere paint your new bitmap onto your form.


那我怎么画呢?我必须重新绘制表格吗?
So how can I paint it? I must repaint my form?


这篇关于vb.net中更改表单的像素颜色的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆