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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. User control that cannot be resized

User control that cannot be resized

Scheduled Pinned Locked Moved C#
tutorialhelp
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.
  • M Offline
    M Offline
    mkorin
    wrote on last edited by
    #1

    Hello, If anyone can help me with this it would be great. Maybe someone can even write a tutorial. I am trying to create a simple user control. It doesn't really matter what kind of control it is, the key thing is, this control cannot be resized through code or designer. For example, the height of the textbox control cannot be changed. I am trying to get similar results, except that width cannot be changed as well. Sincerely, Michael Korin

    A M 2 Replies Last reply
    0
    • M mkorin

      Hello, If anyone can help me with this it would be great. Maybe someone can even write a tutorial. I am trying to create a simple user control. It doesn't really matter what kind of control it is, the key thing is, this control cannot be resized through code or designer. For example, the height of the textbox control cannot be changed. I am trying to get similar results, except that width cannot be changed as well. Sincerely, Michael Korin

      A Offline
      A Offline
      andreumv
      wrote on last edited by
      #2

      Try writing a (private?) bool property named Resizable. Then you can ask at some point (OnResizing event or something alike) if it can be resized, if not return the size to its initial value.

      M 1 Reply Last reply
      0
      • A andreumv

        Try writing a (private?) bool property named Resizable. Then you can ask at some point (OnResizing event or something alike) if it can be resized, if not return the size to its initial value.

        M Offline
        M Offline
        mkorin
        wrote on last edited by
        #3

        Thanks for the reply, but this is not what I am looking for. You are telling me a workaround. You can do it even better by overwriting the size method [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] public new Size Size { get {return new Size(20,20);} set {} } But when you place this element in the designer, it still shows 9 squares around it appearing to be resizable (Even though when you try to resize, it will move it instead keeping the size). I want my control to look somehow like textbox where you can't resize it in the editor. Further I want to remove the SizeChanged and Resize even handlers so that they are not accessible through designer or code. Thank you for your suggestion though. Mike

        1 Reply Last reply
        0
        • M mkorin

          Hello, If anyone can help me with this it would be great. Maybe someone can even write a tutorial. I am trying to create a simple user control. It doesn't really matter what kind of control it is, the key thing is, this control cannot be resized through code or designer. For example, the height of the textbox control cannot be changed. I am trying to get similar results, except that width cannot be changed as well. Sincerely, Michael Korin

          M Offline
          M Offline
          Martin 0
          wrote on last edited by
          #4

          Hello, Maybe the "Locked" property helps you a little more. All the best, Martin

          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