vb.net涂鸦晋升


发现智能感应,的确是很大的一个进步。

另一个就是vb.net的概念或者说语句的命名,越来越“专业”了,接近了很多windows程序设计的概念。

vb.net的绘图知识点:

1、绘制各种图:
        system.drawing.graphics中有:
   
        drawline、drawellips、drawarc、drawbezier、drawrectangle、drawpolygon等

        主要技能用到pen(画线条),brush(填充),比如填充用到fillrectangle等


2、opacity透明度,好像只发现了窗体才有透明度,这个透明有点彻底,若为0,透明得基本上人眼无法看见。

      另一个就是,窗体透明后,其子体,如其上的控件button也将继承透明特征。


3、客户区。以前vb6客户区没有这个命名,net有了。
       一个窗体或控件的大小可以通过size来进行设置或读取了。客户区的大小一样clientsize.

     下面我们来一个button1在窗体form1客户区移动并不断反弹。

      把反弹运行分解为X轴和Y轴的运行。form1上添加timer1和button1

Public Class Form1
    Dim i As Integer = 0
    Dim xleft As Integer
    Dim j As Integer = 0
    Dim xtop As Integer
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        xleft = Button1.Left
        xtop = Button1.Top
    End Sub
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If i = 0 Then
            xleft += 3
            If xleft > Me.ClientSize.Width - Button1.Size.Width Then
                xleft = Me.ClientSize.Width - Button1.Size.Width
                i = 1
            End If
        Else
            xleft -= 3
            If xleft < 0 Then
                xleft = 0
                i = 0
            End If
        End If
        If j = 0 Then
            xtop += 2
            If xtop > Me.ClientSize.Height - Button1.Size.Height Then
                xtop = Me.ClientSize.Height - Button1.Size.Height
                j = 1
            End If
        Else
            xtop -= 2
            If xtop < 0 Then
                xtop = 0
                j = 0
            End If
        End If
        Button1.Left = xleft
        Button1.Top = xtop
    End Sub
End Class


4、图形没有构造函数,导致不能用new,只能用creategraphics来创建

    dim gra   as graphics
    gra=me.createGraphics   '如果在button1上即: gra=button1.creategraphics
    dim pen1  as New pen(color.Red)
    gra.drawEllipse(pen1,10,120,200,160)

     为什么ghraphics不能用构造函数呢?难道是不能确定“宿主”,加在参数里不就行了? 一个大大的问号在我心中。。。



  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值