vb.net涂鸦晋升
来源:互联网 发布:手机淘宝私人定制推送 编辑:程序博客网 时间:2024/05/01 13:36
发现智能感应,的确是很大的一个进步。
另一个就是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 SubEnd 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不能用构造函数呢?难道是不能确定“宿主”,加在参数里不就行了? 一个大大的问号在我心中。。。
- vb.net涂鸦晋升
- 涂鸦
- 涂鸦
- 涂鸦
- 涂鸦
- 涂鸦
- "涂鸦"
- 涂鸦
- 涂鸦
- 涂鸦
- 涂鸦~~~~~
- 涂鸦
- 涂鸦
- 涂鸦
- 涂鸦
- 涂鸦
- 涂鸦
- [VB.NET]VB REDIM
- LightOJ 1035 Intelligent Factorial Factorization
- POJ2438-求解哈密顿回路
- linq 笔记2 多表查询
- 设计模式之模板方法模式
- 规范工程中c/c++变量类型的定义
- vb.net涂鸦晋升
- 索引、视图、游标、存储过程和触发器理解总结
- 有关tcp wrapper
- poj 3264 Balanced Lineup ST
- 算法导论第十五章习题15.1-1c++代码实现
- linux 下有用的命令
- android json解析及简单例子
- AJAX加载后js失效问题及ASP.NET中UpdatePanel内控件的JS失效的问题
- 守护你的数据——SQL Server角色与权限