private void FormBillTypeInput_Load(object sender, EventArgs e) { formBillType = (FormBillType)this.Owner; //将FormBillType窗体设置当前窗体的拥有者 if (this.Tag.ToString() == "Add") //判断是否为添加操作 { //自动生成单据编号 txtBillTypeCode.Text = cc.BuildCode("tb_BillType", "", "BillTypeCode", "", 2); } else { //显示单据编号 txtBillTypeCode.Text = formBillType.dgvBillType.CurrentRow.Cells["BillTypeCode"].Value.ToString(); //显示单据名称 txtBillTypeName.Text = formBillType.dgvBillType.CurrentRow.Cells["BillTypeName"].Value.ToString(); //显示单据宽度 txtBillWidth.Text = formBillType.dgvBillType.CurrentRow.Cells["BillWidth"].Value.ToString(); //显示单据高度 txtBillHeight.Text = formBillType.dgvBillType.CurrentRow.Cells["BillHeight"].Value.ToString(); //显示单号位数 txtBillCodeLength.Text = formBillType.dgvBillType.CurrentRow.Cells["BillCodeLength"].Value.ToString(); txtRemark.Text = formBillType.dgvBillType.CurrentRow.Cells["Remark"].Value.ToString(); //显示备注 //获取单据图片 pbxBillPicture.Image = cc.GetImageByBytes(formBillType.dgvBillType.CurrentRow.Cells["BillPicture"].Value as Byte[]); if (formBillType.dgvBillType.CurrentRow.Cells["IsEnabled"].Value.ToString() == "1") //判断单据是否启用的值 { rbIsEnabled1.Checked = true; //单据启用 } else { rbIsEnabled0.Checked = true;//单据未启用 } } }
private void FormBillTypeInput_Load(object sender, EventArgs e) { formBillType = (FormBillType)this.Owner; if (this.Tag.ToString() == "Add") { txtBillTypeCode.Text = cc.BuildCode("tb_BillType", "", "BillTypeCode", "", 2); } else { txtBillTypeCode.Text = formBillType.dgvBillType.CurrentRow.Cells["BillTypeCode"].Value.ToString(); txtBillTypeName.Text = formBillType.dgvBillType.CurrentRow.Cells["BillTypeName"].Value.ToString(); txtBillWidth.Text = formBillType.dgvBillType.CurrentRow.Cells["BillWidth"].Value.ToString(); txtBillHeight.Text = formBillType.dgvBillType.CurrentRow.Cells["BillHeight"].Value.ToString(); txtBillCodeLength.Text = formBillType.dgvBillType.CurrentRow.Cells["BillCodeLength"].Value.ToString(); txtRemark.Text = formBillType.dgvBillType.CurrentRow.Cells["Remark"].Value.ToString(); //获取图片 pbxBillPicture.Image = cc.GetImageByBytes(formBillType.dgvBillType.CurrentRow.Cells["BillPicture"].Value as Byte[]); if (formBillType.dgvBillType.CurrentRow.Cells["IsEnabled"].Value.ToString() == "1") { rbIsEnabled1.Checked = true; } else { rbIsEnabled0.Checked = true; } } }
private void FormSetTemplate_Load(object sender, EventArgs e) { //获取分辨率 fDpiX = this.CreateGraphics().DpiX; fDpiY = this.CreateGraphics().DpiY; formBillType = (FormBillType)this.Owner; dgvrBillType = formBillType.dgvBillType.CurrentRow; InitTemplate(dgvrBillType.Cells["BillTypeCode"].Value.ToString()); ////光标相对的原点是屏幕的左上角顶点;而控件相对的原点是所在窗体的左上角顶点 //offset = new Point(this.Location.X, this.Location.Y); ////引入图片 //Image img = cc.GetImageByBytes(dgvrBillType.Cells["BillPicture"].Value as byte[]); ////左上角顶点 //Point point = new Point(0, 0); ////新的大小 //SizeF newSize = new SizeF(MillimetersToPixel(Convert.ToInt32(dgvrBillType.Cells["BillWidth"].Value), fDpiX), MillimetersToPixel(Convert.ToInt32(dgvrBillType.Cells["BillHeight"].Value), fDpiY)); ////新的矩形 //RectangleF NewRect = new RectangleF(point, newSize); ////原始图形的参数 //SizeF oldSize = new SizeF(img.Width, img.Height); ////原始图形的大小 //RectangleF OldRect = new RectangleF(point, oldSize); ////缩放图形处理 //this.CreateGraphics().DrawImage(img, NewRect, OldRect, System.Drawing.GraphicsUnit.Pixel); ////若新图形的宽度或高度大于窗体的宽度或高度,窗体会自行调整 //if (newSize.Width > this.Width || newSize.Height > this.Height) //{ // Size size = new Size(Convert.ToInt32(MillimetersToPixel(Convert.ToInt32(dgvrBillType.Cells["BillWidth"].Value), fDpiX)), Convert.ToInt32(MillimetersToPixel(Convert.ToInt32(dgvrBillType.Cells["BillHeight"].Value), fDpiY))); // FormAutoResize(size); //} //MessageBox.Show("load"); }
private void FormSetTemplate_Load(object sender, EventArgs e) { //获取分辨率 fDpiX = this.CreateGraphics().DpiX; //获取水平分辨率 fDpiY = this.CreateGraphics().DpiY; //获取垂直分辨率 formBillType = (FormBillType)this.Owner; //获取拥有当前窗体的窗体 dgvrBillType = formBillType.dgvBillType.CurrentRow; //获取当前的快递单记录行 InitTemplate(dgvrBillType.Cells["BillTypeCode"].Value.ToString()); //动态创建文本输入框 }