请问如何让Panel控件中的控件或文本垂直居中??
谢谢!!

解决方案 »

  1.   

    如果你这是web程序的话,建议panel里面套个单行单列的表格width:100%;height:100%,然后在这个单元格里面放你的控件或者文本,通过设置单元格的valign来达到你要的效果。
    如果是winform那就只能用
    yourcontrol.left=(this.panel.width-yourcontrol.width)/2;
    yourcontrol.height=(this.panel.height-yourcontrol.height)/2;
    来定位控件,而定位文本就只能放个label控件上去然后用同样的办法来设置居中