[英]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.