1回顶部 看了开发高手连续几篇谈到PhotoShop中流动选取框的文章,其实实现并不难,在这里我就用VB.NET实现,在.NET中提供了功能十分强大的GDI+,前篇C#用的也是GDI+,我这里也用上!其实没有什么区别。希望对学VB.NET的人有帮助,下面是源码: 创建一个新的VB应用程序,一个窗口中添加一个时间(Timer)组件,Interval设置为50微妙, 2回顶部 'Windows 窗体设计器所必需的 Private components As System.ComponentModel.IContainer '注意: 以下过程是 Windows 窗体设计器所必需的 '可以使用 Windows 窗体设计器修改此过程。 '不要使用代码编辑器修改它。 Friend WithEvents Timer1 As System.Windows.Forms.Timer <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container Me.Timer1 = New System.Windows.Forms.Timer(Me.components) ' 'Timer1 ' Me.Timer1.Enabled = True Me.Timer1.Interval = 50 ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14) Me.ClientSize = New System.Drawing.Size(416, 166) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle Me.MaximizeBox = False Me.MinimizeBox = False Me.Name = "Form1" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "Photo For VB.NET" End Sub #End Region Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Me.Refresh() '刷新窗口 End Sub Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint pen.DashOffset = offset '设置偏移值 e.Graphics.DrawPath(pen, GPath) '画路径 '改变偏移值的量 offset += 1.0 If offset / 100 = 1 Then offset = 0.0 End If End Sub 3回顶部 Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load GPath.AddString("电脑", _ New FontFamily("幼圆"), _ FontStyle.Bold + FontStyle.Italic, _ 120.0F, _ New PointF(30.0F, 20.0F), _ New StringFormat) '添加一个字符路径 pen = New Pen(Color.Black) '构造画笔 pen.DashPattern = Dpattern '自定义的短划线和空白区域 pen.DashStyle = DashStyle.Custom '此属性的 DashStyle.Custom 值指定:由 DashPattern 属性定义的短划线和空白区域的自定义图案 End Sub End Class 在WINXP+SP1+VS.NET2003编译通过 |
正在阅读:VB.NET实现PhotoShop的流动选取框VB.NET实现PhotoShop的流动选取框
2004-04-08 10:11
出处:CSDN
责任编辑:sdq