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. DockStyle.Top problems

DockStyle.Top problems

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

    I'm developing this app that allows users to add controls that represent tasks by clicking a button. When the button gets clicked, a new TaskControl is created and added to the TaskPanel container. The TaskControl has a DockStyle.Top. However, when the button gets clicked again to add another TaskControl, the new TaskControl gets added to the TaskPanel above the existing TaskControl(s). I want it to appear below the already existing controls. How do I go about doing that?

    J S 2 Replies Last reply
    0
    • P partyganger

      I'm developing this app that allows users to add controls that represent tasks by clicking a button. When the button gets clicked, a new TaskControl is created and added to the TaskPanel container. The TaskControl has a DockStyle.Top. However, when the button gets clicked again to add another TaskControl, the new TaskControl gets added to the TaskPanel above the existing TaskControl(s). I want it to appear below the already existing controls. How do I go about doing that?

      J Offline
      J Offline
      Judah Gabriel Himango
      wrote on last edited by
      #2

      Try calling .BringToFront() on the control you want at the top. Docking orders depend on the Z order of the controls. Play around with the BringToFront and SendToBack methods. #include "witty_sig.h"

      P 1 Reply Last reply
      0
      • J Judah Gabriel Himango

        Try calling .BringToFront() on the control you want at the top. Docking orders depend on the Z order of the controls. Play around with the BringToFront and SendToBack methods. #include "witty_sig.h"

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

        They are already displayed "on top", but the problem is that new controls push the old ones down (not on the z-axis, but on the y-axis). So I see 'em all, but like so (crude lineart :D)


        container <-- new one gets inserted here and pushes existing down
        control
        --------------------------------

        1 Reply Last reply
        0
        • P partyganger

          I'm developing this app that allows users to add controls that represent tasks by clicking a button. When the button gets clicked, a new TaskControl is created and added to the TaskPanel container. The TaskControl has a DockStyle.Top. However, when the button gets clicked again to add another TaskControl, the new TaskControl gets added to the TaskPanel above the existing TaskControl(s). I want it to appear below the already existing controls. How do I go about doing that?

          S Offline
          S Offline
          sreejith ss nair
          wrote on last edited by
          #4

          //Ok your requirement is to add your task control just beneth to the existing task control when //you click the add button. //for eg : if this is your location value of panel control this.yourpannel_control.Location=new System.Drawing.Point(8,0); //then //assign to public variable LocX and LocY (forgetting x and y co-ordinates values) //initial values of LocX and LocY this.LocX=yourpannel_control.Location.X; this.LocY=yourpannel_control.Location.Y+32; //(i gave 32 . you can give any number. based on this value your task control will add from top) buttion_click() { if(_UCtl1==null) { _UCtl1=new yourtask_control() this._UCtl1.Location = new System.Drawing.Point(LocX, LocY); this.yourpannel_control.Controls.Add(_UCtl1); } else { _UCtl1=new new yourtask_control() this._UCtl1.Location = new System.Drawing.Point(LocX, LocY); this.yourpannel_control.Controls.Add(_UCtl1); } LocX=LocX; LocY=LocY+32; yourpannel_control.Height=LocY+16; //(i gave 16. you can give the height of your task control + difference between two task control) } this code will add your task control just one beneth the other.

          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