Foxtable(狐表)用户栏目专家坐堂 → [求助]分区面板内控件布局问题


  共有5085人关注过本帖树形打印复制链接

主题:[求助]分区面板内控件布局问题

帅哥哟,离线,有人找我吗?
lsy
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:5246 积分:33163 威望:0 精华:8 注册:2013/1/17 21:28:00
  发帖心情 Post By:2013/6/5 14:42:00 [显示全部帖子]

两个SplitContainer的停靠都设为Fill

AfterLoad

 

Dim spl As WinForm.SplitContainer = e.Form.Controls("SplitContainer2")
Dim b As WinForm.Button = e.Form.Controls("Button1")
Dim t As WinForm.TextBox = e.Form.Controls("TextBox1")
spl.SplitterDistance = e.Form.Height/ 2
b.Top = (spl.Height/2 - b.Height)/2
t.Top = (spl.Height/2 - t.Height)/2
b.Left =  (spl.Width - b.Width)/2
t.Left =  (spl.Width - t.Width)/2

[此贴子已经被作者于2013-6-5 15:01:51编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
lsy
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:5246 积分:33163 威望:0 精华:8 注册:2013/1/17 21:28:00
  发帖心情 Post By:2013/6/5 15:56:00 [显示全部帖子]

Dim spl As WinForm.SplitContainer = e.Form.Controls("SplitContainer2")
Dim b As WinForm.Button = e.Form.Controls("Button1")
Dim t As WinForm.TextBox = e.Form.Controls("TextBox1")
spl.SplitterDistance = e.Form.Height/ 2
b.Top = (spl.SplitterDistance - b.Height)/2
t.Top = (spl.SplitterDistance - t.Height)/2
b.Left =  (spl.Width - b.Width)/2
t.Left =  (spl.Width - t.Width)/2

 

如果窗口是主窗口一类,设计大小与打开时的大小有区别,代码如下:

 

Dim spl As WinForm.SplitContainer = e.Form.Controls("SplitContainer2")
Dim b As WinForm.Button = e.Form.Controls("Button1")
Dim t As WinForm.TextBox = e.Form.Controls("TextBox1")
spl.SplitterDistance = WorkingAreaHeight*0.75/2
b.Top = (spl.SplitterDistance - b.Height)/2
t.Top = (spl.SplitterDistance - t.Height)/2
b.Left =  (spl.Width - b.Width)/2
t.Left =  (spl.Width - t.Width)/2

[此贴子已经被作者于2013-6-5 16:07:47编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
lsy
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:5246 积分:33163 威望:0 精华:8 注册:2013/1/17 21:28:00
  发帖心情 Post By:2013/6/5 16:22:00 [显示全部帖子]

以下是引用傻马难骑在2013-6-5 16:18:00的发言:

 

   越弄越复杂了,WorkingAreaHeight*0.75 这里为什么要 *0.75?

   SplitContainer2上下二半没能相同高度。

直接除以2,当然是一半,但是看起来不像各一半,*0.75以后,看起来像各一半,视觉差别,你要觉得/2感觉不错,那也行。

 


 回到顶部