Click here to Skip to main content
15,884,298 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 379.3K   21.6K   301  
Implementing shape control that supports transparency, custom design-time editors and simple animation
Public Partial Class Form2
	''' <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.checkBox1 = New System.Windows.Forms.CheckBox
        Me.checkBox2 = New System.Windows.Forms.CheckBox
        Me.checkBox3 = New System.Windows.Forms.CheckBox
        Me.checkBox4 = New System.Windows.Forms.CheckBox
        Me.label1 = New System.Windows.Forms.Label
        Me.label2 = New System.Windows.Forms.Label
        Me.checkBox5 = New System.Windows.Forms.CheckBox
        Me.checkBox6 = New System.Windows.Forms.CheckBox
        Me.checkBox7 = New System.Windows.Forms.CheckBox
        Me.checkBox8 = New System.Windows.Forms.CheckBox
        Me.panel1 = New System.Windows.Forms.Panel
        Me.customControl14 = New ShapeControl.CustomControl1
        Me.customControl13 = New ShapeControl.CustomControl1
        Me.customControl12 = New ShapeControl.CustomControl1
        Me.customControl11 = New ShapeControl.CustomControl1
        Me.label3 = New System.Windows.Forms.Label
        Me.checkBox9 = New System.Windows.Forms.CheckBox
        Me.checkBox10 = New System.Windows.Forms.CheckBox
        Me.checkBox11 = New System.Windows.Forms.CheckBox
        Me.checkBox12 = New System.Windows.Forms.CheckBox
        Me.panel1.SuspendLayout()
        Me.SuspendLayout()
        '
        'checkBox1
        '
        Me.checkBox1.AutoSize = True
        Me.checkBox1.Location = New System.Drawing.Point(100, 521)
        Me.checkBox1.Name = "checkBox1"
        Me.checkBox1.Size = New System.Drawing.Size(52, 17)
        Me.checkBox1.TabIndex = 1
        Me.checkBox1.Tag = "1"
        Me.checkBox1.Text = "cam1"
        Me.checkBox1.UseVisualStyleBackColor = True
        '
        'checkBox2
        '
        Me.checkBox2.AutoSize = True
        Me.checkBox2.Location = New System.Drawing.Point(170, 521)
        Me.checkBox2.Name = "checkBox2"
        Me.checkBox2.Size = New System.Drawing.Size(52, 17)
        Me.checkBox2.TabIndex = 2
        Me.checkBox2.Tag = "2"
        Me.checkBox2.Text = "cam2"
        Me.checkBox2.UseVisualStyleBackColor = True
        '
        'checkBox3
        '
        Me.checkBox3.AutoSize = True
        Me.checkBox3.Location = New System.Drawing.Point(100, 544)
        Me.checkBox3.Name = "checkBox3"
        Me.checkBox3.Size = New System.Drawing.Size(52, 17)
        Me.checkBox3.TabIndex = 3
        Me.checkBox3.Tag = "3"
        Me.checkBox3.Text = "cam3"
        Me.checkBox3.UseVisualStyleBackColor = True
        '
        'checkBox4
        '
        Me.checkBox4.AutoSize = True
        Me.checkBox4.Location = New System.Drawing.Point(170, 544)
        Me.checkBox4.Name = "checkBox4"
        Me.checkBox4.Size = New System.Drawing.Size(52, 17)
        Me.checkBox4.TabIndex = 4
        Me.checkBox4.Tag = "4"
        Me.checkBox4.Text = "cam4"
        Me.checkBox4.UseVisualStyleBackColor = True
        '
        'label1
        '
        Me.label1.AutoSize = True
        Me.label1.Location = New System.Drawing.Point(18, 521)
        Me.label1.Name = "label1"
        Me.label1.Size = New System.Drawing.Size(75, 13)
        Me.label1.TabIndex = 5
        Me.label1.Text = "Check to blink"
        '
        'label2
        '
        Me.label2.AutoSize = True
        Me.label2.Location = New System.Drawing.Point(242, 521)
        Me.label2.Name = "label2"
        Me.label2.Size = New System.Drawing.Size(85, 13)
        Me.label2.TabIndex = 10
        Me.label2.Text = "Check to vibrate"
        '
        'checkBox5
        '
        Me.checkBox5.AutoSize = True
        Me.checkBox5.Location = New System.Drawing.Point(400, 544)
        Me.checkBox5.Name = "checkBox5"
        Me.checkBox5.Size = New System.Drawing.Size(52, 17)
        Me.checkBox5.TabIndex = 9
        Me.checkBox5.Tag = "4"
        Me.checkBox5.Text = "cam4"
        Me.checkBox5.UseVisualStyleBackColor = True
        '
        'checkBox6
        '
        Me.checkBox6.AutoSize = True
        Me.checkBox6.Location = New System.Drawing.Point(330, 544)
        Me.checkBox6.Name = "checkBox6"
        Me.checkBox6.Size = New System.Drawing.Size(52, 17)
        Me.checkBox6.TabIndex = 8
        Me.checkBox6.Tag = "3"
        Me.checkBox6.Text = "cam3"
        Me.checkBox6.UseVisualStyleBackColor = True
        '
        'checkBox7
        '
        Me.checkBox7.AutoSize = True
        Me.checkBox7.Location = New System.Drawing.Point(400, 521)
        Me.checkBox7.Name = "checkBox7"
        Me.checkBox7.Size = New System.Drawing.Size(52, 17)
        Me.checkBox7.TabIndex = 7
        Me.checkBox7.Tag = "2"
        Me.checkBox7.Text = "cam2"
        Me.checkBox7.UseVisualStyleBackColor = True
        '
        'checkBox8
        '
        Me.checkBox8.AutoSize = True
        Me.checkBox8.Location = New System.Drawing.Point(330, 521)
        Me.checkBox8.Name = "checkBox8"
        Me.checkBox8.Size = New System.Drawing.Size(52, 17)
        Me.checkBox8.TabIndex = 6
        Me.checkBox8.Tag = "1"
        Me.checkBox8.Text = "cam1"
        Me.checkBox8.UseVisualStyleBackColor = True
        '
        'panel1
        '
        Me.panel1.BackgroundImage = Global.TestShapeControl.My.Resources.SITRedhillClose3room63sqm
        Me.panel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom
        Me.panel1.Controls.Add(Me.customControl14)
        Me.panel1.Controls.Add(Me.customControl13)
        Me.panel1.Controls.Add(Me.customControl12)
        Me.panel1.Controls.Add(Me.customControl11)
        Me.panel1.Location = New System.Drawing.Point(12, 12)
        Me.panel1.Name = "panel1"
        Me.panel1.Size = New System.Drawing.Size(707, 497)
        Me.panel1.TabIndex = 0
        '
        'customControl14
        '
        Me.customControl14.AnimateBorder = False
        Me.customControl14.BackColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer))
        Me.customControl14.Blink = False
        Me.customControl14.BorderColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer))
        Me.customControl14.BorderStyle = System.Drawing.Drawing2D.DashStyle.Solid
        Me.customControl14.BorderWidth = 2
        Me.customControl14.CenterColor = System.Drawing.Color.FromArgb(CType(CType(100, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer))
        Me.customControl14.Connector = ShapeControl.ConnecterType.Center
        Me.customControl14.Direction = ShapeControl.LineDirection.None
        Me.customControl14.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.customControl14.ForeColor = System.Drawing.SystemColors.ControlText
        Me.customControl14.Location = New System.Drawing.Point(526, 404)
        Me.customControl14.Name = "customControl14"
        Me.customControl14.Shape = ShapeControl.ShapeType.Ellipse
        Me.customControl14.ShapeImage = Nothing
        Me.customControl14.Size = New System.Drawing.Size(33, 32)
        Me.customControl14.SurroundColor = System.Drawing.Color.FromArgb(CType(CType(100, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer))
        Me.customControl14.TabIndex = 3
        Me.customControl14.Tag2 = ""
        Me.customControl14.Text = "cam4"
        Me.customControl14.UseGradient = False
        Me.customControl14.Vibrate = False
        '
        'customControl13
        '
        Me.customControl13.AnimateBorder = False
        Me.customControl13.BackColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(255, Byte), Integer))
        Me.customControl13.Blink = False
        Me.customControl13.BorderColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(0, Byte), Integer))
        Me.customControl13.BorderStyle = System.Drawing.Drawing2D.DashStyle.Solid
        Me.customControl13.BorderWidth = 2
        Me.customControl13.CenterColor = System.Drawing.Color.FromArgb(CType(CType(100, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer))
        Me.customControl13.Connector = ShapeControl.ConnecterType.Center
        Me.customControl13.Direction = ShapeControl.LineDirection.None
        Me.customControl13.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.customControl13.ForeColor = System.Drawing.Color.Yellow
        Me.customControl13.Location = New System.Drawing.Point(329, 404)
        Me.customControl13.Name = "customControl13"
        Me.customControl13.Shape = ShapeControl.ShapeType.Ellipse
        Me.customControl13.ShapeImage = Global.TestShapeControl.My.Resources.Eye
        Me.customControl13.Size = New System.Drawing.Size(52, 51)
        Me.customControl13.SurroundColor = System.Drawing.Color.FromArgb(CType(CType(100, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer))
        Me.customControl13.TabIndex = 2
        Me.customControl13.Tag2 = ""
        Me.customControl13.Text = "cam3"
        Me.customControl13.UseGradient = False
        Me.customControl13.Vibrate = False
        '
        'customControl12
        '
        Me.customControl12.AnimateBorder = False
        Me.customControl12.BackColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(0, Byte), Integer))
        Me.customControl12.Blink = False
        Me.customControl12.BorderColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(255, Byte), Integer))
        Me.customControl12.BorderStyle = System.Drawing.Drawing2D.DashStyle.Solid
        Me.customControl12.BorderWidth = 2
        Me.customControl12.CenterColor = System.Drawing.Color.FromArgb(CType(CType(100, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer))
        Me.customControl12.Connector = ShapeControl.ConnecterType.Center
        Me.customControl12.Direction = ShapeControl.LineDirection.None
        Me.customControl12.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.customControl12.ForeColor = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer))
        Me.customControl12.Location = New System.Drawing.Point(517, 205)
        Me.customControl12.Name = "customControl12"
        Me.customControl12.Shape = ShapeControl.ShapeType.Ellipse
        Me.customControl12.ShapeImage = Global.TestShapeControl.My.Resources.camshape
        Me.customControl12.Size = New System.Drawing.Size(42, 39)
        Me.customControl12.SurroundColor = System.Drawing.Color.FromArgb(CType(CType(100, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer))
        Me.customControl12.TabIndex = 2
        Me.customControl12.Tag2 = ""
        Me.customControl12.Text = "cam2"
        Me.customControl12.UseGradient = False
        Me.customControl12.Vibrate = False
        '
        'customControl11
        '
        Me.customControl11.AnimateBorder = False
        Me.customControl11.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer))
        Me.customControl11.Blink = False
        Me.customControl11.BorderColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer))
        Me.customControl11.BorderStyle = System.Drawing.Drawing2D.DashStyle.Solid
        Me.customControl11.BorderWidth = 2
        Me.customControl11.CenterColor = System.Drawing.Color.FromArgb(CType(CType(100, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer))
        Me.customControl11.Connector = ShapeControl.ConnecterType.Center
        Me.customControl11.Direction = ShapeControl.LineDirection.None
        Me.customControl11.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.customControl11.ForeColor = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer))
        Me.customControl11.Location = New System.Drawing.Point(277, 219)
        Me.customControl11.Name = "customControl11"
        Me.customControl11.Shape = ShapeControl.ShapeType.Ellipse
        Me.customControl11.ShapeImage = Global.TestShapeControl.My.Resources.Security_Camera_1
        Me.customControl11.Size = New System.Drawing.Size(65, 44)
        Me.customControl11.SurroundColor = System.Drawing.Color.FromArgb(CType(CType(100, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer))
        Me.customControl11.TabIndex = 0
        Me.customControl11.Tag2 = ""
        Me.customControl11.Text = " cam1"
        Me.customControl11.UseGradient = False
        Me.customControl11.Vibrate = False
        '
        'label3
        '
        Me.label3.AutoSize = True
        Me.label3.Location = New System.Drawing.Point(486, 521)
        Me.label3.MaximumSize = New System.Drawing.Size(90, 40)
        Me.label3.Name = "label3"
        Me.label3.Size = New System.Drawing.Size(90, 26)
        Me.label3.TabIndex = 15
        Me.label3.Text = "Check to animate border"
        '
        'checkBox9
        '
        Me.checkBox9.AutoSize = True
        Me.checkBox9.Location = New System.Drawing.Point(664, 544)
        Me.checkBox9.Name = "checkBox9"
        Me.checkBox9.Size = New System.Drawing.Size(52, 17)
        Me.checkBox9.TabIndex = 14
        Me.checkBox9.Tag = "4"
        Me.checkBox9.Text = "cam4"
        Me.checkBox9.UseVisualStyleBackColor = True
        '
        'checkBox10
        '
        Me.checkBox10.AutoSize = True
        Me.checkBox10.Location = New System.Drawing.Point(594, 544)
        Me.checkBox10.Name = "checkBox10"
        Me.checkBox10.Size = New System.Drawing.Size(52, 17)
        Me.checkBox10.TabIndex = 13
        Me.checkBox10.Tag = "3"
        Me.checkBox10.Text = "cam3"
        Me.checkBox10.UseVisualStyleBackColor = True
        '
        'checkBox11
        '
        Me.checkBox11.AutoSize = True
        Me.checkBox11.Location = New System.Drawing.Point(664, 521)
        Me.checkBox11.Name = "checkBox11"
        Me.checkBox11.Size = New System.Drawing.Size(52, 17)
        Me.checkBox11.TabIndex = 12
        Me.checkBox11.Tag = "2"
        Me.checkBox11.Text = "cam2"
        Me.checkBox11.UseVisualStyleBackColor = True
        '
        'checkBox12
        '
        Me.checkBox12.AutoSize = True
        Me.checkBox12.Location = New System.Drawing.Point(594, 521)
        Me.checkBox12.Name = "checkBox12"
        Me.checkBox12.Size = New System.Drawing.Size(52, 17)
        Me.checkBox12.TabIndex = 11
        Me.checkBox12.Tag = "1"
        Me.checkBox12.Text = "cam1"
        Me.checkBox12.UseVisualStyleBackColor = True
        '
        'Form2
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom
        Me.ClientSize = New System.Drawing.Size(742, 578)
        Me.Controls.Add(Me.label3)
        Me.Controls.Add(Me.checkBox9)
        Me.Controls.Add(Me.checkBox10)
        Me.Controls.Add(Me.checkBox11)
        Me.Controls.Add(Me.checkBox12)
        Me.Controls.Add(Me.label2)
        Me.Controls.Add(Me.checkBox5)
        Me.Controls.Add(Me.checkBox6)
        Me.Controls.Add(Me.checkBox7)
        Me.Controls.Add(Me.checkBox8)
        Me.Controls.Add(Me.label1)
        Me.Controls.Add(Me.checkBox4)
        Me.Controls.Add(Me.checkBox3)
        Me.Controls.Add(Me.checkBox2)
        Me.Controls.Add(Me.checkBox1)
        Me.Controls.Add(Me.panel1)
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "Form2"
        Me.Text = "Test Blinking and Vibrating"
        Me.panel1.ResumeLayout(False)
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

	#End Region

	Private panel1 As System.Windows.Forms.Panel
	Private customControl12 As ShapeControl.CustomControl1
	Private customControl11 As ShapeControl.CustomControl1
	Private customControl13 As ShapeControl.CustomControl1
	Private customControl14 As ShapeControl.CustomControl1
    Private WithEvents checkBox1 As System.Windows.Forms.CheckBox
    Private WithEvents checkBox2 As System.Windows.Forms.CheckBox
    Private WithEvents checkBox3 As System.Windows.Forms.CheckBox
    Private WithEvents checkBox4 As System.Windows.Forms.CheckBox
	Private label1 As System.Windows.Forms.Label
	Private label2 As System.Windows.Forms.Label
    Private WithEvents checkBox5 As System.Windows.Forms.CheckBox
    Private WithEvents checkBox6 As System.Windows.Forms.CheckBox
    Private WithEvents checkBox7 As System.Windows.Forms.CheckBox
    Private WithEvents checkBox8 As System.Windows.Forms.CheckBox
	Private label3 As System.Windows.Forms.Label
    Private WithEvents checkBox9 As System.Windows.Forms.CheckBox
    Private WithEvents checkBox10 As System.Windows.Forms.CheckBox
    Private WithEvents checkBox11 As System.Windows.Forms.CheckBox
    Private WithEvents checkBox12 As System.Windows.Forms.CheckBox
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