Click here to Skip to main content
15,893,486 members
Articles / Desktop Programming / Windows Forms

Shape Control for .NET

Rate me:
Please Sign up or sign in to vote.
4.84/5 (170 votes)
23 Mar 2017CPOL10 min read 381.1K   21.7K   301  
Implementing shape control that supports transparency, custom design-time editors and simple animation
Partial Class Form3
	''' <summary>
	''' Required designer variable.
	''' </summary>
	Private components As System.ComponentModel.IContainer = Nothing

	''' <summary>
	''' Clean up any resources being used.
	''' </summary>
	''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
	Protected Overrides Sub Dispose(disposing As Boolean)
		If disposing AndAlso (components IsNot Nothing) Then
			components.Dispose()
		End If
		MyBase.Dispose(disposing)
	End Sub

	#Region "Windows Form Designer generated code"

	''' <summary>
	''' Required method for Designer support - do not modify
	''' the contents of this method with the code editor.
	''' </summary>
	Private Sub InitializeComponent()
		Me.components = New System.ComponentModel.Container()
		Me.panel1 = New System.Windows.Forms.Panel()
		Me.btnImportMap = New System.Windows.Forms.Button()
		Me.btnAddCam = New System.Windows.Forms.Button()
		Me.openFileDialog1 = New System.Windows.Forms.OpenFileDialog()
		Me.button1 = New System.Windows.Forms.Button()
		Me.button2 = New System.Windows.Forms.Button()
		Me.label1 = New System.Windows.Forms.Label()
		Me.label2 = New System.Windows.Forms.Label()
		Me.label3 = New System.Windows.Forms.Label()
		Me.toolTip1 = New System.Windows.Forms.ToolTip(Me.components)
		Me.SuspendLayout()
		' 
		' panel1
		' 
		Me.panel1.AllowDrop = True
		Me.panel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom
		Me.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
		Me.panel1.Location = New System.Drawing.Point(24, 90)
		Me.panel1.Name = "panel1"
		Me.panel1.Size = New System.Drawing.Size(652, 448)
		Me.panel1.TabIndex = 0
		AddHandler Me.panel1.MouseDoubleClick, New System.Windows.Forms.MouseEventHandler(AddressOf Me.panel1_MouseDoubleClick)
		AddHandler Me.panel1.MouseEnter, New System.EventHandler(AddressOf Me.panel1_MouseEnter)
		' 
		' btnImportMap
		' 
		Me.btnImportMap.Location = New System.Drawing.Point(24, 12)
		Me.btnImportMap.Name = "btnImportMap"
		Me.btnImportMap.Size = New System.Drawing.Size(57, 27)
		Me.btnImportMap.TabIndex = 1
		Me.btnImportMap.Text = "Load"
		Me.btnImportMap.UseVisualStyleBackColor = True
		AddHandler Me.btnImportMap.Click, New System.EventHandler(AddressOf Me.btnImportMap_Click)
		' 
		' btnAddCam
		' 
		Me.btnAddCam.Location = New System.Drawing.Point(107, 12)
		Me.btnAddCam.Name = "btnAddCam"
		Me.btnAddCam.Size = New System.Drawing.Size(61, 26)
		Me.btnAddCam.TabIndex = 2
		Me.btnAddCam.Text = "Add Cam"
		Me.btnAddCam.UseVisualStyleBackColor = True
		AddHandler Me.btnAddCam.Click, New System.EventHandler(AddressOf Me.btnAddCam_Click)
		' 
		' openFileDialog1
		' 
		Me.openFileDialog1.FileName = "openFileDialog1"
		' 
		' button1
		' 
		Me.button1.Location = New System.Drawing.Point(620, 12)
		Me.button1.Name = "button1"
		Me.button1.Size = New System.Drawing.Size(56, 27)
		Me.button1.TabIndex = 3
		Me.button1.Text = "Save"
		Me.button1.UseVisualStyleBackColor = True
		AddHandler Me.button1.Click, New System.EventHandler(AddressOf Me.button1_Click)
		' 
		' button2
		' 
		Me.button2.Location = New System.Drawing.Point(562, 12)
		Me.button2.Name = "button2"
		Me.button2.Size = New System.Drawing.Size(52, 27)
		Me.button2.TabIndex = 4
		Me.button2.Text = "New"
		Me.button2.UseVisualStyleBackColor = True
		AddHandler Me.button2.Click, New System.EventHandler(AddressOf Me.button2_Click)
		' 
		' label1
		' 
		Me.label1.AutoSize = True
		Me.label1.Location = New System.Drawing.Point(87, 51)
		Me.label1.MaximumSize = New System.Drawing.Size(550, 30)
		Me.label1.Name = "label1"
		Me.label1.Size = New System.Drawing.Size(35, 13)
		Me.label1.TabIndex = 5
		Me.label1.Text = "label1"
		' 
		' label2
		' 
		Me.label2.AutoSize = True
		Me.label2.Location = New System.Drawing.Point(24, 542)
		Me.label2.MaximumSize = New System.Drawing.Size(600, 40)
		Me.label2.Name = "label2"
		Me.label2.Size = New System.Drawing.Size(35, 13)
		Me.label2.TabIndex = 6
		Me.label2.Text = "label2"
		' 
		' label3
		' 
		Me.label3.AutoSize = True
		Me.label3.Location = New System.Drawing.Point(24, 51)
		Me.label3.Name = "label3"
		Me.label3.Size = New System.Drawing.Size(57, 13)
		Me.label3.TabIndex = 7
		Me.label3.Text = "File Name:"
		' 
		' Form3
		' 
		Me.AutoScaleDimensions = New System.Drawing.SizeF(6F, 13F)
		Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
		Me.ClientSize = New System.Drawing.Size(705, 587)
		Me.Controls.Add(Me.label3)
		Me.Controls.Add(Me.label2)
		Me.Controls.Add(Me.label1)
		Me.Controls.Add(Me.button2)
		Me.Controls.Add(Me.button1)
		Me.Controls.Add(Me.btnAddCam)
		Me.Controls.Add(Me.btnImportMap)
		Me.Controls.Add(Me.panel1)
		Me.KeyPreview = True
		Me.MinimumSize = New System.Drawing.Size(640, 480)
		Me.Name = "Form3"
		Me.Text = "Cam Map Designer"
		AddHandler Me.Load, New System.EventHandler(AddressOf Me.Form3_Load)
		AddHandler Me.KeyUp, New System.Windows.Forms.KeyEventHandler(AddressOf Me.Form3_KeyUp)
		AddHandler Me.Resize, New System.EventHandler(AddressOf Me.Form3_Resize)
		AddHandler Me.KeyDown, New System.Windows.Forms.KeyEventHandler(AddressOf Me.Form3_KeyDown)
		Me.ResumeLayout(False)
		Me.PerformLayout()

	End Sub

	#End Region

	Private panel1 As System.Windows.Forms.Panel
	Private btnImportMap As System.Windows.Forms.Button
	Private btnAddCam As System.Windows.Forms.Button
	Private openFileDialog1 As System.Windows.Forms.OpenFileDialog
	Private button1 As System.Windows.Forms.Button
	Private button2 As System.Windows.Forms.Button
	Private label1 As System.Windows.Forms.Label
	Private label2 As System.Windows.Forms.Label
	Private label3 As System.Windows.Forms.Label
	Private toolTip1 As System.Windows.Forms.ToolTip

End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Singapore Singapore
Coder. Hacker. Fixer.

Comments and Discussions