首页 > 其他 > 详细

VB 颜色RGB

时间:2016-05-30 06:27:19      阅读:372      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!