Как автоматически отобразить горизонтальную полосу прокрутки на панели при свернутой форме? - PullRequest
0 голосов
/ 10 мая 2019

У меня есть групповое окно для отображения моих элементов конфигурации. Групповой блок находится на панели в форме.

Когда форма загружается, она открывается в развернутом режиме. В течение этого времени вертикальная полоса прокрутки на панели отображается правильно. Горизонтальная полоса прокрутки в это время не отображается, потому что я все еще могу видеть весь текст, который является правильным.

Но когда я свернул форму, вот в чем проблема. Я не могу увидеть весь текст элементов конфигурации и не могу прокрутить вправо, чтобы прочитать его, потому что нет горизонтальной полосы прокрутки. Есть ли способ решить это? Или есть способ всегда всегда включать горизонтальную полосу прокрутки? Пожалуйста помоги. Спасибо.

        // 
        // panel1
        // 
        this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
        this.panel1.AutoScroll = true;
        this.panel1.Controls.Add(this.grpBoxConfItems);
        this.panel1.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.panel1.Location = new System.Drawing.Point(1164, 224);
        this.panel1.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
        this.panel1.Name = "panel1";
        this.panel1.Size = new System.Drawing.Size(682, 810);
        this.panel1.TabIndex = 4;
        // 
        // grpBoxConfItems
        // 
        this.grpBoxConfItems.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
        this.grpBoxConfItems.AutoSize = true;
        this.grpBoxConfItems.Controls.Add(this.lblValue);
        this.grpBoxConfItems.Controls.Add(this.lblKey);
        this.grpBoxConfItems.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.grpBoxConfItems.Location = new System.Drawing.Point(34, 32);
        this.grpBoxConfItems.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
        this.grpBoxConfItems.Name = "grpBoxConfItems";
        this.grpBoxConfItems.Padding = new System.Windows.Forms.Padding(6, 6, 6, 6);
        this.grpBoxConfItems.Size = new System.Drawing.Size(712, 744);
        this.grpBoxConfItems.TabIndex = 0;
        this.grpBoxConfItems.TabStop = false;
        this.grpBoxConfItems.Text = "Configuration Items";

UPDATE Поэтому я решил сделать свитки всегда видимыми в развернутом или свернутом режиме.

                this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
                | System.Windows.Forms.AnchorStyles.Right)));
                this.panel1.AutoScroll = false;
                this.panel1.VerticalScroll.Visible = true;
                this.panel1.VerticalScroll.Enabled = true;
                this.panel1.HorizontalScroll.Visible = true;
                this.panel1.HorizontalScroll.Enabled = true;
                this.panel1.Controls.Add(this.grpBoxConfItems);
                this.panel1.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.panel1.Location = new System.Drawing.Point(1164, 224);
                this.panel1.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
                this.panel1.Name = "panel1";
                this.panel1.Size = new System.Drawing.Size(682, 810);
                this.panel1.TabIndex = 4;

Оба свитка показывают, но они не работают. И когда я устанавливаю this.panel1.AutoScroll = true; после this.panel1.HorizontalScroll.Enabled = true;, вертикальная прокрутка работает, но горизонтальная прокрутка отсутствует. Пожалуйста, помогите мне, как я могу решить это? Спасибо.

...