标题:【求助】帮我看看代码有没有什么问题
只看楼主
vbnetfans
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-6-11
 问题点数:0 回复次数:1 
【求助】帮我看看代码有没有什么问题
的窗体放上一个PictureBox和一个按钮  要做一个“图片逆反”的效果   下面代码运行后为什么没效果
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim tuxing As System.Drawing.Bitmap
        Dim color1 As System.Drawing.Color
        Dim color2 As System.Drawing.Color
        Dim i, j As Integer
        Dim g1 As System.Drawing.Graphics
        g1 = PictureBox1.CreateGraphics
        tuxing = PictureBox1.Image
        For i = 0 To PictureBox1.Image.Size.Width - 1
            For j = 0 To PictureBox1.Image.Size.Height - 1
                color1 = tuxing.GetPixel(i, j)
                color2 = Color.FromArgb(255 - color1.A, 255 - color1.B, 255 - color1.G, 255 - color1.R)
                tuxing.SetPixel(i, j, color1)
            Next j
            PictureBox1.Refresh()
        Next i


    End Sub
搜索更多相关主题的帖子: 代码 
2008-06-11 13:59
mthupc
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2007-10-24
得分:0 
呵呵
程序很不错,
tuxing.SetPixel(i, j, color1)改为
tuxing.SetPixel(i, j, color2)就有意思了
2008-07-20 20:12



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-218616-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.026100 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved