Advertisement
Guest User

Untitled

a guest
Jul 8th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.68 KB | None | 0 0
  1.     Private Sub frmmain_Paint(ByVal sender As Object, _
  2.     ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
  3.         Dim gp As New System.Drawing.Drawing2D.GraphicsPath
  4.         If cirOrec = 0 Then 'If Rounded Rectangle is selected
  5.  
  6.             If intval = 0 Then
  7.                 intval = 200
  8.             End If
  9.  
  10.         Dim chgcorn As Integer = intval  'Change the value and get the
  11.         'desired Rounded corner,
  12.         'keep in mind that the value should be divisible by 10.
  13.  
  14.         ' check whether the entered number is divisible by 10 or not,
  15.         ' if not then make it.
  16.         If chgcorn Mod 10 <> 0 Then
  17.             chgcorn = chgcorn - (chgcorn Mod 10)
  18.         End If
  19.  
  20.         Dim r1 As New Rectangle(0, Me.Height - chgcorn, chgcorn, chgcorn)
  21.         Dim r2 As New Rectangle(Me.Width - chgcorn + 1, _
  22.             Me.Height - chgcorn, chgcorn, chgcorn)
  23.  
  24.         'creating the upper Arc
  25.         gp.AddArc(0, 0, chgcorn, chgcorn, 180, 90)
  26.         gp.AddArc(Me.Width - chgcorn + 1, 0, chgcorn, chgcorn, 270, 90)
  27.  
  28.         'Creating the Body
  29.         gp.AddRectangle(New Rectangle(0, chgcorn / 2, Me.Width, Me.Height - chgcorn))
  30.  
  31.         'Creating the lower Arc
  32.         gp.AddArc(r1, -270, 90)
  33.         gp.AddArc(r2, 360, 90)
  34.  
  35.         Me.BackColor = Color.Black
  36.        Else              'If Circular form type is selected
  37.             If intval = 0 Then
  38.                 intval = Me.Width
  39.             End If
  40.             If intval2 = 0 Then
  41.                 intval2 = Me.Height
  42.             End If
  43.             gp.AddEllipse(New Rectangle(0, 0, intval, intval2))
  44.             Me.BackColor = Color.IndianRed
  45.         End If
  46.         Region = New Region(gp)
  47.     End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement