回复 10楼 lianyicq
哦,原来是这个意思啊,那您能提供一下您使用的代码么,我从中提取一下单色的使用方法,不知道可不可以。不管可不可以,都谢谢您。
Option Explicit Dim c() As Long Private Sub Command1_Click() Picture1.AutoSize = False Picture2.AutoSize = False Picture1.AutoRedraw = True Picture2.AutoRedraw = True Picture1.ScaleMode = 3 Picture2.ScaleMode = 3 CommonDialog1.ShowOpen Picture1.Picture = LoadPicture(CommonDialog1.FileName) End Sub Private Sub Command2_Click() GenColor Dim i, j As Integer Dim r, g, b As Integer Dim color As Long For i = 0 To Picture1.ScaleWidth For j = 0 To Picture1.ScaleHeight color = Picture1.Point(i, j) r = (color And &HFF&) Picture2.PSet (i, j), c(1 + Int(r / (256 / Val(Text1.Text)))) Next j Next i Picture2.Refresh End Sub Sub GenColor() Dim i As Integer For i = 1 To Val(Text1.Text) ReDim Preserve c(i) c(i) = RGB(Int(255 * Rnd + 1), Int(255 * Rnd + 1), Int(255 * Rnd + 1)) Next End Sub