[VB6 ] 螢幕區域取色問題

看板Visual_Basic作者 (Eagle)時間11年前 (2013/11/29 00:56), 編輯推噓1(101)
留言2則, 2人參與, 最新討論串1/1
看過人家寫的滑鼠取色程式(秀出RGB值), 有辦法修改成以滑鼠為中心的100x100 pixels 區域,然後及時秀出區域內的平均RGB值嗎 Dim ColorRGB As Long Dim IsFlow As Boolean Private Sub Form_DblClick() End End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) ColorRGB = Form2.Point(X, Y) Call GetRGB(X, Y) End Sub Private Sub GetRGB(X As Single, Y As Single) Dim r As Integer, g As Integer, b As Integer Dim r1 As String, g1 As String, b1 As String If IsFlow Then If X > Form2.Width / 2 Then Frame1.Left = X - Frame1.Width - 100 If Y > Form2.Height / 2 Then Frame1.Top = Y - Frame1.Height - 100 If X <= Form2.Width / 2 Then Frame1.Left = X + 100 If Y <= Form2.Height / 2 Then Frame1.Top = Y + 100 End If Shape1.FillStyle = 0 Shape1.FillColor = ColorRGB r = ColorRGB Mod 256 g = ColorRGB \ 256 Mod 256 b = ColorRGB \ 256 \ 256 LblcolorR.Caption = r LblcolorG.Caption = g LblcolorB.Caption = b r1 = IIf(r <> 0, Hex(r), "00") g1 = IIf(g <> 0, Hex(g), "00") b1 = IIf(b <> 0, Hex(b), "00") TxtColor.Text = "#" & r1 & g1 & b1 End Sub Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 1 Then IsFlow = True Else IsFlow = False End Sub Private Sub Label2_Click() End Sub Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If X Mod 150 <> 0 And Y Mod 150 <> 0 Then ColorRGB = Picture1.Point(X, Y) Call GetRGB(X, Y) End If End Sub -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.132.80.215

11/29 11:12, , 1F
11/29 11:12, 1F

12/03 11:35, , 2F
GetCursorPos,GetPixel,取所有顏色long值avg再分RGB?
12/03 11:35, 2F
文章代碼(AID): #1IbtNRV8 (Visual_Basic)
文章代碼(AID): #1IbtNRV8 (Visual_Basic)