Is It Possible? Auto-resizing within a Custom Task Pane RRS feed

  • Question

  • Hey folks

    My team is building an Add-in for Word that uses Custom Task Panes. Every task pane that is pre-built by MS within Word seems to auto-resize its contents (e.g. if you shorten the height of the Styles pane for example, the list box shrinks while the items beneath it move up and remain visible).

    After reading the documentation on the AutoSize, AutoSizeMode and Size properties, we see no way to set our task pane to auto-resize the objects within it, such as a list box, when the height of the application window changes. Instead, when the application window is reduced, the bottom contents of the pane become hidden, and a scroll bar appears for the entire pane. This makes placing any controls near the bottom of the pane very risky since we don't want users having to scroll down to see what's there.

    Any advice is greatly appreciated.



    Friday, January 13, 2012 9:26 PM

All replies

  • Hello,

    Use Anchor.This works for me:

        'Required by the Windows Form Designer
        Private components As System.ComponentModel.IContainer
        'NOTE: The following procedure is required by the Windows Form Designer
        'It can be modified using the Windows Form Designer.  
        'Do not modify it using the code editor.
        <System.Diagnostics.DebuggerStepThrough()> _
        Private Sub InitializeComponent()
            Me.Button1 = New System.Windows.Forms.Button
            Me.Button1.<span style="text-decoration:underline"><strong>Anchor </strong></span>= CType((System.Windows.Forms.AnchorStyles.<span style="text-decoration:underline"><strong>Bottom </strong></span>Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
            Me.Button1.Location = New System.Drawing.Point(34, 124)
            Me.Button1.Name = "Button1"
            Me.Button1.Size = New System.Drawing.Size(75, 23)
            Me.Button1.TabIndex = 0
            Me.Button1.Text = "Button1"
            Me.Button1.UseVisualStyleBackColor = True
            Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
            Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
            Me.Name = "UserControl1"
        End Sub
        Friend WithEvents Button1 As System.Windows.Forms.Button

    Regards from Belarus (GMT + 3),

    Andrei Smolin
    Add-in Express Team Leader
    Sunday, January 15, 2012 4:08 AM