码迷,mamicode.com
首页 > 其他好文 > 详细

VB 颜色RGB

时间:2016-05-30 06:29:56      阅读:136      评论:0      收藏:0      [点我收藏+]

标签:

Option Explicit
Private Type RGBTYPE
    R As Byte
    G As Byte
    B As Byte
    X As Byte
End Type
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal y As Long) As RGBTYPE
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)

Private Sub Command1_Click()
    Dim cor As RGBTYPE
    cor = GetPixel(Me.hdc, 5, 5)
    Print cor.R
    Print cor.G
    Print cor.B
End Sub

Private Sub Command2_Click()
    Dim cor As RGBTYPE
    Dim Lcor As Long
    Lcor = Me.BackColor
    CopyMemory cor, Lcor, 4
    Print cor.R
    Print cor.G
    Print cor.B
    CopyMemory Lcor, cor, 4
    Print Lcor
End Sub

 

VB 颜色RGB

标签:

原文地址:http://www.cnblogs.com/youyouran/p/5540989.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!