コード例 #1
0
        private void pivotGridControl1_CustomDrawFieldValue(object sender, PivotCustomDrawFieldValueEventArgs e)
        {
            PivotFieldValueItem valueItem = GetItem(e);
            PivotSortOrder?     sortOrder = GetSummarySortOrder(valueItem);

            if (sortOrder == null)
            {
                return; // proceed to standard drawing
            }
            PivotGridViewInfoData data = ((IPivotGridViewInfoDataOwner)pivotGridControl1).DataViewInfo;

            e.Info.InnerElements.Clear();
            data.ActiveLookAndFeel.Painter.Header.DrawObject(e.Info);
            SortedShapeObjectInfoArgs sortInfo = new SortedShapeObjectInfoArgs();

            sortInfo.Ascending = sortOrder == PivotSortOrder.Ascending;
            sortInfo.Graphics  = e.Graphics;
            Rectangle sortBounds = data.ActiveLookAndFeel.Painter.SortedShape.CalcObjectMinBounds(sortInfo);

            sortBounds.X    = e.Info.CaptionRect.Right + 2;
            sortBounds.Y    = e.Info.CaptionRect.Y + (int)Math.Round((double)(e.Info.CaptionRect.Height - sortBounds.Height) / 2);
            sortInfo.Bounds = sortBounds;
            data.ActiveLookAndFeel.Painter.SortedShape.DrawObject(sortInfo);
            e.Handled = true;
        }
コード例 #2
0
 void targetPivot_CustomDrawFieldValue(object sender, PivotCustomDrawFieldValueEventArgs e)
 {
     if (onDrag)
     {
         //if (e.ValueType != PivotGridValueType.Value) return;
         //if(e.Field ==)
         if (e.Field == dragInfo.ValueInfo.Field && e.Bounds.Contains(dragInfo.HitPoint))
         {
             e.Painter.DrawObject(e.Info);
             e.Handled = true;
             Rectangle rec = e.Info.CaptionRect;
             e.Graphics.DrawRectangle(Pens.Blue, rec);
             return;
         }
         if (TargetInfo != null && e.Field == TargetInfo.ValueInfo.Field && e.Bounds.Contains(TargetInfo.HitPoint))
         {
             e.Painter.DrawObject(e.Info);
             e.Handled = true;
             Rectangle rec = e.Info.CaptionRect;
             e.Graphics.DrawRectangle(Pens.Green, rec);
             return;
         }
     }
     //throw new NotImplementedException();
 }
 void pivotGridControl1_CustomDrawFieldValue(object sender, PivotCustomDrawFieldValueEventArgs e)
 {
     if (e.Area == PivotArea.ColumnArea)
     {
         e.Graphics.FillRectangle(Brushes.White, e.Bounds);
         e.Handled = true;
     }
 }
コード例 #4
0
        PivotFieldValueItem GetItem(PivotCustomDrawFieldValueEventArgs e)
        {
            if (viewInfoPI == null)
            {
                viewInfoPI = e.GetType().GetProperty("FieldCellViewInfo", BindingFlags.Instance | BindingFlags.NonPublic);
            }
            PivotFieldsAreaCellViewInfo viewInfo = (PivotFieldsAreaCellViewInfo)viewInfoPI.GetValue(e, null);

            return(viewInfo.Item);
        }
コード例 #5
0
 private void pivotGridControl1_CustomDrawFieldValue(object sender, PivotCustomDrawFieldValueEventArgs e)
 {
     if (e.Area == PivotArea.ColumnArea)
     {
         e.Appearance.BackColor = Color.GreenYellow;
     }
     else if (e.Area == PivotArea.RowArea)
     {
         e.Painter.DrawObject(e.Info);
         e.Painter.DrawIndicator(e.Info);
         e.GraphicsCache.FillRectangle(e.GraphicsCache.GetSolidBrush(Color.FromArgb(50, 0, 0, 200)), e.Bounds);
         e.Handled = true;
     }
 }
コード例 #6
0
 /// <summary>
 /// Benutzerdefinierte Anzeigetexte in Spaltenköpfen/Zeilenselektoren für Wahrheitswerte und leere Werte
 /// </summary>
 private void OnCustomDrawFieldValue(object sender, PivotCustomDrawFieldValueEventArgs e)
 {
     if (!this.IsAsyncInProgress)
     {
         if (e.Field != null && e.ValueType == PivotGridValueType.Value)
         {
             if (e.Field.DataType == typeof(bool) || e.Field.DataType == typeof(bool?))
             {
                 e.Info.Caption = ((bool?)e.Value == true) ? "Ja" : ((bool?)e.Value == false) ? "Nein" : "n/a";
             }
             if (e.Value == null && String.IsNullOrEmpty(e.Info.Caption))
             {
                 e.Info.Caption = "n/a";
             }
         }
     }
 }
コード例 #7
0
 private void pvt_datos2_CustomDrawFieldValue(object sender, PivotCustomDrawFieldValueEventArgs e)
 {
     //if (e.Area == DevExpress.XtraPivotGrid.PivotArea.ColumnArea)
     //{
     //    Rectangle rect = e.Bounds;
     //    ControlPaint.DrawBorder3D(e.Graphics, e.Bounds);
     //    Brush brush = e.GraphicsCache.GetSolidBrush(Color.LightYellow);
     //    rect.Inflate(-1, -1);
     //    e.Graphics.FillRectangle(brush, rect);
     //    e.Appearance.DrawString(e.GraphicsCache, e.Info.Caption, e.Info.CaptionRect);
     //    e.Painter.DrawIndicator(e.Info);
     //    e.Handled = true;
     //}
     //else if (e.Area == DevExpress.XtraPivotGrid.PivotArea.RowArea)
     //{
     //    e.Painter.DrawObject(e.Info);
     //    e.Painter.DrawIndicator(e.Info);
     //    e.Graphics.FillRectangle(e.GraphicsCache.GetSolidBrush(Color.FromArgb(50, 0, 0, 200)), e.Bounds);
     //    e.Handled = true;
     //}
 }
コード例 #8
0
/// <summary>
/// Draw conditional formatting field value headers with appropriate background color
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>

        private void Grid_CustomDrawFieldValue(object sender, PivotCustomDrawFieldValueEventArgs e)
        {
            string txt;
            PivotGridFieldContext fc = GetPivotGridFieldContext(e.Field);

            if (fc == null)
            {
                return;
            }
            ResultsField rfld = fc.ResultsField;

            if (rfld == null)
            {
                return;
            }

            //DebugLog.Message(rfld.QueryColumn.MetaColumn.Name);

            //if (rfld.QueryColumn.MetaColumn.Name == "ACTIVITY_BIN") rfld = rfld; // debug
            //if (e.DisplayText == "0") e = e; // debug

            CondFormat cf = rfld.QueryColumn.CondFormat;

            if (cf == null || cf.Rules.Count == 0)
            {
                return;
            }

            foreach (CondFormatRule rule in cf.Rules)
            {             // look for rule name that matches field value text
                if (Lex.Eq(rule.Name, e.DisplayText) || Lex.Eq(rule.Value, e.DisplayText))
                {
                    if (!Lex.IsNullOrEmpty(rule.Name))
                    {
                        txt = rule.Name;                                                    // display rule name if defined
                    }
                    else
                    {
                        txt = e.DisplayText;                      // otherwise display field value
                    }
                    Rectangle rect = e.Bounds;
                    ControlPaint.DrawBorder3D(e.Graphics, e.Bounds);
                    Brush brush =
                        e.GraphicsCache.GetSolidBrush(rule.BackColor1);
                    rect.Inflate(-1, -1);
                    e.Graphics.FillRectangle(brush, rect);
                    e.Appearance.DrawString(e.GraphicsCache, txt, e.Info.CaptionRect);
                    //e.Appearance.DrawString(e.GraphicsCache, e.Info.Caption, e.Info.CaptionRect);
                    foreach (DevExpress.Utils.Drawing.DrawElementInfo info in e.Info.InnerElements)
                    {
                        DevExpress.Utils.Drawing.ObjectPainter.DrawObject(e.GraphicsCache, info.ElementPainter,
                                                                          info.ElementInfo);
                    }
                    e.Handled = true;
                    return;

                    //e.Painter.DrawObject(e.Info); // change tone of skin
                    //e.Graphics.FillRectangle(e.GraphicsCache.GetSolidBrush(Color.FromArgb(50, 0, 0, 200)), e.Bounds);
                    //e.Handled = true;
                }
            }

            return;
        }
コード例 #9
0
        private void pgWorkplaceList_CustomDrawFieldValue(object sender, PivotCustomDrawFieldValueEventArgs e)
        {
            if (e.Field == fieldTemplateName)
            {
                DevExpress.Utils.Drawing.HeaderObjectPainter newPainter = e.Painter;


                string c = e.Info.Caption;

                e.Info.Caption = "";
                newPainter.DrawObject(e.Info);

                e.Graphics.SmoothingMode     = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;

                if (IsColumnHeaderHorizontal(e.Field))
                {
                    //New Font(CType(sender, XRTableCell).Font, FontStyle.Bold)
                    Font newFont = new Font(e.Appearance.Font, FontStyle.Bold);  //Font(e.Appearance.Font.FontFamily,  10);
                    e.Appearance.Font = newFont;

                    StringFormat fmt = new StringFormat();
                    fmt.Alignment    = StringAlignment.Far;
                    fmt.Trimming     = StringTrimming.EllipsisCharacter;
                    fmt.FormatFlags |= StringFormatFlags.NoWrap;

                    e.GraphicsCache.DrawString(c, e.Appearance.Font,
                                               e.Appearance.GetForeBrush(e.GraphicsCache),
                                               e.Info.CaptionRect, fmt);
                }
                else
                {
                    Rectangle newRect = new Rectangle();
                    newRect = e.Bounds;
                    //  newRect.X += newRect.Width;
                    //    newRect.Y += 30;// newRect.Height;

                    //   newRect.Width *= 7;
                    //    newRect.Width /= 5;

                    //    newRect.Height *= 7;
                    //    newRect.Height /= 5;

                    //    newRect.Y -= 8;
                    //   newRect.Height -= 8;
                    newRect.Height = 130;
                    //    newRect.Width = 10;
                    StringFormat fmt = new StringFormat();
                    fmt.Alignment = StringAlignment.Near;
                    fmt.Trimming  = System.Drawing.StringTrimming.Word;
                    //fmt.Trimming = StringTrimming.EllipsisCharacter;
                    fmt.LineAlignment = System.Drawing.StringAlignment.Center;
                    fmt.FormatFlags   = StringFormatFlags.LineLimit;



                    e.GraphicsCache.DrawVString(c, e.Appearance.Font,
                                                e.Appearance.GetForeBrush(e.GraphicsCache),
                                                newRect, fmt, 270);
                }

                e.Info.InnerElements.DrawObjects(e.Info, e.Info.Cache, Point.Empty);
                e.Handled = true;
            }
        }