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. Form Maximize Events

Form Maximize Events

Scheduled Pinned Locked Moved C#
helpquestion
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.
  • B Offline
    B Offline
    BrianEllis
    wrote on last edited by
    #1

    I have a form that is being maximized. The form is a child form of an MDI parent and there is another child form docked on the left as a menu. Therefore, when the form is maximized it needs to be maximized to (for instance:) location 256, 0, 200, 200 instead of 0,0,456,200 (where above is x, y, width, height). I'm having a real issue finding an event that fires BEFORE a maximize command to set the bounds and the maximizedbounds property doesn't seem to be doing any good. Any ideas, events, etc.? Brian "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." - Douglas Adams

    H 1 Reply Last reply
    0
    • B BrianEllis

      I have a form that is being maximized. The form is a child form of an MDI parent and there is another child form docked on the left as a menu. Therefore, when the form is maximized it needs to be maximized to (for instance:) location 256, 0, 200, 200 instead of 0,0,456,200 (where above is x, y, width, height). I'm having a real issue finding an event that fires BEFORE a maximize command to set the bounds and the maximizedbounds property doesn't seem to be doing any good. Any ideas, events, etc.? Brian "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." - Douglas Adams

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      Override WndProc and handle the WM_SIZING (0x0214) message. This is sent to a window procedure (and keep in mind that almost all Windows Forms controls encapsulate native controls and dialogs) before being resized. The Message.WParam specifies the edge that is being resized and the Message.LParam specifies the RECT (which you must define in managed code - a System.Drawing.Rectangle will not suffice because it stores coordinates differently). Set the Message.Result to new IntPtr(1) to signal that you've processed it and don't want your Form to be resized.

      Microsoft MVP, Visual C# My Articles

      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