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. Windows Forms
  4. Window resizing

Window resizing

Scheduled Pinned Locked Moved Windows Forms
question
7 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
    Lamazhab
    wrote on last edited by
    #1

    Hi, I am trying to prevent users from resizing the form window. I have set: this.WindowState = FormWindowState.Maximized; this.FormBorderStyle = FormBorderStyle.FixedSingle; this.ControlBox = false; It prevents user from resizing except that if I doouble-click on the title bar on top, it resizes. Is there a way to prevent this as well? Thanks.

    L L 2 Replies Last reply
    0
    • L Lamazhab

      Hi, I am trying to prevent users from resizing the form window. I have set: this.WindowState = FormWindowState.Maximized; this.FormBorderStyle = FormBorderStyle.FixedSingle; this.ControlBox = false; It prevents user from resizing except that if I doouble-click on the title bar on top, it resizes. Is there a way to prevent this as well? Thanks.

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Hi, if you were to have

      if (WindowState==FormWindowState.Normal) WindowState = FormWindowState.Maximized;

      within the Form's Resize handler, you probably would get what you want (a Form that is either Maximized or Minimized). And I as a user would probably hate your app and remove it from my system right away. I like an app to remember its window bounds and reuse the same value next time around, and not to dictate how I choose to use my system. :)

      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

      Please use < PRE > tags for code snippets, it preserves indentation, and improves readability.

      L 1 Reply Last reply
      0
      • L Lamazhab

        Hi, I am trying to prevent users from resizing the form window. I have set: this.WindowState = FormWindowState.Maximized; this.FormBorderStyle = FormBorderStyle.FixedSingle; this.ControlBox = false; It prevents user from resizing except that if I doouble-click on the title bar on top, it resizes. Is there a way to prevent this as well? Thanks.

        L Offline
        L Offline
        Lamazhab
        wrote on last edited by
        #3

        In case someone else has the same issue, this is how I solved it: protected override void WndProc(ref System.Windows.Forms.Message message) { const int WM_SYSCOMMAND = 0x0112; const int SC_MOVE = 0xF010; const int WM_NCDOUBLECLICK = 0x00A3; switch(message.Msg) { case WM_SYSCOMMAND: int command = message.WParam.ToInt32() & 0xfff0; if (command == SC_MOVE) return; break; // Non-client double click case WM_NCDOUBLECLICK: return; } base.WndProc(ref message); }

        L 1 Reply Last reply
        0
        • L Lamazhab

          In case someone else has the same issue, this is how I solved it: protected override void WndProc(ref System.Windows.Forms.Message message) { const int WM_SYSCOMMAND = 0x0112; const int SC_MOVE = 0xF010; const int WM_NCDOUBLECLICK = 0x00A3; switch(message.Msg) { case WM_SYSCOMMAND: int command = message.WParam.ToInt32() & 0xfff0; if (command == SC_MOVE) return; break; // Non-client double click case WM_NCDOUBLECLICK: return; } base.WndProc(ref message); }

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          That may be both unnecessary and insufficient; if the application shows in the task bar, you can right click there and choose "Restore". :)

          Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

          Please use < PRE > tags for code snippets, it preserves indentation, and improves readability.

          L 1 Reply Last reply
          0
          • L Luc Pattyn

            Hi, if you were to have

            if (WindowState==FormWindowState.Normal) WindowState = FormWindowState.Maximized;

            within the Form's Resize handler, you probably would get what you want (a Form that is either Maximized or Minimized). And I as a user would probably hate your app and remove it from my system right away. I like an app to remember its window bounds and reuse the same value next time around, and not to dictate how I choose to use my system. :)

            Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

            Please use < PRE > tags for code snippets, it preserves indentation, and improves readability.

            L Offline
            L Offline
            Lamazhab
            wrote on last edited by
            #5

            I understand it is not user friendly but it is not supposed to be. This is for a kiosk style app and it is the only app running and should always be in maximze state. I would also remove any app from my machine if it dictates how it should be alwyas be displayed.

            1 Reply Last reply
            0
            • L Luc Pattyn

              That may be both unnecessary and insufficient; if the application shows in the task bar, you can right click there and choose "Restore". :)

              Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

              Please use < PRE > tags for code snippets, it preserves indentation, and improves readability.

              L Offline
              L Offline
              Lamazhab
              wrote on last edited by
              #6

              Thanks Luc. It is a kiosk app and I am actually in the process of finding some way to clamp down on what users can do (disable CTL-ALT-DEL, ALT-TAB, etc., remove task bar, ...) In case anyone knows how to accomplish these, i would really appreciate a sample or pointing me to right direction.

              L 1 Reply Last reply
              0
              • L Lamazhab

                Thanks Luc. It is a kiosk app and I am actually in the process of finding some way to clamp down on what users can do (disable CTL-ALT-DEL, ALT-TAB, etc., remove task bar, ...) In case anyone knows how to accomplish these, i would really appreciate a sample or pointing me to right direction.

                L Offline
                L Offline
                Luc Pattyn
                wrote on last edited by
                #7

                You should have said so right away. I have no experience with kiosk mode, but the topic pops up regularly around here; the best reply seems to be this one[^]. For more, use CodeProject's message search facility, or Google. :)

                Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

                Please use < PRE > tags for code snippets, it preserves indentation, and improves readability.

                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