以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]控件叠加 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=139634) |
-- 作者:江南小镇 -- 发布时间:2019/8/17 17:15:00 -- [求助]控件叠加 老师,下面是动态生成的面板,我要把面板叠加在分区面板框中。 Dim txt As WinForm.Panel txt = e.Form.CreateControl("Panel1", ControlTypeEnum.Panel) txt.Height=300 txt.BackColor = Color.Red txt.BorderStyle = BorderStyle.Fixed3D txt.Dock = 2 e.Form.Controls("SplitContainer1") .Panel2.AddControl(txt) Dim txt4 As WinForm.Panel txt4 = e.Form.CreateControl("Panel2", ControlTypeEnum.Panel) txt4.Height=200 txt4.BackColor = Color.SlateGray txt4.BorderStyle = BorderStyle.Fixed3D txt4.Dock = 2 e.Form.Controls("SplitContainer1") .Panel2.AddControl(txt4) [此贴子已经被作者于2019/8/17 19:04:01编辑过]
|
-- 作者:有点蓝 -- 发布时间:2019/8/17 17:47:00 -- 没看懂是什么问题 |
-- 作者:江南小镇 -- 发布时间:2019/8/17 18:16:00 -- 老师,动态生成的两个控件不能叠加在一起总是一个在下一个在上。代码标出的属性控件多是靠下,我的意思是面板2覆盖面板1以此类推。 Dim txt As WinForm.Panel txt = e.Form.CreateControl("Panel1", ControlTypeEnum.Panel) txt.Height=300 txt.BackColor = Color.Red txt.BorderStyle = BorderStyle.Fixed3D txt.Dock = 2 e.Form.Controls("SplitContainer1") .Panel2.AddControl(txt) Dim txt4 As WinForm.Panel txt4 = e.Form.CreateControl("Panel2", ControlTypeEnum.Panel) txt4.Height=200 txt4.BackColor = Color.SlateGray txt4.BorderStyle = BorderStyle.Fixed3D txt4.Dock = 2 e.Form.Controls("SplitContainer1") .Panel2.AddControl(txt4) [此贴子已经被作者于2019/8/17 19:04:23编辑过]
|
-- 作者:有点蓝 -- 发布时间:2019/8/18 20:07:00 -- Dock 全部改为5 |
-- 作者:江南小镇 -- 发布时间:2019/8/18 21:47:00 -- 老师,按钮通过代码设置想要分配到动态生成面板的指定位置。下面代码不显示按钮。 Dim txt As WinForm.Panel txt = e.Form.CreateControl("Panel1", ControlTypeEnum.Panel) txt.BackColor = Color.RoyalBlue \'背景颜色 txt.BorderStyle = BorderStyle.Fixed3D \'边框样式 txt.Dock = 1 e.Form.Controls("SplitContainer1") .Panel2.AddControl(txt) For i As Integer = 2 To 6 Dim r3 As WinForm.Control = Forms("分区面板").Controls("Button" & i) r3.Top = 330 r3.left = 10 + 70 * (i-1) ‘txt.AddControl(r3) e.Form.Controls("Panel1").AddControl(r3) Next
|
-- 作者:有点蓝 -- 发布时间:2019/8/18 21:57:00 -- 超出范围了吧 r3.Top = 5 ,这样试试
|
-- 作者:江南小镇 -- 发布时间:2019/8/18 22:24:00 -- 老师,还是不行,按钮被调用了就是不显示。 |
-- 作者:有点蓝 -- 发布时间:2019/8/18 22:28:00 -- 上传实例说明 |
-- 作者:江南小镇 -- 发布时间:2019/8/18 22:35:00 -- 老师,好了是下面标出的数字设置错了。 r3.Top = 330
|
-- 作者:江南小镇 -- 发布时间:2019/8/18 22:50:00 -- 老师,下面代码有报错 Dim txt2 As WinForm.TabControl txt2 = e.Form.CreateControl("TabControl1", ControlTypeEnum.TabControl) txt2.SetBounds(10, 120, 100, 200) txt2.BackColor = Color.Red \'背景颜色 txt2.backcolor=Color.red e.Form.Controls("SplitContainer1") .Panel1.AddControl(txt2) Dim t As C1Command.C1DockingTab = e.Form.Controls("TabControl1").BaseControl t.ShowCaption = Not t.ShowCaption Dim txt2 As WinForm.TabControl txt2 = e.Form.CreateControl("管理按钮", ControlTypeEnum.TabControl) txt2.TabPages.Add("主页","主页") txt2.TabPages.Add("按钮集合","按钮集合") txt2.Left = 1 txt2.Top = 4 txt2.Width =200 \'控件长 txt2.Height=400 \'控件宽 txt2.Dock = 5 Dim c1tab As C1.Win.C1Command.C1DockingTab = txt2.basecontrol c1tab.VisualStyle = C1.Win.C1Command.VisualStyle.Custom c1tab.TabAreaBackColor = Color.SlateGray \'标题区域的背景色 c1tab.BackColor = Color.skyblue \'控件背景色 Dim pg As WinForm.TabPage = txt2.TabPages(0) pg.TabForeColorSelected= Color.blue \'选定项的标题颜色 pg.TabBackColor = Color.Red \'标题背景色 pg.TabBackColorSelected = Color.SeaGreen \'选定项的背景色 pg.BackColor = Color.DarkSeaGreen \'页面背景色 txt2 .BaseControl.font = new Font("微软雅黑",10,FontStyle.Regular) \'Bold) e.Form.Controls("SplitContainer1").Panel1.AddControl(txt2) |