VB进行RGB分色
Posted JustXIII
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了VB进行RGB分色相关的知识,希望对你有一定的参考价值。
Option Explicit Private Type RGBA R As Byte G As Byte B As Byte A As Byte End Type Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long) Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal y As Long) As RGBA Private Sub Command1_Click() Dim cor As RGBA ‘用GetPixel取色,直接就分出来,注意看GetPixel声明的返回类型 cor = GetPixel(Me.hdc, 5, 5) Print cor.R, cor.G, cor.B End Sub Private Sub Command2_Click() Dim cor As RGBA Dim MeColor As Long MeColor = Me.BackColor ‘分离RGB CopyMemory cor, MeColor, 4 Print cor.R, cor.G, cor.B ‘转回整形颜色值 CopyMemory MeColor, cor, 4 Print MeColor End Sub
以上是关于VB进行RGB分色的主要内容,如果未能解决你的问题,请参考以下文章