vb.net GDI+

About .net GDI+ for testing:

 

 Private Sub Form6_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
        Dim pen As New System.Drawing.Pen(Color.FromArgb(100, 0, 0, 255), 25)
        'Dim graphics As System.Drawing.Graphics = e.Graphics
        'graphics.DrawLine(pen, 20, 10, 50, 10)

        'Dim graphics1 As System.Drawing.Graphics = e.Graphics
        'graphics1.DrawRectangle(pen, 20, 20, 50, 20)


        'Dim graphics2 As System.Drawing.Graphics = System.Drawing.Graphics.FromHwnd(Me.Handle)
        'graphics2.DrawRectangle(pen, 20, 20, 70, 70)

        'Dim graphics3 As System.Drawing.Graphics = e.Graphics
        'graphics3.DrawEllipse(pen, 20, 20, 80, 100)

        'Dim graphics4 As System.Drawing.Graphics = e.Graphics
        'graphics4.DrawPie(pen, 20, 101, 10, 10, 0, 90)

        'Dim graphics5 As System.Drawing.Graphics = e.Graphics
        'graphics5.DrawArc(pen, 20, 150, 140, 70, 30, 357)

        'Dim graphics6 As System.Drawing.Graphics = e.Graphics
        'Dim pointarray As Point() = {New Point(0, 0), New Point(10, 30), New Point(30, 30)}
        'graphics6.DrawPolygon(pen, pointarray)
        'graphics6.DrawCurve(pen, pointarray, 1.5F)
        'graphics6.DrawBezier(pen, 0, 0, 40, 20, 80, 150, 100, 10)

        'Dim graphics7 As System.Drawing.Graphics = e.Graphics
        'Dim graphicspath As New System.Drawing.Drawing2D.GraphicsPath
        'Dim pointarray1 As Point() = {New Point(5, 30), New Point(20, 40), New Point(50, 30)}
        'Dim fontfamily As New System.Drawing.FontFamily("宋体")
        'Dim pointf As New System.Drawing.PointF(50, 20)
        'Dim stringformat As New System.Drawing.StringFormat
        'graphicspath.AddArc(0, 0, 30, 20, -90, 180)
        'graphicspath.StartFigure()
        'graphicspath.AddCurve(pointarray1)
        'graphicspath.AddString("字符串", fontfamily, 0, 24, pointf, stringformat)
        'graphicspath.AddPie(230, 10, 40, 40, 40, 110)
        'graphics7.DrawPath(pen, graphicspath)

        'Dim graphics8 As System.Drawing.Graphics = e.Graphics
        'Dim solidbrush As New System.Drawing.SolidBrush(Color.Red)
        'graphics8.FillEllipse(solidbrush, 0, 0, 60, 40)
        'Dim hatchbrush As New System.Drawing.Drawing2D.HatchBrush(Drawing2D.HatchStyle.DottedGrid, Color.Blue, Color.Green)
        'graphics8.FillEllipse(hatchbrush, 0, 0, 60, 40)

        'Dim image As System.Drawing.Image = System.Drawing.Image.FromFile("d:/untitleddf.bmp")
        'Dim texturebrush As New System.Drawing.TextureBrush(image)
        'graphics8.FillEllipse(texturebrush, 0, 0, 100, 50)

        '' Set the Clip property to a new region.
        'e.Graphics.Clip = New Region(New Rectangle(10, 10, 100, 200))
        '' Fill the region.
        'e.Graphics.FillRegion(Brushes.LightSalmon, e.Graphics.Clip)
        '' Demonstrate the clip region by drawing a string
        '' at the outer edge of the region.
        'e.Graphics.DrawString("Outside of Clip", New Font("Arial", 12.0F, FontStyle.Regular), _
        '    Brushes.Black, 0.0F, 0.0F)

        'Dim bitmap As System.Drawing.Bitmap = System.Drawing.Image.FromFile("d:/untitleddf.bmp")
        'e.Graphics.DrawImage(bitmap, 0, 0)

        'Dim bitmap As New System.Drawing.Bitmap("untitleddf.bmp")
        'Dim rect As New System.Drawing.Rectangle(250, 250, bitmap.Width / 4, bitmap.Height / 4)
        'Dim nbitmap As System.Drawing.Bitmap = bitmap.Clone(rect, Imaging.PixelFormat.DontCare)
        'e.Graphics.DrawImage(bitmap, 10, 10)
        'e.Graphics.DrawImage(nbitmap, 150, 10)

        'Dim bitmap As New System.Drawing.Bitmap("untitleddf.bmp")
        'Dim expansionrectangle As New System.Drawing.Rectangle(135, 10, bitmap.Width, bitmap.Height)
        'Dim compressionrectangle As New System.Drawing.Rectangle(300, 10, bitmap.Width / 2, bitmap.Height / 2)
        'e.Graphics.DrawImage(bitmap, 10, 10)
        'e.Graphics.DrawImage(bitmap, expansionrectangle)
        'e.Graphics.DrawImage(bitmap, compressionrectangle)

        'Dim bitmap As New System.Drawing.Bitmap("untitleddf.bmp")
        'Dim sourcerectangle As New System.Drawing.Rectangle(150, 480, 140, 120)
        'Dim destrectangle1 As New System.Drawing.Rectangle(0, 0, 400, 400)
        'Dim destrectangle2 As New System.Drawing.Rectangle(200, 40, 200, 160)
        'e.Graphics.DrawImage(bitmap, 0, 0)
        'e.Graphics.DrawImage(bitmap, destrectangle1, sourcerectangle, GraphicsUnit.Pixel)
        'e.Graphics.DrawImage(bitmap, destrectangle2, sourcerectangle, GraphicsUnit.Pixel)

        'e.Graphics.TranslateTransform(100, 50)
        'e.Graphics.DrawLine(pen, 0, 0, 160, 80)

        'Dim matrix As New System.Drawing.Drawing2D.Matrix
        'matrix.Rotate(30)
        'matrix.Scale(1, 2, Drawing2D.MatrixOrder.Append)
        'matrix.Translate(5, 0, Drawing2D.MatrixOrder.Append)

        'e.Graphics.DrawEllipse(pen, 0, 0, 100, 50)
        'e.Graphics.ScaleTransform(1, 0.5F)
        'e.Graphics.TranslateTransform(50, 0, Drawing2D.MatrixOrder.Append)
        'e.Graphics.RotateTransform(30, Drawing2D.MatrixOrder.Append)
        'e.Graphics.DrawEllipse(pen, 0, 0, 100, 50)

        'e.Graphics.DrawLine(pen, 0, 0, 100, 100)

        'Dim bitmap As New System.Drawing.Bitmap("untitleddf.bmp")
        'e.Graphics.DrawLine(New System.Drawing.Pen(Color.FromArgb(255, 0, 0, 0), 25), New System.Drawing.Point(10, 35), New System.Drawing.Point(200, 35))
        'e.Graphics.DrawImage(bitmap, New System.Drawing.Rectangle(30, 0, bitmap.Width / 12, bitmap.Height / 12))

        'Dim bitmap As New System.Drawing.Bitmap("untitleddf.bmp")
        'Dim matrixsingle As System.Single()() = { _
        '                New Single() {1, 0, 0, 0, 0}, _
        '                New Single() {0, 1, 0, 0, 0}, _
        '                New Single() {0, 0, 1, 0, 0}, _
        '                New Single() {0, 0, 0, 0.7F, 0}, _
        '                New Single() {0, 0, 0, 0, 1}}
        'Dim colormatrix As New System.Drawing.Imaging.ColorMatrix(matrixsingle)
        'Dim imageattribute As New System.Drawing.Imaging.ImageAttributes
        'imageattribute.SetColorMatrix(colormatrix, Imaging.ColorMatrixFlag.Default, Imaging.ColorAdjustType.Bitmap)
        'e.Graphics.DrawLine(New System.Drawing.Pen(Color.Black, 25), New Point(10, 35), New Point(200, 35))
        'Dim nwidth As Integer = bitmap.Width
        'Dim nheight As Integer = bitmap.Height
        'Dim iwidth As Integer = nwidth * 20
        'Dim iheight As Integer = nheight * 20
        'e.Graphics.DrawImage(bitmap, New Rectangle(30, 0, nwidth, nheight), 0.0F, 0.0F, iwidth, iheight, GraphicsUnit.Pixel, imageattribute)

        'Dim lineargradientbrush As New System.Drawing.Drawing2D.LinearGradientBrush(New Point(0, 10), New Point(200, 10), Color.FromArgb(255, 255, 0, 0), Color.FromArgb(255, 0, 0, 255))
        'Dim pen1 As New System.Drawing.Pen(lineargradientbrush)
        'e.Graphics.DrawLine(pen1, 0, 10, 200, 10)
        'e.Graphics.FillEllipse(lineargradientbrush, 0, 30, 200, 100)
        'e.Graphics.FillRectangle(lineargradientbrush, 0, 155, 500, 30)

        'Dim lineargradientbrush As New System.Drawing.Drawing2D.LinearGradientBrush(New Point(0, 10), New Point(200, 10), Color.FromArgb(255, 255, 0, 0), Color.FromArgb(255, 0, 0, 255))
        'Dim relativeintensites As System.Single() = {0.0F, 0.5F, 1.0F}
        'Dim relativepositions As System.Single() = {0.0F, 0.2F, 1.0F}
        'Dim blend As New System.Drawing.Drawing2D.Blend
        'blend.Factors = relativeintensites
        'blend.Positions = relativepositions
        'lineargradientbrush.Blend = blend
        'e.Graphics.FillEllipse(lineargradientbrush, 0, 30, 200, 100)
        'e.Graphics.FillRectangle(lineargradientbrush, 0, 155, 500, 30)

        'Dim lineargradientbrush As New System.Drawing.Drawing2D.LinearGradientBrush(New Point(0, 0), New Point(200, 100), Color.FromArgb(255, 0, 0, 255), Color.FromArgb(255, 0, 255, 0))
        'Dim pen2 As New System.Drawing.Pen(lineargradientbrush, 10)
        'e.Graphics.DrawLine(pen2, 0, 0, 600, 300)
        'e.Graphics.FillEllipse(lineargradientbrush, 10, 100, 200, 100)

        'Dim path As New System.Drawing.Drawing2D.GraphicsPath
        'path.AddEllipse(0, 0, 140, 70)
        'Dim pathgradientbrush As New System.Drawing.Drawing2D.PathGradientBrush(path)
        'pathgradientbrush.CenterColor = Color.FromArgb(255, 0, 0, 255)
        'Dim colors As System.Drawing.Color() = {Color.FromArgb(255, 0, 255, 255)}
        'pathgradientbrush.SurroundColors = colors
        'e.Graphics.FillEllipse(pathgradientbrush, 0, 0, 140, 70)
        ''e.Graphics.FillEllipse(pathgradientbrush, 0, 0, 200, 40)

        'Dim points As System.Drawing.Point() = { _
        '                                        New Point(75, 0), _
        '                                        New Point(100, 50), _
        '                                        New Point(150, 50), _
        '                                        New Point(112, 75), _
        '                                        New Point(150, 150), _
        '                                        New Point(75, 100), _
        '                                        New Point(0, 150), _
        '                                        New Point(37, 75), _
        '                                        New Point(0, 50), _
        '                                        New Point(50, 50) _
        '                                       }
        'Dim path As New System.Drawing.Drawing2D.GraphicsPath
        'path.AddLines(points)
        'Dim pathgradientbrush As New System.Drawing.Drawing2D.PathGradientBrush(path)
        'pathgradientbrush.CenterColor = Color.FromArgb(255, 255, 0, 0)
        'Dim colors As System.Drawing.Color() = { _
        '                                          Color.FromArgb(255, 0, 0, 0), _
        '                                          Color.FromArgb(255, 0, 255, 0), _
        '                                          Color.FromArgb(255, 0, 0, 255), _
        '                                          Color.FromArgb(255, 255, 255, 255), _
        '                                          Color.FromArgb(255, 0, 0, 0), _
        '                                          Color.FromArgb(255, 0, 255, 0), _
        '                                          Color.FromArgb(255, 0, 0, 255), _
        '                                          Color.FromArgb(255, 255, 255, 255), _
        '                                          Color.FromArgb(255, 0, 0, 0), _
        '                                          Color.FromArgb(255, 0, 255, 0) _
        '                                        }
        'pathgradientbrush.SurroundColors = colors
        'e.Graphics.FillPath(pathgradientbrush, path)

        Dim pointf As System.Drawing.PointF() = { _
                                                 New PointF(0, 0), _
                                                 New PointF(160, 0), _
                                                 New PointF(160, 200), _
                                                 New PointF(80, 150), _
                                                 New PointF(0, 200) _
                                                }
        Dim pathgradientbrush As New System.Drawing.Drawing2D.PathGradientBrush(pointf)
        Dim colors As System.Drawing.Color() = { _
                                                Color.FromArgb(255, 255, 0, 0), _
                                                Color.FromArgb(255, 0, 255, 0), _
                                                Color.FromArgb(255, 0, 255, 0), _
                                                Color.FromArgb(255, 0, 0, 255), _
                                                Color.FromArgb(255, 255, 0, 0) _
                                               }
        pathgradientbrush.SurroundColors = colors
        pathgradientbrush.CenterColor = Color.White
        e.Graphics.FillRectangle(pathgradientbrush, New System.Drawing.Rectangle(0, 0, 160, 200))


        'Dim path As New System.Drawing.Drawing2D.GraphicsPath
        'path.AddEllipse(0, 230, 140, 70)
        'Dim pathGBrush As New System.Drawing.Drawing2D.PathGradientBrush(path)
        'pathGBrush.CenterPoint = New System.Drawing.PointF(120, 40)
        'pathGBrush.CenterColor = Color.FromArgb(255, 0, 0, 255)
        'Dim colors As System.Drawing.Color() = {Color.FromArgb(255, 0, 255, 255)}
        'pathGBrush.SurroundColors = colors
        'e.Graphics.FillEllipse(pathGBrush, 0, 230, 140, 70)
    End Sub

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值