English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
所有分類

如果VB的form有一張圖
怎麼取得某個點座標的rgb值各是多少?
或是該點的顏色代碼?
各位大大幫幫忙

2005-11-19 07:51:49 · 3 個解答 · 發問者 Drunkard 2 in 電腦與網際網路 程式設計

我有試過用point
可是它的傳回值我不懂
它沒有把rgb各別是多少傳回來耶?

2005-11-19 11:26:54 · update #1

3 個解答

'在表單上放一個Label
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

MouseColor = Point(X, Y)
R = Fix(MouseColor Mod 256)
G = Fix((MouseColor Mod 65536) / 256)
B = Fix(MouseColor / 65536)
Label1.Caption = "RGB = " & R & "," & G & "," & B

End Sub

2005-11-22 18:03:53 · answer #1 · answered by Anonymous · 0 0

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim ColorValue As Long, R As Integer, G As Integer, B As Integer

ColorValue = Me.Point(X, Y)
R = ColorValue Mod 256
ColorValue = ColorValue \ 256
G = ColorValue Mod 256
ColorValue = ColorValue \ 256
B = ColorValue Mod 256
End Sub

2005-11-19 12:45:58 · answer #2 · answered by W.J.S. 7 · 0 0

Point(X As Single, Y As Single) As Long
傳回一 Long 型態的整數,表示 Form 或 PictureBox 物件上某一點的 RGB 色彩。

2005-11-19 08:25:32 · answer #3 · answered by 世賢 7 · 0 0

fedest.com, questions and answers