private void spreadsheetControl1_CustomDrawColumnHeader(object sender,
                                                                CustomDrawColumnHeaderEventArgs e)
        {
            // Cancel default painting for the column header.
            e.Handled = true;

            if (e.ColumnIndex > 4)
            {
                return;
            }

            // Specify the list of new column header names.
            string[] headers = new string[] { "Category", "Product Name",
                                              "Quantity per Unit", "Unit Price", "Units in Stock" };

            // Specify font attributes for the column header.
            SpreadsheetFont defaultFont = spreadsheetControl1.Document.Styles.DefaultStyle.Font;

            using (Font font = new Font(defaultFont.Name, (float)defaultFont.Size, FontStyle.Bold))
            {
                // Specify layout settings for the column header.
                using (StringFormat stringFormat = new StringFormat())
                {
                    stringFormat.LineAlignment = StringAlignment.Center;
                    stringFormat.Alignment     = e.ColumnIndex < 3 ? StringAlignment.Near : StringAlignment.Far;
                    stringFormat.Trimming      = StringTrimming.EllipsisCharacter;

                    // Draw the column header.
                    e.Graphics.DrawString(headers[e.ColumnIndex], font,
                                          e.Cache.GetSolidBrush(Color.White), e.Bounds, stringFormat);
                }
            }
        }
Example #2
0
        private void OnCustomDrawColumnHeader(object sender, CustomDrawColumnHeaderEventArgs e)
        {
            if (e.Column == null)
            {
                return;
            }

            ColumnInfo info = (ColumnInfo)e.ObjectArgs;

            for (int i = 0; i < info.InnerElements.Count; i++)
            {
                if (info.InnerElements[i].ElementInfo is GridFilterButtonInfoArgs)
                {
                    return;
                }
            }

            GridSmartSkinFilterButtonPainter painter          = new GridSmartSkinFilterButtonPainter(UserLookAndFeel.Default);
            GridFilterButtonInfoArgs         filterButtonInfo = new GridFilterButtonInfoArgs();

            filterButtonInfo.Cache    = e.Cache;
            filterButtonInfo.Graphics = e.Graphics;

            DrawElementInfo elementInfo = info.InnerElements.Add(painter, filterButtonInfo);

            elementInfo.RequireTotalBounds = true;
            info.InnerElements.CalcBounds(e.ObjectArgs, e.Cache, e.Painter.GetObjectClientRectangle(e.ObjectArgs), e.Bounds);

            Rectangle captionRect = e.CaptionRect;

            captionRect.Width -= elementInfo.ElementInfo.Bounds.Width;
            info.CaptionRect   = captionRect;
        }
 private void DrawQuickCustomisationIcon(CustomDrawColumnHeaderEventArgs e)
 {
     if (e.ColumnType != HitInfoType.ColumnButton)
     {
         return;
     }
     DrawQuickCustomisationIconCore(e, treeList.ViewInfo.QuickCustomisationIcon,
         treeList.ViewInfo.QuickCustomisationBounds);
 }
 private void DrawQuickCustomisationIcon(CustomDrawColumnHeaderEventArgs e)
 {
     if (e.ColumnType != HitInfoType.ColumnButton)
     {
         return;
     }
     DrawQuickCustomisationIconCore(e, treeList.ViewInfo.QuickCustomisationIcon,
                                    treeList.ViewInfo.QuickCustomisationBounds);
 }
Example #5
0
        private static void DrawTreeCustomizationMark(object sender, CustomDrawColumnHeaderEventArgs e)
        {
            var tree = sender as TreeList;

            if (tree != null && e.Column == null && e.ColumnType == HitInfoType.ColumnButton && tree.Columns.Count(c => !c.Visible && c.OptionsColumn.ShowInCustomizationForm) > 0)
            {
                e.DefaultDraw();
                DrawHiddenFieldsIcon(e.Graphics, e.Bounds);
                e.Handled = true;
            }
        }
Example #6
0
        void treeList_CustomDrawColumnHeader(object sender, CustomDrawColumnHeaderEventArgs e)
        {
            TreeListColumn nextColumn = GetNextColumn();

            if (nextColumn == null)
            {
                return;
            }
            if (e.Column == nextColumn)
            {
                e.Handled = true; return;
            }
            if (e.Column != columnToMerge)
            {
                return;
            }
            Rectangle r = e.ObjectArgs.Bounds;

            r.Width             = r.Width + nextColumn.VisibleWidth;
            e.ObjectArgs.Bounds = r;
        }
 public override void DrawColumn(CustomDrawColumnHeaderEventArgs e)
 {
     base.DrawColumn(e);
     DrawQuickCustomisationIcon(e);
 }
 public override void DrawColumn(CustomDrawColumnHeaderEventArgs e)
 {
     base.DrawColumn(e);
     DrawQuickCustomisationIcon(e);
 }