vb.net如何将picturebox转换为位图

vb.net如何将picturebox转换为位图,vb.net,Vb.net,我想要picturebox的像素颜色值 我给picturebox分配了文本&现在我想得到每个像素的颜色值 什么是picturebox或我应该将其转换为位图的方法?怎么用? 在vb6中,有一个getpixel()方法来获取颜色值 .net中有什么?如果你能将其转换为位图,那就轻而易举了: Dim MyBitmap As New Bitmap(MyPicturebox.Image) Dim MyColor As Color MyColor = MyBitmap.GetPixel(X of your

我想要picturebox的像素颜色值 我给picturebox分配了文本&现在我想得到每个像素的颜色值 什么是picturebox或我应该将其转换为位图的方法?怎么用? 在vb6中,有一个getpixel()方法来获取颜色值
.net中有什么?

如果你能将其转换为位图,那就轻而易举了:

Dim MyBitmap As New Bitmap(MyPicturebox.Image)
Dim MyColor As Color
MyColor = MyBitmap.GetPixel(X of your pixel, Y of your pixel)

您可能希望循环像素,如果您知道宽度和高度,这并不难。

但是我没有将图像分配给picturebox,而是使用drawstring Dim g As Graphics=Picture1.CreateGraphics g.drawstring(TxtMsg.text,f,New SolidBrush(Color.Red)分配了文本, 0, 0)