User control and resizes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rodrigo Ferreira

    User control and resizes


    I have an user control and inside him i have one label and 1 textbox!

    My problem is:

    When i'am in design mode (a new project with this user control), i want to:

    - If i resize the user control with the left ctrl key down the size of the
    label increses/decrease.
    - If i resize the control with the right ctrl key down the size og the
    textbox change!

    Any ideias to do that?



  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: User control and resizes

    Rodrigo,

    In your event handler for the resize event, you will have to call the
    GetKeyState API function through the P/Invoke layer, in order to determine
    the state of the VK_LCONTROL and VK_RCONTROL keys (which correspond to the
    left and right control keys).

    You can find the declaration for GetKeyState in winuser.h, or possibly
    on http://www.pinvoke.net, as well as the values for the constants.

    Hope this helps.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "Rodrigo Ferreira" <rjrferreira@gm ail.com> wrote in message
    news:eo7icIdcFH A.2652@TK2MSFTN GP10.phx.gbl...[color=blue]
    >
    > I have an user control and inside him i have one label and 1 textbox!
    >
    > My problem is:
    >
    > When i'am in design mode (a new project with this user control), i want
    > to:
    >
    > - If i resize the user control with the left ctrl key down the size of
    > the label increses/decrease.
    > - If i resize the control with the right ctrl key down the size og the
    > textbox change!
    >
    > Any ideias to do that?
    >
    >[/color]


    Comment

    • Rodrigo Ferreira

      #3
      Re: User control and resizes


      It works!

      But this code also works fine:
      System.Windows. Forms.Control.M odifierKeys == Keys.Alt)

      "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> wrote in
      message news:ehP2VddcFH A.1040@TK2MSFTN GP10.phx.gbl...[color=blue]
      >
      > Rodrigo,
      >
      > In your event handler for the resize event, you will have to call the
      > GetKeyState API function through the P/Invoke layer, in order to determine
      > the state of the VK_LCONTROL and VK_RCONTROL keys (which correspond to the
      > left and right control keys).
      >
      > You can find the declaration for GetKeyState in winuser.h, or possibly
      > on http://www.pinvoke.net, as well as the values for the constants.
      >
      > Hope this helps.
      >
      >
      > --
      > - Nicholas Paldino [.NET/C# MVP]
      > - mvp@spam.guard. caspershouse.co m
      >
      > "Rodrigo Ferreira" <rjrferreira@gm ail.com> wrote in message
      > news:eo7icIdcFH A.2652@TK2MSFTN GP10.phx.gbl...[color=green]
      >>
      >> I have an user control and inside him i have one label and 1 textbox!
      >>
      >> My problem is:
      >>
      >> When i'am in design mode (a new project with this user control), i want
      >> to:
      >>
      >> - If i resize the user control with the left ctrl key down the size of
      >> the label increses/decrease.
      >> - If i resize the control with the right ctrl key down the size og the
      >> textbox change!
      >>
      >> Any ideias to do that?
      >>
      >>[/color]
      >
      >
      >[/color]



      Comment

      Working...