我使用g.CopyFromScreen(screenpoint,Point.Empty,Bmp2.Size)(当前的dropper工具)使用颜色吸管工具制作应用程序,一旦我有吸管值我想将RBG值转换为单个整数。将RGB值转换为整数
我正在转换中的值是在该格式 颜色[A = 255,R = 240,G = 240,B = 240] ,其需要在四个不同的整数
我的代码是让我奇怪的结果,现在我失去了
我的代码:
Dim text1Conv As String
text1Conv = TextBox1.Text
Dim myChars() As Char = text1Conv.ToCharArray()
For Each ch As Char In myChars
If Char.IsDigit(ch) And Not ch = " " And Not ch = "," And Not count > 2 Then
color1Conv = color1Conv + ch
TextBox2.Text = TextBox2.Text + color1Conv 'test result
count = count + 1
ElseIf Char.IsDigit(ch) And Not ch = " " And Not ch = "," And count < 2 And Not count > 5 Then
color2Conv = color2Conv + ch
TextBox2.Text = TextBox2.Text + color2Conv 'test result
count = count + 1
ElseIf Char.IsDigit(ch) And Not ch = " " And Not ch = "," And count < 5 And Not count > 8 Then
color3Conv = color3Conv + ch
TextBox2.Text = TextBox2.Text + color3Conv 'test result
count = count + 1
ElseIf Char.IsDigit(ch) And Not ch = " " And Not ch = "," And count < 8 And Not count > 11 Then
color4Conv = color4Conv + ch
TextBox2.Text = TextBox2.Text + color4Conv 'test result
count = count + 1
End If
Next
结果:225 255 118 112 122 结果:225 255 116 772 721
可能容易的,但我不能看到它
到底是什么Textbox1.Text值的格式?它是颜色[A = 255,R = 240,G = 240,B = 240]? –
它应该看起来像这样225255118112作为一个测试结果,4个不同的整数... textbox1只是一个测试输出fyi – user3037472
它会始终用零填充以防数字低于100,即总是会有12个数字? –