Vb. NET to implement the Flow selection box for Photoshop

Source: Internet
Author: User
Hello, everyone. I published the first article (excited), saw the development of a few consecutive talk about the flow of Photoshop in the selection box article, in fact, the implementation is not difficult, here I use vb.net implementation, in. NET provides a very powerful GDI +, the previous C # is also GDI +, I use it here too! In fact, no difference! Hope to learn vb.net people have help, the following is the source code:

Create a new VB application, a window to add a time (Timer) component, interval set to 50 subtle,

Imports System.Drawing.Drawing2D
Imports System.Drawing.Graphics
Public Class Form1
Inherits System.Windows.Forms.Form
Private pen as Pen ' Create a Brush object
Private Gpath as New GraphicsPath ' instantiate the Path object
Private Dpattern () as Single = {5.0, 7.0} ' solid line length and dash length
Private Offset as single = 0.0 ' offset value

#Region "code generated by the Windows forms Designer"

Public Sub New ()
MyBase.New ()

' This call is required by the Windows Forms Designer.
InitializeComponent ()

' Add any initialization after the InitializeComponent () call

End Sub

' Form overrides dispose to clean up the list of components.
Protected Overloads Overrides Sub Dispose (ByVal disposing as Boolean)
If disposing Then
If not (components are nothing) Then
Components. Dispose ()
End If
Gpath.dispose ()
Pen. Dispose ()
End If
Mybase.dispose (disposing)
End Sub

' Required by the Windows Forms Designer
Private Components as System.ComponentModel.IContainer

' NOTE: The following procedure is required by the Windows Forms Designer
' You can use the Windows Forms Designer to modify this procedure.
' Do not modify it using the Code Editor.
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 () ' Refresh window
End Sub

Private Sub Form1_paint (ByVal sender as Object, ByVal e as System.Windows.Forms.PaintEventArgs) Handles Mybase.paint
Pen. Dashoffset = Offset ' Sets the offsetting value
E.graphics.drawpath (pen, Gpath) ' Draw path

' Change the amount of the offset value
Offset + + 1.0
If offset/100 = 1 Then
offset = 0.0
End If

End Sub


Private Sub Form1_Load (ByVal sender as Object, ByVal e as System.EventArgs) Handles MyBase.Load
Gpath.addstring ("Computer", _
New FontFamily ("Young Circle"), _
FontStyle.Bold + Fontstyle.italic, _
120.0F, _
New PointF (30.0F, 20.0F), _
New stringformat) ' Add a character path
Pen = New Pen (color.black) ' Construction brush
Pen. DashPattern = Dpattern ' custom dash and blank area
Pen. DashStyle = DashStyle.Custom ' DashStyle.Custom value for this property specifies: a custom pattern of dashes and empty areas defined by the DashPattern property
End Sub
End Class
Compiled in winxp+sp1+vs.net2003 through

If there's something wrong, please advise.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.