包含vb.net快速识别颜色的词条

vb.net 如何读取ini文件定义的ForeColor颜色值你好,我不知道你是用什么方法保存的,不过.net里的color有一个方法是Color.FromArgb 你可以这么做,dim
c
as
color=richtextbox1.ForeColor dim
colorstring
as
string=c.ToArgb().ToString
【包含vb.net快速识别颜色的词条】 colorstring就是颜色的值(字符串)再把colorstring保存到ini文件加载颜色的时候,从ini里读取colorstring 具体是:dim
RtextColor
as
color=Color.FromArgb(cint(colorstring))richtextbox1.ForeColor
=RtextColor
怎么用vb识别出图片任意一点的颜色值?'API函数声明
Option Explicit
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, _
ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, _
ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, _
ByVal y As Long) As Long
Private Type POINTAPI'创建用户自定义vb.net快速识别颜色的类型
x As Long'定义Xvb.net快速识别颜色的数据类型
y As Long'定义Yvb.net快速识别颜色的数据类型
End Type
Private Sub Timer1_Timer()
Dim P1 As POINTAPI, h As Long, h1 As Long, r1 As Long
GetCursorPos P1
h1 = GetDC(h)
r1 = GetPixel(h1, P1.x, P1.y)
If r1 = -1 Then
BitBlt Picture1.hdc, 0, 0, 1, 1, h1, P1.x, P1.y, vbSrcCopy
r1 = Picture1.Point(0, 0)
Else
Picture1.PSet (0, 0), r1
End If
label2.Caption = Hex$(r1)
Picture1.BackColor = r1
End Sub
Private Sub Command1_Click()
End
End Sub
在vb.net中,如何获取Graphics中某一指定点(像素)的颜色值?(VB语言)要使用GetPixel函数来取得像素的颜色值,代码如下:
1
2
3
4
5
private void button1_Click(object sender, EventArgs e)
{
Color color = new Bitmap(pictureBox1.Image).GetPixel(10, 10);
MessageBox.Show(color.ToString());
c#/vb.net如何通过反射获得颜色名称(字符串)对应的颜色(Color类型)?public Color col(string colorName)
{
Type colorType = typeof(Color);
PropertyInfo info = colorType.GetProperty(colorName, BindingFlags.Public |BindingFlags.Static);
if (infos == null)
{
//throw Exception
}
return(Color)info.GetValue(null, null);
}
是这个意思么?输入“Red”, 返回Color.Red 区分大小写
vb.net拾色器设计,要求:能获取图片任意位置的颜色VB可使用Point方法来获取图片指定点的颜色 。
Point 方法
按照长整数,返回在 Form 或 PictureBox 上所指定磅的红-绿-蓝 (RGB) 颜色 。
语法
object.Point(x, y)
'窗体判色代码:
Private Sub Form1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text1 = X
Text2 = Y
Text3 = Point(X, Y)
Text4 = (Val(Text3) Mod 65536) Mod 256 'Red
Text5 = (Val(Text3) Mod 65536) \ 256 'Green
Text6 = Val(Text3) \ 65536 'Blue
Shape1.FillColor = RGB(Val(Text4), Val(Text5), Val(Text6))
End Sub
'PictureBox判色代码:
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text1 = X
Text2 = Y
Text3 = Picture1.Point(X, Y)
Text4 = (Val(Text3) Mod 65536) Mod 256 'Red
Text5 = (Val(Text3) Mod 65536) \ 256 'Green
Text6 = Val(Text3) \ 65536 'Blue
Shape1.FillColor = RGB(Val(Text4), Val(Text5), Val(Text6))
End Sub
vb.net 如何对图片实现颜色识别没明白你意思,看看是这样么?Dim PGet As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(picture)for i=1 to picture.heightfor j=1 to picture.widthPGet .GetPixel(j, i)nextnext

推荐阅读