locked
Controls Resizing RRS feed

  • Question

  • I have 3 controls on a Panel.The panel is docked to Fill. The client has demanded that the controls on either side (i.e a listview and treeview) be resized with the form but the center control which happens to be a Panel with buttons(Add/Delete) be nonresizabale.I  have managed to achieve this programmatically, but I'm running into the following problems,

    1 As I'm unable to use the Docking and anchoring properties(I have tried to my wits end but unable get this working as per the clients demands) the resizing is not smooth and the controls seem to flicker.How can I over come this ?.
    2.Another problem that I'm facing is on minimizing the form the layout gets all messed up.The panel  with the buttons on it is invisible, and the treeview and listview cover the enitire UI


    I thought resizing would be pretty simple using Anchoring and Docking but with the present interface this seems to be a challenge.any help would be greatly appreciated.

    Thanks in advance for all your help.

    Wednesday, May 17, 2006 2:48 PM

Answers

  • Are you doing this?: 

    1. ListView docked to left.

    2. TreeView docked to right.

    3. Panel docked to fill.

    4. On resize event, set the width of the ListView and the TreeView appropriately.

    I just tried this in a test app, and it seems to work fine.   Here's the contents from the resize event:

    this.listView1.Width = this.Width / 3;

    this.treeView1.Width = this.Width / 3;

     

    You could also experiment with the ResizeEnd event (instead of Resize) so your resizing functionality isn't run until the user stops sizing the control. 

    Wednesday, May 17, 2006 5:11 PM

All replies

  • Are you doing this?: 

    1. ListView docked to left.

    2. TreeView docked to right.

    3. Panel docked to fill.

    4. On resize event, set the width of the ListView and the TreeView appropriately.

    I just tried this in a test app, and it seems to work fine.   Here's the contents from the resize event:

    this.listView1.Width = this.Width / 3;

    this.treeView1.Width = this.Width / 3;

     

    You could also experiment with the ResizeEnd event (instead of Resize) so your resizing functionality isn't run until the user stops sizing the control. 

    Wednesday, May 17, 2006 5:11 PM
  • Thanks WNC,

    I earlier had my controls docked in the same manner as you had said but my logic in the resize event  was not getting the size from the form but from the control itself. I guess thats where the problem was.

    I followed your code with getting the width from the form and it works perfectly on restoring it from the minimized state but I still encounter the flickering problem. I'm on 1.1.I'm not sure there is ResizeEnd  event on the form.Correct me if I'm wrong.

    I truly appreciate your taking the time to try my query and answering it.

    Thanks a ton !!

    Reeba

    Wednesday, May 17, 2006 7:17 PM
  • You're welcome.  Glad I could help. 

    You are right - ResizeEnd is new in 2.0.  The only way I've found to fully ensure flickering on resize doesn't happen is to not use the prepackaged Microsoft controls.  I know that's a pain, but if it is important to avoid, and don't have control of the user's configuration, it seems there's not much of an alternative.  I'm sure you've read in the countless newsgroup articles about how certain controls flicker based on the current Theme, etc.

    Good luck...

     

    Wednesday, May 17, 2006 8:52 PM