簡體   English   中英

面板在 C# 中不可滾動

[英]Panel is not scrollable in c#

請指導如何向此面板添加滾動事件

            this.pnlContainer.Location = new System.Drawing.Point(0, 0);
            this.pnlContainer.Name = "pnlContainer";
            this.pnlContainer.Size = new System.Drawing.Size(1249, 799);
            this.pnlContainer.AutoScroll = false;
            this.pnlContainer.VerticalScroll.Enabled = true;
            this.pnlContainer.VerticalScroll.Visible = true;
            this.pnlContainer.AutoScroll = true;

首先,您必須定義事件處理程序

private void pnlContainer_Scroll(object sender, ScrollEventArgs e)
{

}

然后你應該訂閱這個處理程序來控制你的控件的滾動事件。

this.pnlContainer.Scroll += new System.Windows.Forms.ScrollEventHandler(this.pnlContainer_Scroll);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM