Ejemplo n.º 1
0
        private void OnCustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
        {
            //背景颜色没有设置且为空,则默认
            if (e.Column == null || (e.Column.AppearanceHeader.BackColor == Color.Empty && !e.Column.AppearanceHeader.Options.UseBackColor))
            {
                return;
            }
            Rectangle rect = e.Bounds;

            //rect.Inflate(-1, -1);

            // 填充标题颜色.
            e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(180, e.Column.AppearanceHeader.BackColor)), rect);
            e.Appearance.DrawString(e.Cache, e.Info.Caption, e.Info.CaptionRect);
            Pen pen = new Pen(Color.LightGray, 0.1f);

            e.Graphics.DrawRectangle(pen, rect);
            // 绘制过滤和排序按钮.
            foreach (DrawElementInfo info in e.Info.InnerElements)
            {
                if (!info.Visible)
                {
                    continue;
                }
                ObjectPainter.DrawObject(e.Cache, info.ElementPainter, info.ElementInfo);
            }
            e.Handled = true;
        }
Ejemplo n.º 2
0
        private void gridView1_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
        {
            if (e.Column == null)
            {
                return;
            }
            var rect = e.Bounds;

            ControlPaint.DrawBorder3D(e.Graphics, e.Bounds);
            var 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 (DrawElementInfo info in e.Info.InnerElements)
            {
                if (!info.Visible)
                {
                    continue;
                }
                ObjectPainter.DrawObject(e.Cache, info.ElementPainter,
                                         info.ElementInfo);
            }
            e.Handled = true;
        }
Ejemplo n.º 3
0
 void GridViewKeyboardController_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
 {
     if (e.Column == currentColumn)
     {
         e.Info.State = ObjectState.Hot;
     }
 }
        private void DrawCheckBox(ColumnHeaderCustomDrawEventArgs e)
        {
            int index = 0;

            CheckColumnTag(e.Column);
            ColumnStateRepository temp = (e.Column.Tag as ColumnStateRepository);
            int offset = temp.Checked == true ? 4 : 0;

            switch (temp.State)
            {
            case ObjectState.Normal:
                index = offset;
                break;

            case ObjectState.Hot:
                index = offset + 1;
                break;

            case ObjectState.Hot | ObjectState.Pressed:
                index = offset + 2;
                break;
            }
            Rectangle rect = CalcCheckBoxRectangle(e.Column);

            CheckImageCollections();
            CheckGlyphCollection();
            e.Cache.DrawImage(checkBoxCollection.Images[index], rect);
            if (!skipGlyph)
            {
                e.Cache.DrawImage(glyphCollection.Images[index], rect);
            }
        }
Ejemplo n.º 5
0
        private void gridView1_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
        {
            //if (e.Column == null) return;
            //Rectangle rect = e.Bounds;
            //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)
            //{
            //   try
            //   {
            //     DevExpress.Utils.Drawing.ObjectPainter.DrawObject(e.Cache, info.ElementPainter,info.ElementInfo);
            //   }
            //   catch(Exception exp)
            //   {
            //   }

            //}
            //e.Handled = true;
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Handles the CustomDrawColumnHeader event of the _gridView control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="ColumnHeaderCustomDrawEventArgs"/> instance containing the event data.</param>
 void _gridView_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
 {
     if (((e.Column is BandedGridColumn)) && (_gridBands.Contains((e.Column as BandedGridColumn).OwnerBand)))
     {
         e.Handled = true;
     }
 }
Ejemplo n.º 7
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;
        }
Ejemplo n.º 8
0
        void GridView_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
        {
            if (m_CheckBoxColumns == null || m_CheckBoxColumns.Count == 0)
            {
                return;
            }

            if (m_CheckBoxColumns.Contains(e.Column))
            {
                e.Info.InnerElements.Clear();
                e.Info.Appearance.ForeColor = Color.FromArgb(180, 180, 180);
                e.Painter.DrawObject(e.Info);
                CheckState state = CheckState.Checked;
                int        count = getCheckedCount(e.Column);

                Debug.WriteLine("### count: " + count);

                if (count == 0)
                {
                    state = CheckState.Unchecked;
                }
                else if (count != m_GridView.DataRowCount)
                {
                    state = CheckState.Indeterminate;
                }
                RepositoryItemCheckEdit checkEdit = m_DTColumn2CheckEdit[e.Column];
                DrawCheckBox(e.Graphics, e.Bounds, checkEdit, state);
                e.Handled = true;
            }
        }
Ejemplo n.º 9
0
 private void Tablo_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
 {
     if (e.Column != _column) return;
     e.Info.InnerElements.Clear();
     e.Painter.DrawObject(e.Info);
     CheckBoxEkle(e.Cache, e.Bounds, SelectedRowCount() == _tablo.DataRowCount);
     e.Handled = true;
 }
        private void gridView1_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
        {
            GridView view = sender as GridView;

            if (e.Column?.FieldName == view.FocusedColumn.FieldName)
            {
                e.Info.State = ObjectState.Hot;
            }
        }
Ejemplo n.º 11
0
        private void thermoTagGridView_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
        {
            if (e.Column == null) return;

            if (e.Column.AppearanceHeader.BackColor != Color.Empty)
            {
                e.Info.AllowColoring = true;
            }
        }
Ejemplo n.º 12
0
 void view_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
 {
     if (e.Column == _Column)
     {
         e.Info.Caption = string.Empty;
         e.Painter.DrawObject(e.Info);
         e.Handled = true;
         DrawEditorHelper.DrawColumnInplaceEditor(e, _Item, EditValue, GetRightIndent());
     }
 }
Ejemplo n.º 13
0
 void View_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
 {
     if (e.Column != null && e.Column.FieldName == checkColumnFieldName)
     {
         e.Info.InnerElements.Clear();
         e.Painter.DrawObject(e.Info);
         DrawCheckBox(e.Graphics, e.Bounds, SelectedCount == (sender as GridView).DataRowCount);
         e.Handled = true;
     }
 }
Ejemplo n.º 14
0
 void OnCustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
 {
     if (e.Column == null)
     {
         return;
     }
     DefaultDrawColumnHeader(e);
     DrawCustomButton(e);
     e.Handled = true;
 }
Ejemplo n.º 15
0
 void View_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
 {
     if (e.Column == column)
     {
         e.Info.InnerElements.Clear();
         e.Painter.DrawObject(e.Info);
         DrawCheckBox(e.Graphics, e.Bounds, SelectedCount == _view.DataRowCount);
         e.Handled = true;
     }
 }
Ejemplo n.º 16
0
 void View_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
 {
     if (e.Column != null && e.Column == column)
     {
         e.Info.InnerElements.Clear();
         e.Painter.DrawObject(e.Info);
         DrawCheckBox(e.Cache.Graphics, e.Bounds, AreAllRowsSelected());
         e.Handled = true;
     }
 }
 void OnViewCustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
 {
     if (dragColumns != null && dragColumns.Contains(e.Column))
     {
         e.Painter.DrawObject(e.Info);
         using (SolidBrush br = new SolidBrush(Color.FromArgb(170, DevExpress.LookAndFeel.LookAndFeelHelper.GetSystemColor(DevExpress.LookAndFeel.UserLookAndFeel.Default.ActiveLookAndFeel,
                                                                                                                           SystemColors.Control))))
             e.Cache.FillRectangle(br, e.Bounds);
         e.Handled = true;
     }
 }
Ejemplo n.º 18
0
 private void View_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
 {
     if (object.ReferenceEquals(e.Column, _CheckColumn))
     {
         e.Info.InnerElements.Clear();
         e.Painter.DrawObject(e.Info);
         bool gray = SelectedCount > 0 & SelectedCount < View.DataRowCount;
         DrawCheckBox(e.Graphics, e.Bounds, SelectedCount == View.DataRowCount, gray);
         e.Handled = true;
     }
 }
Ejemplo n.º 19
0
 private void gvSendMan_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
 {
     if (e.Column == (sender as GridView).Columns["Check"])
     {
         e.Info.InnerElements.Clear();
         e.Info.Appearance.ForeColor = Color.Blue;
         e.Painter.DrawObject(e.Info);
         DrawCheckBox(e.Graphics, e.Bounds, GetCheckedCount(gvReceiveMan) == gvReceiveMan.DataRowCount);
         e.Handled = true;
     }
 }
Ejemplo n.º 20
0
        private void RemoveSortGlyphIfNeccessary(ColumnHeaderCustomDrawEventArgs args)
        {
            DrawElementInfo elementInfo = FindSortGlyphElement(args.Info);

            if (elementInfo == null)
            {
                return;
            }
            args.Info.InnerElements.Remove(elementInfo);
            args.Painter.CalcObjectBounds(args.Info);
        }
Ejemplo n.º 21
0
        private void SetUpButtonInfoArgs(ColumnHeaderCustomDrawEventArgs e)
        {
            args.Cache  = e.Cache;
            args.Bounds = CalcButtonRect(e.Info, e.Cache.Graphics);
            ObjectState state = ObjectState.Normal;

            if (e.Column.Tag is ObjectState)
            {
                state = (ObjectState)e.Column.Tag;
            }
            args.State = state;
        }
Ejemplo n.º 22
0
 private void Tablo_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
 {
     if (e.Column != _column)
     {
         return;
     }
     e.Info.InnerElements.Clear();
     e.Painter.DrawObject(e.Info);
     CheckBoxEkle(e.Cache, e.Bounds, SelectedRowCount() == _tablo.DataRowCount);
     //Yaptığımız ayarlar dışınde birşey yapma demektir.
     e.Handled = true;
 }
Ejemplo n.º 23
0
 void gridView1_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
 {
     if (e.Column != null && e.Column.ColumnHandle > -1)
     {
         e.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
         e.Appearance.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Top;
         e.Info.InnerElements.Clear();
         e.Painter.DrawObject(e.Info);
         DrawCheckBox(e.Graphics, e.Bounds, columnsCheckBoxState[e.Column.ColumnHandle], true);
         e.Handled = true;
     }
 }
Ejemplo n.º 24
0
        private void View_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
        {
            if (e.Column == column)
            {
                e.Info.InnerElements.Clear();
                e.Painter.DrawObject(e.Info);
                DrawCheckBox(e.Graphics, e.Bounds, SelectedCount == view.DataRowCount);
                e.Appearance.TextOptions.WordWrap   = DevExpress.Utils.WordWrap.Wrap;
                e.Appearance.Options.UseTextOptions = true;

                e.Handled = true;
            }
        }
Ejemplo n.º 25
0
        private void GridViewCustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
        {
            GridView gridView;

            if ((gridView = sender as GridView) == null ||
                e.Column == null ||
                e.Column.FieldName != nameof(TestTable4Types.NonPersistentFString))
            {
                return;
            }

            System.Diagnostics.Debug.WriteLine(e.Column.FieldName);
        }
Ejemplo n.º 26
0
        private void gvDrawings_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
        {
            if (e.Column != null)
            {
                var checkRect = new Rectangle(e.Bounds.Left + 3, e.Bounds.Top + 3, 12, 12);
                var info = e.Info;
                info.CaptionRect = new Rectangle(new Point(info.Bounds.Left + 20, info.CaptionRect.Top),
                    info.CaptionRect.Size);
                e.Painter.DrawObject(info);

                DrawCheckBox(e.Graphics, checkEdit, checkRect, _checkedColumns.Any(x => x == e.Column));
                e.Handled = true;
            }
        }
        void OnCustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
        {
            if (e.Column == null)
            {
                return;
            }
            DefaultDrawColumnHeader(e);

            if (CanDrawCheckBox(e.Column))
            {
                DrawCheckBox(e);
            }

            e.Handled = true;
        }
 void View_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
 {
     if (e.Column != null)
     {
         var captionItem = CaptionItems.FirstOrDefault(x => x.FieldName == e.Column.FieldName);
         if (captionItem != null)
         {
             string bestCaption = GetBestCaption(e.Cache, e.Column, e.Info.CaptionRect.Width, captionItem);
             if (!string.IsNullOrEmpty(bestCaption))
             {
                 e.Info.Caption = bestCaption;
             }
         }
     }
 }
Ejemplo n.º 29
0
        private void GridView_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
        {
            if (!requiredMarkerVisible)
            {
                return;
            }

            if (requiredGridColumns.Contains(e.Column))
            {
                e.Painter.DrawObject(e.Info);

                var textSize = e.Info.Graphics.MeasureString(e.Info.Caption, e.Info.Appearance.Font);

                e.Graphics.DrawString(RequiredMarkerText, RequiredMarkerFont, Brushes.Red,
                                      e.Info.CaptionRect.X + Math.Max((e.Info.CaptionRect.Width - textSize.Width) / 2 - 8, 0),
                                      e.Info.CaptionRect.Y + (e.Info.CaptionRect.Height - textSize.Height) / 2);

                e.Handled = true;
            }
        }
Ejemplo n.º 30
0
        private void plotSeriesGridView_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
        {
            if (e.Column == null)
            {
                return;
            }

            if (e.Column.FieldName == "Checked")
            {
                Image image = (seriesChecked == true) ? imageList.Images[1] : imageList.Images[0];

                e.DefaultDraw();
                e.Cache.DrawImage(image,
                                  new Rectangle(e.Bounds.X + (e.Bounds.Width - image.Size.Width) / 2,
                                                e.Bounds.Y + (e.Bounds.Height - image.Size.Height) / 2 - 1,
                                                image.Size.Width, image.Size.Height));

                e.Handled = true;
            }
        }
Ejemplo n.º 31
0
 private void updateInnerElements(ColumnHeaderCustomDrawEventArgs e, bool restore, ref Rectangle sortBounds)
 {
     //Locate an element corresponding to the sort glyph
     foreach (DevExpress.Utils.Drawing.DrawElementInfo item in e.Info.InnerElements)
     {
         if (item.ElementPainter is DevExpress.Utils.Drawing.SortedShapeObjectPainter)
         {
             if (restore)
             {
                 //Restore the rectangle for the sort glyph
                 item.ElementInfo.Bounds = sortBounds;
             }
             else
             {
                 //Store the rectangle for the sort glyph in sortBounds and
                 //then clear this region in the e.Info object
                 sortBounds = item.ElementInfo.Bounds;
                 item.ElementInfo.Bounds = Rectangle.Empty;
             }
         }
     }
 }
Ejemplo n.º 32
0
 void View_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
 {
     if (e.Column != null && e.Column.FieldName == checkColumnFieldName)
     {
         e.Info.InnerElements.Clear();
         e.Painter.DrawObject(e.Info);
         DrawCheckBox(e.Graphics, e.Bounds, SelectedCount == (sender as GridView).DataRowCount);
         e.Handled = true;
     }
 }
Ejemplo n.º 33
0
 void gridView1_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
 {
     if (e.Column == (sender as GridView).Columns["UISelected"])
     {
         e.Info.InnerElements.Clear();
         e.Info.Appearance.ForeColor = Color.Blue;
         e.Painter.DrawObject(e.Info);
         DrawCheckBox(e.Graphics, e.Bounds, false);
         e.Handled = true;
     }
 }
Ejemplo n.º 34
0
 void View_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
 {
     if (e.Column == column)
     {
         e.Info.InnerElements.Clear();
         e.Painter.DrawObject(e.Info);
         DrawCheckBox(e.Graphics, e.Bounds, SelectedCount == _view.DataRowCount);
         e.Handled = true;
     }
 }
 private void DrawCustomButton(ColumnHeaderCustomDrawEventArgs e)
 {
     SetUpButtonInfoArgs(e);
     customButtonPainter.DrawObject(args);
 }
 void OnCustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
 {
     if(e.Column == null) return;
     DefaultDrawColumnHeader(e);
     DrawCustomButton(e);
     e.Handled = true;
 }
 private void SetUpButtonInfoArgs(ColumnHeaderCustomDrawEventArgs e)
 {
     args.Cache = e.Cache;
     args.Bounds = CalcButtonRect(e.Info, e.Graphics);
     ObjectState state = ObjectState.Normal;
     if(e.Column.Tag is ObjectState)
         state = (ObjectState)e.Column.Tag;
     args.State = state;
 }
 private static void DefaultDrawColumnHeader(ColumnHeaderCustomDrawEventArgs e)
 {
     e.Painter.DrawObject(e.Info);
 }
Ejemplo n.º 39
0
 private void gridView1_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
 {
     if (e.Column == null) return;
     var rect = e.Bounds;
     ControlPaint.DrawBorder3D(e.Graphics, e.Bounds);
     var 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 (DrawElementInfo info in e.Info.InnerElements)
     {
         if (!info.Visible) continue;
         ObjectPainter.DrawObject(e.Cache, info.ElementPainter,
             info.ElementInfo);
     }
     e.Handled = true;
 }
Ejemplo n.º 40
0
 void GridViewKeyboardController_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e) {
     if (e.Column == currentColumn) e.Info.State = ObjectState.Hot;
 }