注册 登录
编程论坛 VB.NET论坛

解决“无法从带有索引像素格式的图像创建graphics对象”的实现过程

ltc611 发布于 2019-05-13 23:45, 2392 次点击
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim g As Graphics
        Dim p As New Pen(Brushes.Red)
        Dim img = Image.FromFile("C:\C4.bmp")

        Dim bmp = New Bitmap(img.Width, img.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
        g = Graphics.FromImage(bmp)
        g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic
        g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality
         = System.Drawing.
        g.DrawImage(img, 0, 0)
        PictureBox1.Image = bmp
        g = Graphics.FromImage(PictureBox1.Image)
        g.DrawEllipse(p, 300, 180, 100, 120)
        g.Dispose()
        p.Dispose()
    End Sub

[此贴子已经被作者于2019-5-13 23:57编辑过]

0 回复
1