public DlgPicture(string xml, bool readOnly) { this.InitializeComponent(); this.cmbPicType.Items.Add(PPCConvert.PicType2String(InterPicType.SourceFile)); this.cmbPicType.Items.Add(PPCConvert.PicType2String(InterPicType.ResourcePic)); this.chkGrayscale.Checked = PLSystemParam.GrayResPicWhenPrint; if (PPCardCompiler.ExplainInterPicXml(xml, this.info)) { this.cmbPicType.Enabled = false; this.cmbPicType.Text = PPCConvert.PicType2String(this.info.Type); this.cmbPicType.Enabled = true; if (this.info.FileIndex >= 0) { this.numFileIndex.Value = Convert.ToDecimal(this.info.FileIndex); } else { this.numFileIndex.Enabled = false; } this.txtCellStart.Text = this.info.CellStart; this.txtCellEnd.Text = this.info.CellEnd; this.chkGrayscale.Checked = this.info.Grayscale; } else { this.cmbPicType.SelectedIndex = 0; } if (readOnly) { this.panel1.Enabled = false; this.btnOk.Visible = false; this.btnCancel.Text = "确定"; } }
public DlgBarcode(string xml, string className, bool readOnly) { this.InitializeComponent(); ArrayList attris = new ArrayList(ModelContext.MetaModel.GetAllAttributes(className)); this.FilterAttributes(attris); if ((attris != null) && (attris.Count > 0)) { this.cmbAttrList.DataSource = attris; this.cmbAttrList.ValueMember = "Name"; this.cmbAttrList.DisplayMember = "Label"; } List <string> configNames = new PLBarCode().GetConfigNames(); for (int i = 0; i < configNames.Count; i++) { this.cmbTemplate.Items.Add(configNames[i]); } if (PPCardCompiler.ExplainInterPicXml(xml, this.info)) { this.cmbAttrList.SelectedValue = this.info.AttrName; if (this.cmbTemplate.Items.Contains(this.info.TemplateName)) { this.cmbTemplate.Text = this.info.TemplateName; } this.txtCellStart.Text = this.info.CellStart; this.txtCellEnd.Text = this.info.CellEnd; } else { this.cmbAttrList.SelectedIndex = 0; if (this.cmbTemplate.Items.Count > 0) { this.cmbTemplate.SelectedIndex = 0; } else { MessageBox.Show("还未定义条码模板,请先定义条码模板。", "工艺", MessageBoxButtons.OK); } } if (readOnly) { this.panel1.Enabled = false; this.btnOk.Visible = false; this.btnCancel.Text = "确定"; } }