Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub frmmain_Paint(ByVal sender As Object, _
- ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
- Dim gp As New System.Drawing.Drawing2D.GraphicsPath
- If cirOrec = 0 Then 'If Rounded Rectangle is selected
- If intval = 0 Then
- intval = 200
- End If
- Dim chgcorn As Integer = intval 'Change the value and get the
- 'desired Rounded corner,
- 'keep in mind that the value should be divisible by 10.
- ' check whether the entered number is divisible by 10 or not,
- ' if not then make it.
- If chgcorn Mod 10 <> 0 Then
- chgcorn = chgcorn - (chgcorn Mod 10)
- End If
- Dim r1 As New Rectangle(0, Me.Height - chgcorn, chgcorn, chgcorn)
- Dim r2 As New Rectangle(Me.Width - chgcorn + 1, _
- Me.Height - chgcorn, chgcorn, chgcorn)
- 'creating the upper Arc
- gp.AddArc(0, 0, chgcorn, chgcorn, 180, 90)
- gp.AddArc(Me.Width - chgcorn + 1, 0, chgcorn, chgcorn, 270, 90)
- 'Creating the Body
- gp.AddRectangle(New Rectangle(0, chgcorn / 2, Me.Width, Me.Height - chgcorn))
- 'Creating the lower Arc
- gp.AddArc(r1, -270, 90)
- gp.AddArc(r2, 360, 90)
- Me.BackColor = Color.Black
- Else 'If Circular form type is selected
- If intval = 0 Then
- intval = Me.Width
- End If
- If intval2 = 0 Then
- intval2 = Me.Height
- End If
- gp.AddEllipse(New Rectangle(0, 0, intval, intval2))
- Me.BackColor = Color.IndianRed
- End If
- Region = New Region(gp)
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement