Exemplo n.º 1
0
 private void OnShowCellProperty(object sender, EventArgs e)
 {
     if ((this.countColumns == 0x4e) && (this.countRows == 100))
     {
         MessageBox.Show("必须先设置本页的有效区域和表中区域。\n请先选中有效区域,然后在模板的快捷菜单中点击“设为有效区域”命令。", "卡片模板", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else if ((this.midBegin == "AZ100") && (this.midBegin == "AZ100"))
     {
         MessageBox.Show("必须先设置本页的有效区域和表中区域。\n请先选中表中区域,然后在模板的快捷菜单中点击“设为表中区域”命令。", "卡片模板", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else
     {
         string     cellValue = this.GetCellValue(this.curCell);
         PPCardArea head      = PPCardArea.Head;
         if ((sender == null) && (e == null))
         {
             head = PPCardArea.Mid;
         }
         bool isCAPP = ModelContext.MetaModel.IsCard(this.m_tp.TemplateType);
         this.SetOptionHasKeyOrSbuKey();
         DlgOption2 option = new DlgOption2(cellValue, head, this.readOnly, this.curCell, isCAPP, this.m_tp.TemplateType, this.m_tp);
         try {
             if (PPCConvert.Address2Row(this.curCell) > 1)
             {
                 option.BlurLabel = this.GetCellValueEx(PPCConvert.Address2Row(this.curCell) - 1, PPCConvert.Address2Col(this.curCell));
             }
             if ((option.BlurLabel == "") && (PPCConvert.Address2Row(this.curCell) > 2))
             {
                 option.BlurLabel = this.GetCellValueEx(PPCConvert.Address2Row(this.curCell) - 2, PPCConvert.Address2Col(this.curCell));
             }
             else if (((option.BlurLabel.Length > 0) && (option.BlurLabel[0] == '<')) && (PPCConvert.Address2Col(this.curCell) > 1))
             {
                 option.BlurLabel = this.GetCellValueEx(PPCConvert.Address2Row(this.curCell), PPCConvert.Address2Col(this.curCell) - 1);
             }
             if ((option.BlurLabel == "") && (PPCConvert.Address2Row(this.curCell) > 3))
             {
                 option.BlurLabel = this.GetCellValueEx(PPCConvert.Address2Row(this.curCell) - 3, PPCConvert.Address2Col(this.curCell));
             }
             else if (((option.BlurLabel.Length > 0) && (option.BlurLabel[0] == '<')) && (PPCConvert.Address2Col(this.curCell) > 1))
             {
                 option.BlurLabel = this.GetCellValueEx(PPCConvert.Address2Row(this.curCell), PPCConvert.Address2Col(this.curCell) - 1);
             }
             if ((option.BlurLabel == "") && (PPCConvert.Address2Row(this.curCell) > 4))
             {
                 option.BlurLabel = this.GetCellValueEx(PPCConvert.Address2Row(this.curCell) - 4, PPCConvert.Address2Col(this.curCell));
             }
             else if (((option.BlurLabel.Length > 0) && (option.BlurLabel[0] == '<')) && (PPCConvert.Address2Col(this.curCell) > 1))
             {
                 option.BlurLabel = this.GetCellValueEx(PPCConvert.Address2Row(this.curCell), PPCConvert.Address2Col(this.curCell) - 1);
             }
             if ((option.BlurLabel != "") && (option.BlurLabel[0] == '<'))
             {
                 option.BlurLabel = "";
             }
         } catch {
         }
         if (option.BlurLabel != null)
         {
             option.BlurLabel.Replace(" ", "");
         }
         option.Text = this.curCell + "单元格属性";
         if ((option.CCInit.AttributeName != "") || !this.readOnly)
         {
             try {
                 if (option.ShowDialog() == DialogResult.OK)
                 {
                     this.GetRange(this.curCell).Value = option.CardCell.Script.Trim();
                 }
             } catch (Exception exception) {
                 MessageBox.Show(exception.Message);
             }
         }
     }
 }
Exemplo n.º 2
0
 public DlgOption2(string script, PPCardArea area, bool readOnly, string address, bool isCAPP, string tmpType, CLCardTemplate tp)
 {
     this.address         = "";
     this.cobIndex        = -2;
     this.m_tp            = tp;
     this.IsPrintTemplate = !isCAPP;
     this.readOnly        = readOnly;
     this.area            = area;
     this.InitializeComponent();
     this.InitializeImageList();
     this.InitBarcodeTemplete();
     if (!readOnly)
     {
         this.CreateTypeTree(this.tvwType);
     }
     this.CCInit = ccFavorite;
     if (this.CCInit == null)
     {
         this.CCInit = new PPCardCell();
     }
     this.CCInit.Address       = address;
     this.address              = address;
     this.CCInit.IsKey         = false;
     this.CCInit.IsSubKey      = false;
     this.CCInit.AttributeName = "";
     if ((script != "") && (script.IndexOf("<") >= 0))
     {
         PPCardCompiler.ExplainXml(script, this.CCInit);
         this.area = this.CCInit.Area;
     }
     if ((this.CCInit.ClassName == "") && (this.area == PPCardArea.Head))
     {
         this.CCInit.ClassName = tmpType;
     }
     this.tbcData.SelectedTab = this.tabBinding;
     if (this.CCInit.IsKey)
     {
         this.chkKey.Enabled    = true;
         this.chkSubKey.Enabled = false;
     }
     else if (this.CCInit.IsSubKey)
     {
         this.chkKey.Enabled    = false;
         this.chkSubKey.Enabled = true;
     }
     else
     {
         this.chkKey.Enabled    = !HasKey;
         this.chkSubKey.Enabled = !HasSubKey;
     }
     if (this.area == PPCardArea.Mid)
     {
         this.rbtMid.Checked = true;
         this.CCInit.Area    = PPCardArea.Mid;
     }
     else
     {
         this.chkKey.Checked    = false;
         this.chkKey.Enabled    = false;
         this.chkSubKey.Checked = false;
         this.chkSubKey.Enabled = false;
         this.rbtMid.Checked    = false;
         this.CCInit.Area       = PPCardArea.Head;
     }
 }