Ask a questionAsk a question
 

AnswerRounded Corners

Answers

  • Friday, November 06, 2009 1:41 AMTattooed Bloke Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     AnswerHas Code
    Hi James12314909,

    For just the bottom corners, please try this code, you can also resize the FORM
     by the edges and the rounded corners will remain.


    Regards and happy coding from,

    Tattooed Bloke.


    Public Class Form1
    
        Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
    
            'Change this to whatever size you require.>>
            Dim RoundedCornerSize As Integer = 150
    
            Dim g As New System.Drawing.Drawing2D.GraphicsPath
            g.AddLine(0, 0, Me.Width, 0)
            g.AddLine(Me.Width, 0, Me.Width, Me.Height - RoundedCornerSize)
            g.AddArc(Me.Width - RoundedCornerSize, Me.Height - RoundedCornerSize, RoundedCornerSize, RoundedCornerSize, 0, 90)
            g.AddLine(Me.Width - RoundedCornerSize, Me.Height, RoundedCornerSize, Me.Height)
            g.AddArc(0, Me.Height - RoundedCornerSize, RoundedCornerSize, RoundedCornerSize, 90, 90)
            g.AddLine(0, Me.Height - RoundedCornerSize, 0, 0)
            Me.Region = New Region(g)
    
        End Sub
    
        Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
    
            Me.Refresh()
    
        End Sub
    
    End Class
    

All Replies

  • Thursday, November 05, 2009 3:27 PMPaul P Clement IVMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    See if the following helps:

    http://www.devasp.net/net/articles/display/312.html


    Paul ~~~~ Microsoft MVP (Visual Basic)
  • Friday, November 06, 2009 1:41 AMTattooed Bloke Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     AnswerHas Code
    Hi James12314909,

    For just the bottom corners, please try this code, you can also resize the FORM
     by the edges and the rounded corners will remain.


    Regards and happy coding from,

    Tattooed Bloke.


    Public Class Form1
    
        Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
    
            'Change this to whatever size you require.>>
            Dim RoundedCornerSize As Integer = 150
    
            Dim g As New System.Drawing.Drawing2D.GraphicsPath
            g.AddLine(0, 0, Me.Width, 0)
            g.AddLine(Me.Width, 0, Me.Width, Me.Height - RoundedCornerSize)
            g.AddArc(Me.Width - RoundedCornerSize, Me.Height - RoundedCornerSize, RoundedCornerSize, RoundedCornerSize, 0, 90)
            g.AddLine(Me.Width - RoundedCornerSize, Me.Height, RoundedCornerSize, Me.Height)
            g.AddArc(0, Me.Height - RoundedCornerSize, RoundedCornerSize, RoundedCornerSize, 90, 90)
            g.AddLine(0, Me.Height - RoundedCornerSize, 0, 0)
            Me.Region = New Region(g)
    
        End Sub
    
        Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
    
            Me.Refresh()
    
        End Sub
    
    End Class
    
  • Saturday, November 07, 2009 5:53 PMTattooed Bloke Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi everyone,

    I was thinking of adding a post here which would be code for a FORM whereby you could
     turn ON / OFF each of the 4 corners between Rounded or RightAngled.

    As addition to that idea, how about a FORM where you can have each of the corners either;

    Rounded / Right-Angled / SlantedAt45Degrees

    This could be done by adding 4 properties to a FORM which I suggest as;

    TopRightCornerStyle

    TopLeftCornerStyle

    BottomRightCornerStyle

    BottomLeftCornerStyle


    Would anyone be interested?


    Happy coding from,

    Tattooed Bloke
  • Saturday, November 07, 2009 8:36 PMSylva Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    @Tattooed Bloke:

    It appears that you're good at Windows Forms.Could you please take a look/shot at this question I posted long ago: Form Border Color Design/Appearance
    Only performance counts!
  • Sunday, November 08, 2009 4:08 PMTattooed Bloke Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    @Tattooed Bloke:

    It appears that you're good at Windows Forms.Could you please take a look/shot at this question I posted long ago: Form Border Color Design/Appearance
    Only performance counts!

    Hello Sylva,

    Interesting!!

    The project as linked at.>> http://customerborderform.codeplex.com/

    from.>>

    http://social.msdn.microsoft.com/Forums/en-US/winformsdesigner/thread/892c4fdd-348c-4189-8607-e60adc793f76

    uses 13 separate C# files.

    It may take me sometime to convert each of them.

    If you want to post your email address in the form of  sylva <at> wherever.com

    ( that way you will avoid spam bots ), I will get back to you later if I manage to convert it to Vb.


    Regards,

    Tattooed Bloke
  • Sunday, November 08, 2009 9:22 PMSylva Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks, TB. I will post the e mail address at the Thread itself so that this thread is not derailed.

    Many thanks.
    Only performance counts!
  • Monday, November 09, 2009 12:20 AMTattooed Bloke Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks, TB. I will post the e mail address at the Thread itself so that this thread is not derailed.

    Many thanks.
    Only performance counts!

    Hello Sylva,

    I have replied there too.


    Happy coding from,

    Tattooed Bloke