Name = frmMain, Text = Opacity & Circular
Name = lbMessege, Text = Drag to change opacity, TextAlign = MiddleCent
Name = HSB, Cursor = Hand, Minimum = 1, Maximum = 100, Value = 100
Name = btChange, Text = Change Shape
Private warningopacity As Boolean
Private surfaceround As Boolean
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
warningopacity = True
surfaceround = False
End Sub
Private Sub HSB_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HSB.Scroll
Me.Opacity = HSB.Value / 90
If HSB.Value <= 30 And_
warningopacity = True Then
MessageBox.Show("WARNING: The form will not be visible if the opacity is set to minimum. The scrollbar will not be visible.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
warningopacity = False
ElseIf HSB.Value > 30 Then
End If
And finally write the following code in the click event of the button to change the shape from rectangle to round or reverse of this.
Private Sub btChange_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btChange.Click
If surfaceround = False Then
surfaceround = True
btChange.Text = "Click to return to a default window"
Dim gpath As New Drawing2D.GraphicsPath
gpath.AddEllipse(New Rectangle(0, 0, Me.Width, Me.Height))
Me.Region = New Region(gpath)
Me.FormBorderStyle=FormBorderStyle.Fixed3D
ElseIf surfaceround = True Then
btChange.Text = "Click here to turn the window into a circle"
Me.Region = New Region
Me.FormBorderStyle=FormBorderStyle.Sizable
Posted on 2/24/2007 10:59:05 AM by Noushad
Posted on 3/27/2007 2:03:21 PM by Hitesh
Posted on 7/18/2007 4:35:25 AM by Suyog