大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
可以使用onpaint事件进行重绘使combobox的是边框四个直角变成弧形。这里需要用到gdi+绘制的知识和onpait事件。窗体和combobox设置自动重绘为true即可。你可以参考下gdi的圆角绘制的知识的。这里很容易做到的。希望能帮到你。有疑问继续提问哈。
成都创新互联公司专业为企业提供安乡网站建设、安乡做网站、安乡网站设计、安乡网站制作等企业网站建设、网页设计与制作、安乡企业网站模板建站服务,10年安乡做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。
拖一个PictureBox1控件 创建一个Paint事件。在事件中加入 Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint ' Create pens. Dim redPen As New Pen(Color.Red, 3) Dim greenPen As New Pen(Color.Green, 3) ' Create points that define curve. Dim point1 As New Point(50, 50) Dim point2 As New Point(100, 25) Dim point3 As New Point(200, 5) Dim point4 As New Point(250, 50) Dim point5 As New Point(300, 100) Dim point6 As New Point(350, 200) Dim point7 As New Point(250, 250) Dim curvePoints As Point() = {point1, point2, point3, point4, _ point5, point6, point7} ' Draw lines between original points to screen. e.Graphics.DrawLines(redPen, curvePoints) ' Draw curve to screen. e.Graphics.DrawCurve(greenPen, curvePoints) End Sub 得到数据后,改point的数据。然后PictureBox1.Refresh()就行了
粘贴如下代码在你的窗体某个事件中,比如Button1_Clicked
VB.NET code
Dim g as Graphics = me.CreateGraphics g.DrawLine(Pens.Blue,20 ,30;,40 ,32) g.Dispose()
。net 其实还是很好绘制图形的
你可以看下 Graphics 类
Dim d As New Bitmap(Me.Width, Me.Height) ‘一个图片吧
Dim g As Graphics = Graphics.FromImage(d)’绘制 准备在这个图片是进行
然后 就是你绘制的东西了
线 就是 g.DrawLine()
圆 弧度 就用 g.DrawArc(Pens.Black, New Rectangle(0, 0, 400, 200), 0, 360)
复杂的就是 g.DrawBezier()
等 如果你用的是 VS的 编译 上面都有详细的参数说明
Dim d As New Bitmap(Me.Width, Me.Height)
Dim g As Graphics = Graphics.FromImage(d)
g.DrawArc(Pens.Black, New Rectangle(0, 0, 200, 200), 0, 360)
g.DrawLine(Pens.Red, New Point(0, 0), New Point(200, 200))
g.DrawLines(Pens.Green, New Point() {New Point(0, 0), New Point(50, 40), New Point(50, 80), New Point(90, 70), New Point(100, 400)})
g.DrawBezier(Pens.Yellow, New Point(0, 100), New Point(0, 0), New Point(200, 0), New Point(200, 200))
g.Dispose()
Me.BackgroundImage = d
Private Sub PictureBox2_Paint(sender As Object, e As PaintEventArgs) Handles PictureBox2.Paint
Dim points As New List(Of Point)
points.Add(New Point(0, 0))
points.Add(New Point(1, 10))
points.Add(New Point(3, 15))
points.Add(New Point(14, 0))
points.Add(New Point(20, 60))
points.Add(New Point(40, 20))
points.Add(New Point(70, 50))
e.Graphics.DrawCurve(Pens.Red, points.ToArray)
End Sub
供参考,points可设为全局变量,那样add随便在哪增加,想要看见看上去动态的图,那就在新增完n个后,继续增加n+1个之时,放弃points中的第一个。
代码写起来可能比较麻烦,给你个思路,就是用GraphicsPath来绘制,然后通过绘制目标的鼠标移动事件来获取当前鼠标在绘制目标中的实际位置,再通过GraphicsPath的IsVisible()方法来确认鼠标是否包含在GraphicsPath中。
DrawLine直线比较容易处理,只要得到Line的坐标点,然后比较当前鼠标坐标就好。