使自定义控件居中于父容器的计算公式

frm.Top = (this.panelListView.Height - frm.Height) / 2;
frm.Left = (this.panelListView.Width - frm.Width) / 2;

设置两个值,top和left,公式:用父容器的长宽减去自定义控件的长宽然后除以二。

原文地址:https://www.cnblogs.com/llcdbk/p/4601490.html