以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]打印容器求助 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=68070) |
-- 作者:moxuejiahui -- 发布时间:2015/5/8 19:39:00 -- [求助]打印容器求助 我新建一窗口,加一TabControl1,在第二页签添加一SplitContainer1,在第二页签添加一面板,命名为“板材”,之后会动态添加多个面板。 现在想把板材内的其他控件打印出来要怎么写代码?能实现吗? |
-- 作者:Bin -- 发布时间:2015/5/9 9:02:00 -- 用专业报表吧 |
-- 作者:moxuejiahui -- 发布时间:2015/5/9 21:04:00 -- 这样代码生成的图案要怎么设置专业报表呢,并且是生成以后还会根据剩余区域继续生成,给个思路吧 Dim mc As WinForm.TextBox = e.Form.Controls("TextBox9") Dim mcs As String = mc.text For Each c As WinForm.Control In e.Form.Controls(""& mcs &"").children e.Form.removeControl(c.name) Next DataTables("临时").DeleteFor("[批次] = \'"& mcs &"\'") Dim bl As Double = 1220 / 345 Dim chang As WinForm.TextBox = e.Form.Controls("TextBox1") Dim kuan As WinForm.TextBox = e.Form.Controls("TextBox2") Dim hd As WinForm.TextBox = e.Form.Controls("TextBox3") Dim sd As WinForm.TextBox = e.Form.Controls("TextBox4") Dim sc As WinForm.TextBox = e.Form.Controls("TextBox6") Dim hc As WinForm.TextBox = e.Form.Controls("TextBox7") Dim jk As WinForm.TextBox = e.Form.Controls("TextBox8") Dim cf As WinForm.ComboBox = e.Form.Controls("ComboBox2") Dim x As Integer = jk.text If cf.text = "横裁" Then Dim i As Integer Dim y As Integer For y = 1 To sd.text For i = 1 To hd.text Dim x1 As Double = chang.text / bl Dim x2 As Double = kuan.text / bl Dim wzx As Double = (x + (i - 1) * (kuan.text + x)) / bl Dim wzy As Double = (x + (y - 1) * (chang.text + x)) / bl Dim xy As Integer = (y - 1) * hd.text + i Dim mcs1 As String = mcs & xy Dim Panel1 As WinForm.Panel Panel1 = e.Form.CreateControl(""& mcs1 &"", ControlTypeEnum.Panel) Panel1.SetBounds(wzx, wzy, x2, x1) e.Form.Controls(""& mcs &"").AddControl(Panel1) e.Form.Controls(""& mcs1 &"").BackColor = Color.Orangered Dim lbl As WinForm.Label lbl = e.Form.CreateControl(""& mcs1 &"", ControlTypeEnum.Label) Dim gg1 As String = chang.text & "*" & kuan.text lbl.Text = gg1 lbl.Left = x2 / 2 - 30 lbl.Top = x1 / 2 - 15 e.Form.Controls(""& mcs1 &"").AddControl(lbl) Next Dim sy As Double = hc.text - hd.text * kuan.text - (hd.text + 1) * x Dim xsy As Double = (x + (hd.text * (kuan.text + x))) / bl Dim ysy As Double = (x + (y - 1) * (chang.text + x)) / bl Dim x3 As Single Dim x4 As Single x3 = sy / bl x4 = chang.text / bl Dim xy1 As Single = hd.text * sd.text + y Dim mcs2 As String = mcs & xy1 Dim Panel2 As WinForm.Panel Panel2 = e.Form.CreateControl(""& mcs2 &"", ControlTypeEnum.Panel) Panel2.SetBounds(xsy, ysy, x3, x4) e.Form.Controls(""& mcs &"").AddControl(Panel2) e.Form.Controls(""& mcs2 &"").BackColor = Color.Orange Next Dim sy2 As Double = sc.text - sd.text * chang.text - (sd.text + 1) * x Dim xsy2 As Double = x / bl Dim ysy2 As Double = (x + sd.text * (chang.text + x)) / bl Dim x5 As Single Dim x6 As Single x5 = hc.text / bl x6 = sy2 / bl Dim xy2 As Single = hd.text * sd.text + sd.text + 1 Dim mcs3 As String = mcs & xy2 Dim Panel3 As WinForm.Panel Panel3 = e.Form.CreateControl(""& mcs3 &"", ControlTypeEnum.Panel) Panel3.SetBounds(xsy2, ysy2, x5, x6) e.Form.Controls(""& mcs &"").AddControl(Panel3) e.Form.Controls(""& mcs3 &"").BackColor = Color.Orange Else Dim i As Integer Dim y As Integer For i = 1 To hd.text For y = 1 To sd.text Dim x1 As Double = chang.text / bl Dim x2 As Double = kuan.text / bl Dim wzx As Double = (x + (i - 1) * (kuan.text + x)) / bl Dim wzy As Double = (x + (y - 1) * (chang.text + x)) / bl Dim xy As Integer = (y - 1) * hd.text + i Dim mcs1 As String = mcs & xy Dim Panel1 As WinForm.Panel Panel1 = e.Form.CreateControl(""& mcs1 &"", ControlTypeEnum.Panel) Panel1.SetBounds(wzx, wzy, x2, x1) e.Form.Controls(""& mcs &"").AddControl(Panel1) e.Form.Controls(""& mcs1 &"").BackColor = Color.Orangered Dim lbl As WinForm.Label lbl = e.Form.CreateControl(""& mcs1 &"", ControlTypeEnum.Label) Dim gg1 As String = chang.text & "*" & kuan.text lbl.Text = gg1 lbl.Left = x2 / 2 - 30 lbl.Top = x1 / 2 - 15 e.Form.Controls(""& mcs1 &"").AddControl(lbl) Next Dim sy As Double = sc.text - sd.text * chang.text - (sd.text + 1) * x Dim xsy As Double = (x + (i - 1) * (kuan.text + x)) / bl Dim ysy As Double = (x + sd.text * (chang.text + x)) / bl Dim x3 As Single Dim x4 As Single x3 = kuan.text / bl x4 = sy / bl Dim xy1 As Single = hd.text * sd.text + i Dim mcs2 As String = mcs & xy1 Dim Panel2 As WinForm.Panel Panel2 = e.Form.CreateControl(""& mcs2 &"", ControlTypeEnum.Panel) Panel2.SetBounds(xsy, ysy, x3, x4) e.Form.Controls(""& mcs &"").AddControl(Panel2) e.Form.Controls(""& mcs2 &"").BackColor = Color.Orange Next Dim sy2 As Double = hc.text - hd.text * kuan.text - (hd.text + 1) * x Dim xsy2 As Double = (x + hd.text * (kuan.text + x)) / bl Dim ysy2 As Double = x / bl Dim x5 As Single Dim x6 As Single x5 = sy2 / bl x6 = sc.text / bl Dim xy2 As Single = hd.text * sd.text + sd.text + 1 Dim mcs3 As String = mcs & xy2 Dim Panel3 As WinForm.Panel Panel3 = e.Form.CreateControl(""& mcs3 &"", ControlTypeEnum.Panel) Panel3.SetBounds(xsy2, ysy2, x5, x6) e.Form.Controls(""& mcs &"").AddControl(Panel3) e.Form.Controls(""& mcs3 &"").BackColor = Color.Orange End If Dim ggbh As WinForm.TextBox = e.Form.Controls("TextBox10") Dim nd As DataRow = DataTables("临时").addnew nd("规格编号") = ggbh.text nd("数量") = hd.text * sd.text nd("批次") = mcs
|
-- 作者:大红袍 -- 发布时间:2015/5/10 9:48:00 -- 循环窗口各个控件,循环容器各个控件,生成对应的专业报表的对象。 |