Esempio n. 1
0
        private void GV_Main_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
        {
            if (e.Column == null)
            {
                return;
            }
            if (!KeyListBody.Contains(e.Column.FieldName) && !KeyListMain.Contains(e.Column.FieldName))
            {
                return;
            }
            Rectangle rect = new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height + 1);

            ControlPaint.DrawBorder3D(e.Graphics, e.Bounds);
            Brush brush =
                e.Cache.GetGradientBrush(rect, e.Column.AppearanceHeader.BackColor,
                                         e.Column.AppearanceHeader.BackColor2, e.Column.AppearanceHeader.GradientMode);

            rect.Inflate(-1, -1);
            // Fill column headers with the specified colors.
            e.Graphics.FillRectangle(brush, rect);
            e.Appearance.DrawString(e.Cache, e.Info.Caption, e.Info.CaptionRect);
            // Draw the filter and sort buttons.
            foreach (DevExpress.Utils.Drawing.DrawElementInfo info in e.Info.InnerElements)
            {
                if (!info.Visible)
                {
                    continue;
                }
                DevExpress.Utils.Drawing.ObjectPainter.DrawObject(e.Cache, info.ElementPainter,
                                                                  info.ElementInfo);
            }
            e.Handled = true;
        }
Esempio n. 2
0
 public virtual void BtnEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (FGridStatu == GridStatu.gsBrowse)
     {
         TabControlMain.SelectedTabPageIndex = 0;
         BtnNew.Enabled       = false;
         BtnQuery.Enabled     = false;
         BtnEdit.Enabled      = false;
         BtnDel.Enabled       = false;
         BtnFirst.Enabled     = false;
         BtnPrior.Enabled     = false;
         BtnNext.Enabled      = false;
         BtnLast.Enabled      = false;
         BtnSave.Enabled      = true;
         BtnCancel.Enabled    = true;
         btnAutoWidth.Enabled = false;
         for (int i = 0; i < MainControls.Count; i++)
         {
             if (KeyListMain.Contains(MainControls[i].Name))
             {
                 MainControls[i].Enabled = false;
                 continue;
             }
             MainControls[i].Properties.ReadOnly = false;
         }
         FGridStatu = GridStatu.gsEdit;
     }
 }
Esempio n. 3
0
 private bool CheckRequiredField()
 {
     /*if (RequiredFieldMain != "")
      * {
      *  string[] mTemp = RequiredFieldMain.Split(',');
      *  for (int i = 0; i < mTemp.Length; i++)
      *  {
      *      DevExpress.XtraEditors.BaseEdit edit = this.Controls.Find(mTemp[i], true).FirstOrDefault() as DevExpress.XtraEditors.BaseEdit;
      *      if (edit != null)
      *      {
      *          if (edit.Text == "")
      *          {
      *              Label lb = this.Controls.Find("LB" + mTemp[i], true).FirstOrDefault() as Label;
      *              MessageBox.Show(lb.Text + " 不可空白!", "錯誤");
      *              IsCheckRequired = false;
      *              return false;
      *          }
      *      }
      *  }
      * }
      * return true;*/
     for (int i = 0; i < MainControls.Count; i++)
     {
         if (KeyListMain.Contains(MainControls[i].Name) || RequiredListMain.Contains(MainControls[i].Name))
         {
             Label edit = this.Controls.Find("LB" + MainControls[i].Name, true).FirstOrDefault() as Label;
             if (MainControls[i].Text == "")
             {
                 MessageBox.Show(edit.Text + " 不可空白!!", "錯誤");
                 MainControls[i].Focus();
                 IsCheckRequired = false;
                 return(false);
             }
         }
     }
     return(true);
 }