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. Layout takes time to rearrange after rezise, how to fix?

Layout takes time to rearrange after rezise, how to fix?

Scheduled Pinned Locked Moved C#
questionperformancehelptutorial
2 Posts 2 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.
  • L Offline
    L Offline
    leeoze 0
    wrote on last edited by
    #1

    Hi, on My form I have about 150 controls at the same time, and most of them use docking. some of them are childs in childs in childs of controls. Whenever I resize my form it takes a long time for it to rearrange and ready to workwith. I manged to speed up things in the proccess of adding all the controls by using ResumeLayout and SuspandLayout. But what should I do in the proccess of resizing? How can I find out when the resizing event startend and when the resizing is finished? tnx leeoz

    A 1 Reply Last reply
    0
    • L leeoze 0

      Hi, on My form I have about 150 controls at the same time, and most of them use docking. some of them are childs in childs in childs of controls. Whenever I resize my form it takes a long time for it to rearrange and ready to workwith. I manged to speed up things in the proccess of adding all the controls by using ResumeLayout and SuspandLayout. But what should I do in the proccess of resizing? How can I find out when the resizing event startend and when the resizing is finished? tnx leeoz

      A Offline
      A Offline
      Anthony Mushrow
      wrote on last edited by
      #2

      Resize event doesn't quite work like that, it gets fired when the forms size has changed. So when you resize your form with your mouse, every time you see a visible change in the size of your form, then event has been fired. Sadly you can't get the mouseDown mouseUp events for clicking on the border. The only way i know to get that information is to override WndProc and look at the messages, one of them is sent when you mouse down on the caption bar/border and other are sent when the mouse moves or the button is released. But, i tried using SuspendLayout and ResumeLayout with docked controls, and i think after ResumeLayout the controls just stayed where they were. So you should check that. Good news is though, if you also override the OnPaint event you can stop any drawing yourself. So if you use WndProc to work out when the form is being resized then you can set a bool to false or something, and have an if statement around base.OnPaint(e); in your OnPaint override. Of course even without drawing it will still try to reposition all of the controls every time the resize event is fired, so it may still end up going slow. Well, good luck.

      My current favourite word is: Bacon!

      -SK Genius

      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