Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. how to set the border Line for the winForm in C#?

how to set the border Line for the winForm in C#?

Scheduled Pinned Locked Moved C#
csharptutorialquestion
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mctramp168
    wrote on last edited by
    #1

    how to set the border Line of the winForm in C#? and set the border line color ? Thanks !

    M 1 Reply Last reply
    0
    • M mctramp168

      how to set the border Line of the winForm in C#? and set the border line color ? Thanks !

      M Offline
      M Offline
      musefan
      wrote on last edited by
      #2

      do you mean the border of the whole form, or just a specific control?

      If only MySelf.Visible was more than just a getter... A person can produce over 5 times there own body weight in excrement each year... please re-read your questions before posting

      M 1 Reply Last reply
      0
      • M musefan

        do you mean the border of the whole form, or just a specific control?

        If only MySelf.Visible was more than just a getter... A person can produce over 5 times there own body weight in excrement each year... please re-read your questions before posting

        M Offline
        M Offline
        mctramp168
        wrote on last edited by
        #3

        I want to set the border of the whole form.

        M D 2 Replies Last reply
        0
        • M mctramp168

          I want to set the border of the whole form.

          M Offline
          M Offline
          musefan
          wrote on last edited by
          #4

          well as far as im aware there is no property for that so you will have to do it some other way, here is a couple of options: Option 1: Handle the paintEvent (or override OnPaint)for the form and add some code such as - e.Graphics.DrawRectangle(...); Be aware that controls maybe be drawn ontop of the border depending on placement Option 2: Create a panel, which will be your 'Main Panel' place this on the form but slightly offset its size and position so the mainForm background color can be set to the desired border color and you should only see a border effect, of course you set the 'Main Panel' backColor to be what ever you want your main backColor to be Hope these make sense

          If only MySelf.Visible was more than just a getter... A person can produce over 5 times there own body weight in excrement each year... please re-read your questions before posting

          M 1 Reply Last reply
          0
          • M mctramp168

            I want to set the border of the whole form.

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            Without adding some serious code to handle redrawing the non-client area (NOT EASY!) of the form, you can't. The window borders are drawn according to the system settings and they are for every window you see, not just yours.

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007, 2008

            M 1 Reply Last reply
            0
            • M musefan

              well as far as im aware there is no property for that so you will have to do it some other way, here is a couple of options: Option 1: Handle the paintEvent (or override OnPaint)for the form and add some code such as - e.Graphics.DrawRectangle(...); Be aware that controls maybe be drawn ontop of the border depending on placement Option 2: Create a panel, which will be your 'Main Panel' place this on the form but slightly offset its size and position so the mainForm background color can be set to the desired border color and you should only see a border effect, of course you set the 'Main Panel' backColor to be what ever you want your main backColor to be Hope these make sense

              If only MySelf.Visible was more than just a getter... A person can produce over 5 times there own body weight in excrement each year... please re-read your questions before posting

              M Offline
              M Offline
              mctramp168
              wrote on last edited by
              #6

              Thanks musefan, I'll attempt to handle with your suggestion

              1 Reply Last reply
              0
              • D Dave Kreskowiak

                Without adding some serious code to handle redrawing the non-client area (NOT EASY!) of the form, you can't. The window borders are drawn according to the system settings and they are for every window you see, not just yours.

                A guide to posting questions on CodeProject[^]
                Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                     2006, 2007, 2008

                M Offline
                M Offline
                mctramp168
                wrote on last edited by
                #7

                Thank Dave

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups