none
How resize a TexBox whe I move the splitter bar RRS feed

  • Question

  • Hi everyone,

    I've developed ad add-in using Visual Studio C# for Word. Do you know how to resize a textbox when a splitter bar is moved? The textbox stay in same position with the same sizes. Is possible to set an Height and Width using percentage hence every time I move the bar, the controls resize them self automatically?

    Thanks.

    Fairlie

    Thursday, June 19, 2014 3:07 PM

Answers

  • Hi Fairlie

    Since you're using Windows Forms controls I recommend you ask about this in a forum that specializes in Windows Forms. I'd think there must be settings that take the display resolution into account, but I'm not a Windows Forms specialist. In any case, there's nothing at all in Word and its APIs that can affect this...


    Cindy Meister, VSTO/Word MVP, my blog

    Tuesday, June 24, 2014 2:32 PM
    Moderator

All replies

  • Hi Fairlie

    What do you mean by "splitter bar"?

    The only automatic resizing of graphical objects, assuming you're targeting a relatively new version of Word (2007 or later, as I recall) is the set of "Relative" sizing (and positioning) properties of a SHAPE object. But these react to the actual size of the document (changing margin settings, for example), not the size of a Window.

    So if what you're talking about has to do with document windows (such as splitting the view into two PANES), then there's nothing built into Word for you to work with. Possibly, something could be done with the Windows API...


    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, June 19, 2014 5:54 PM
    Moderator
  • Hi Cindy,

    I will try to be more clear :-). Do you know the Translate button available under View in Word? If you try to click on Translate Selected Text, It will open a Research panel on the right. I have developed an identical add-in for Word. In my Research panel I have two text boxes. When I move the vertical bar, the bar which separate the Word document and the panel, I would like that my text boxes resizing like the Translate Selected Text does.

    I hope it is clearer. Thanks for your help.

    Fairlie

    Friday, June 20, 2014 11:49 AM
  • Hi Fairlie

    This sounds like you have controls in a Custom Task Pane? Did you create a custom UserControl for the task pane? If not, how have you added your controls to it?


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, June 20, 2014 5:42 PM
    Moderator
  • Hi,Yes I have created a Custom Task Pane and User Control.

    I'm using the Anchor property now and It seems to be ok but...but if I change the the size of text and Icons choosing the option from Control Panel --> Display --> Medium, my controls get too big for the Custom Task Pane and the form turns in a bunch of uncontrolled textboxs.

    My default setting is Smaller but a lot of clients use Medium.

    I need for something to set Height and Width so they can resize authomatically  themself if someone set Display to Medium.

    Thanks.

    Fairlie

    Tuesday, June 24, 2014 7:57 AM
  • Hi Fairlie

    Since you're using Windows Forms controls I recommend you ask about this in a forum that specializes in Windows Forms. I'd think there must be settings that take the display resolution into account, but I'm not a Windows Forms specialist. In any case, there's nothing at all in Word and its APIs that can affect this...


    Cindy Meister, VSTO/Word MVP, my blog

    Tuesday, June 24, 2014 2:32 PM
    Moderator