vb.net图像着色 vbs颜色代码

VB.NET:绘图后,如何才能取得所绘图形的颜色值?加入一个TextBox控件,一个Command控件
代码:
Private Declare Function GetPixel Lib "gdi32" (ByVal hDC As Long, ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function GetWindowDC Lib "user32" (ByVal hWnd As Long) As Long
Private Sub Command1_Click()
Dim Color As Long
WindowDC = GetWindowDC(0) '获取屏幕的设备场景
【vb.net图像着色 vbs颜色代码】Color = GetPixel(WindowDC, 500, 100) '获指定点的颜色
'分解RGB颜色值
R = (Color Mod 256) '红色
b = (Int(Color \ 65536)) '蓝色
G = ((Color - (b * 65536) - R) \ 256) '绿色
Text1.BackColor = RGB(R, G, b)
End Sub
VB.net 旋转图像时,如何指定填充色绘制线条采用Draw开头的方法,颜色参数用Pen类;
绘制有填充色的封闭图形采用Fill开头的方法,颜色参数用Brush类;
例如:
'绘制一个实心圆,该圆在:直线x=200,y=200,x=200+100,y=200+100所划矩形区域内
Me.CreateGraphics.FillEllipse(New SolidBrush(Color.Orange), 200, 200, 100, 100)
'绘制一个空心圆,该圆在:直线x=200 , y=200,x=200+100,y=200+100所划矩形区域内
Me.CreateGraphics.DrawEllipse(New Pen(Color.Black), 200, 200, 100, 100)
在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());
在VB.NET中(VS.net),怎样指定透明颜色,让图片透明 。Dim oBmp As Bitmap= new Bitmap(50, 30)
Graphics g = Graphics.FromImage(oBmp)
g.Clear(Color.White) ' 清除背景色
'.....
Vb.net怎么实现图像的处理这问题有点笼统vb.net图像着色,软糖来说说把:
图像处理由System.Drawing命名空间负责 。
主要是Bitmap类和Graphics类 。
Bitmap表示一个位图,可以是BMP,JPG,PNG等文件 。
装载位图
Dim 位图 As Bitmap = Bitmap.FromFile("C:\Image1.PNG")
Graphics表示一张画纸,能够进行绘制操作 。
它可以被窗体、控件、位图调用CreateGraphics()方法来创建 。
然后调用Graphics.Draw开头vb.net图像着色的一系列函数来绘制图像和图形,Fill开头的填充图形 。
创建画纸并绘制位图
Dim 画纸 As Graphics = Me.CreateGraphics()
画纸.DrawImage(位图, 100, 100, 256, 256)
可以将上面三行放到Form1_Load中测试,把路径改一下 , 
还可以把Me改为能在上面绘图的控件的名称 。
更多内容请看MSDN的System.Drawing命名空间 。
如满意,请采纳 , 谢谢 。
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

推荐阅读