簡體   English   中英

自定義面板用戶控件上的布局事件

[英]Layout Event on a custom Panel User Control

我目前正在處理從面板繼承的自定義用戶控件,我試圖掛鈎面板的 Layout 事件以執行特定操作。 我不想覆蓋初始的 Layout 事件,我只想掛上它並添加要做的事情

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace SamsonLogiciel
{
    public partial class StretchPanel : Panel
    {
        public StretchPanel()
        {
            InitializeComponent();
        }
    }
}
protected override void OnLayout(LayoutEventArgs levent)
{
    // your code here
    base.OnLayout(levent);
}

只需將此添加到您的StretchPanel類。 您可以將自己的代碼添加到“掛鈎”中,然后調用base.OnLayout以免覆蓋默認內容。

暫無
暫無

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

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