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. Custom control question

Custom control question

Scheduled Pinned Locked Moved C#
question
7 Posts 4 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.
  • P Offline
    P Offline
    pankajdaga
    wrote on last edited by
    #1

    Ok, I am back ;P I have a simple custom control. I would like to set a black border around it. However, there is no SetBorder or BorderStyle property for a Control object. Is there a way to do it, or do I have to draw a line around the control? Thanks, Pankaj Without struggle, there is no progress

    L F 2 Replies Last reply
    0
    • P pankajdaga

      Ok, I am back ;P I have a simple custom control. I would like to set a black border around it. However, there is no SetBorder or BorderStyle property for a Control object. Is there a way to do it, or do I have to draw a line around the control? Thanks, Pankaj Without struggle, there is no progress

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      Hi, I would drop a panel in there, set it to DockStyle.Fill, then set its borders up like you want to. Then drop the rest of the control inside the panel. :) Hope this helps MYrc : A .NET IRC client with C# Plugin Capabilities. See http://sourceforge.net/projects/myrc for more info. :-D

      P 1 Reply Last reply
      0
      • L leppie

        Hi, I would drop a panel in there, set it to DockStyle.Fill, then set its borders up like you want to. Then drop the rest of the control inside the panel. :) Hope this helps MYrc : A .NET IRC client with C# Plugin Capabilities. See http://sourceforge.net/projects/myrc for more info. :-D

        P Offline
        P Offline
        pankajdaga
        wrote on last edited by
        #3

        There is just one problem. This control represents a resource in an experiment. I would have multiple resources one after the other and they would be stacked in that order. So, I would have to have a panel for every resource that I add. I think this could be an overkill. Don't you think so? If there was just one control, it would be all right, I think. Thanks, Pankaj Without struggle, there is no progress

        L 1 Reply Last reply
        0
        • P pankajdaga

          There is just one problem. This control represents a resource in an experiment. I would have multiple resources one after the other and they would be stacked in that order. So, I would have to have a panel for every resource that I add. I think this could be an overkill. Don't you think so? If there was just one control, it would be all right, I think. Thanks, Pankaj Without struggle, there is no progress

          L Offline
          L Offline
          leppie
          wrote on last edited by
          #4

          I'm not so sure what u mean, but i dont think there should be a problem. Best is to try it. It would only require a few extra lines in the control, so trying isnt an issue :) pankajdaga wrote: Without struggle, there is no progress :-D MYrc : A .NET IRC client with C# Plugin Capabilities. See http://sourceforge.net/projects/myrc for more info. :-D

          P 1 Reply Last reply
          0
          • L leppie

            I'm not so sure what u mean, but i dont think there should be a problem. Best is to try it. It would only require a few extra lines in the control, so trying isnt an issue :) pankajdaga wrote: Without struggle, there is no progress :-D MYrc : A .NET IRC client with C# Plugin Capabilities. See http://sourceforge.net/projects/myrc for more info. :-D

            P Offline
            P Offline
            pankajdaga
            wrote on last edited by
            #5

            Hey again, I tried it and it works, no problem. However, the problem is that I have multiple controls ( typically 100 or so, can run higher) that I instantiate at run-time. I think it would be a lot of overhead to add a panel for each of them. Since, I only need a black frame around it, I just draw lines at the edges of the control and that works fine :-) Thanks for the help though. This solution is perfect if you have only a few controls on the form :-) Pankaj Without struggle, there is no progress

            N 1 Reply Last reply
            0
            • P pankajdaga

              Hey again, I tried it and it works, no problem. However, the problem is that I have multiple controls ( typically 100 or so, can run higher) that I instantiate at run-time. I think it would be a lot of overhead to add a panel for each of them. Since, I only need a black frame around it, I just draw lines at the edges of the control and that works fine :-) Thanks for the help though. This solution is perfect if you have only a few controls on the form :-) Pankaj Without struggle, there is no progress

              N Offline
              N Offline
              Nnamdi Onyeyiri
              wrote on last edited by
              #6

              pankajdaga wrote: Since, I only need a black frame around it, I just draw lines at the edges of the control and that works fine thats wot I was gonna advise until I read the whole post.


              :suss: Email: theeclypse@hotmail.com   URL: http://www.onyeyiri.co.uk
              :suss:"All programmers are playwrights and all computers are lousy actors."

              1 Reply Last reply
              0
              • P pankajdaga

                Ok, I am back ;P I have a simple custom control. I would like to set a black border around it. However, there is no SetBorder or BorderStyle property for a Control object. Is there a way to do it, or do I have to draw a line around the control? Thanks, Pankaj Without struggle, there is no progress

                F Offline
                F Offline
                Firoz
                wrote on last edited by
                #7

                Hi, Try the DrawBorder() or DrawBorder3D() Methods of the ControlPaint class. Thanks, FiroZ

                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