VB 颜色RGB

Posted 一个码农的蹉跎岁月

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了VB 颜色RGB相关的知识,希望对你有一定的参考价值。

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的主要内容,如果未能解决你的问题,请参考以下文章

一个vb编的程序!通过滚动条控制文本框颜色的改变

glsl片段着色器颜色添加逻辑

纹理中的 OpenGL 片段着色器

VB中如何设置调整label的字体、大小和颜色?

VB中HSL怎么转换为RGB?

RGB 颜色代码转换