private void DoPrint() { int[] selectedIndex = gridView1.GetSelectedRows(); if (selectedIndex.Length == 0) { MsgBox.Warn("请选中要打印的行。"); return; } if (MsgBox.AskOK("确定开始打印吗?") == DialogResult.OK) { List <ContainerEntity> containers = new List <ContainerEntity>(); foreach (int i in selectedIndex) { if (i >= 0) { containers.Add(gridView1.GetRow(i) as ContainerEntity); } } RepContianer repContianer = new RepContianer(containers, 1); repContianer.Print(); } }
private void OnItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { switch (e.Item.Tag.ToString()) { case "刷新": ReLoad(); break; case "新增": DoCreateBrands(); break; case "修改": ShowEditBrands(); break; case "删除": DoDeleteSelectedBrands(); break; case "打印": DoPrint(); break; case "设计": RibbonReportDesigner.MainForm designForm = new RibbonReportDesigner.MainForm(); RepContianer rep = new RepContianer(); try { designForm.OpenReport(rep, rep.RepFileName); designForm.ShowDialog(); designForm.Dispose(); } catch (Exception ex) { MsgBox.Err(ex.Message); } break; case "快速查找": if (gridView1.IsFindPanelVisible) { gridView1.HideFindPanel(); } else { gridView1.ShowFindPanel(); } break; case "重量维护": using (FrmContainerMaintain frmContainer = new FrmContainerMaintain()) { frmContainer.ShowDialog(); } this.ReLoad(); break; case "已删除容器": bindingSource1.DataSource = GetAllContainer(GlobeSettings.LoginedUser.WarehouseCode, "N"); break; case "恢复": this.DoRestoreContainer(); break; } }