Click here to Skip to main content
15,881,812 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.1K   21.6K   301  
Implementing shape control that supports transparency, custom design-time editors and simple animation
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms

Public Partial Class Form2
	Inherits Form
	Public Sub New()
		InitializeComponent()
	End Sub


    Private Sub checkBoxA_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles checkBox9.CheckedChanged, checkBox12.CheckedChanged, checkBox11.CheckedChanged, checkBox10.CheckedChanged
        Dim tag As String = DirectCast(sender, Control).Tag.ToString()
        Dim ctrls As Control() = Me.panel1.Controls.Find("customControl1" & tag, False)
        If ctrls.Length > 0 Then
            Dim cam As ShapeControl.CustomControl1 = DirectCast(ctrls(0), ShapeControl.CustomControl1)
            cam.AnimateBorder = DirectCast(sender, CheckBox).Checked
        End If


    End Sub


    Private Sub checkBoxB_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles checkBox4.CheckedChanged, checkBox3.CheckedChanged, checkBox2.CheckedChanged, checkBox1.CheckedChanged
        Dim tag As String = DirectCast(sender, Control).Tag.ToString()
        Dim ctrls As Control() = Me.panel1.Controls.Find("customControl1" & tag, False)
        If ctrls.Length > 0 Then
            Dim cam As ShapeControl.CustomControl1 = DirectCast(ctrls(0), ShapeControl.CustomControl1)
            cam.Blink = DirectCast(sender, CheckBox).Checked
        End If


    End Sub

    Private Sub checkBoxV_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles checkBox8.CheckedChanged, checkBox7.CheckedChanged, checkBox6.CheckedChanged, checkBox5.CheckedChanged
        Dim tag As String = DirectCast(sender, Control).Tag.ToString()
        Dim ctrls As Control() = Me.panel1.Controls.Find("customControl1" & tag, False)
        If ctrls.Length > 0 Then
            Dim cam As ShapeControl.CustomControl1 = DirectCast(ctrls(0), ShapeControl.CustomControl1)
            cam.Vibrate = DirectCast(sender, CheckBox).Checked
        End If
    End Sub
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