Exemple #1
0
            protected override unsafe void OnRender(Cairo.Context cr, Gtk.Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gtk.CellRendererState flags)
            {
#if GTKCORE
                RenderNativeDelegate renderNativeDelegate = null;
                IntPtr *ptr = (IntPtr *)((long)LookupGType().GetThresholdType().GetClassPtr() + class_abi.GetFieldOffset("render"));
                if (*ptr != IntPtr.Zero)
                {
                    renderNativeDelegate = (RenderNativeDelegate)Marshal.GetDelegateForFunctionPointer(*ptr, typeof(RenderNativeDelegate));
                    if (renderNativeDelegate != null)
                    {
                        IntPtr intPtr  = GLib.Marshaller.StructureToPtrAlloc(background_area);
                        IntPtr intPtr2 = GLib.Marshaller.StructureToPtrAlloc(cell_area);
                        renderNativeDelegate(base.Handle, cr?.Handle ?? IntPtr.Zero, widget?.Handle ?? IntPtr.Zero, intPtr, intPtr2, (int)flags);
                        Marshal.FreeHGlobal(intPtr);
                        Marshal.FreeHGlobal(intPtr2);
                    }
                }
#endif

                if (editingRow == row)
                {
                    return;
                }
                using (var graphics = new Graphics(new GraphicsHandler(widget, cr)))
                {
                    var item = Handler.Source.GetItem(Row);
                    var args = new CellPaintEventArgs(graphics, cell_area.ToEto(), flags.ToEto(), item);
                    Handler.Callback.OnPaint(Handler.Widget, args);
                }
            }
Exemple #2
0
            protected override void Paint(sd.Graphics graphics, sd.Rectangle clipBounds, sd.Rectangle cellBounds, int rowIndex, swf.DataGridViewElementStates cellState, object value, object formattedValue, string errorText, swf.DataGridViewCellStyle cellStyle, swf.DataGridViewAdvancedBorderStyle advancedBorderStyle, swf.DataGridViewPaintParts paintParts)
            {
                // save graphics state to prevent artifacts in other paint operations in the grid
                var state = graphics.Save();

                if (!ReferenceEquals(cachedGraphicsKey, graphics) || cachedGraphics == null)
                {
                    cachedGraphicsKey = graphics;
                    cachedGraphics    = new Graphics(new GraphicsHandler(graphics, dispose: false));
                }
                else
                {
                    ((GraphicsHandler)cachedGraphics.Handler).SetInitialState();
                }
                graphics.PixelOffsetMode = sd.Drawing2D.PixelOffsetMode.Half;
                graphics.SetClip(cellBounds);
                var color = new sd.SolidBrush(cellState.HasFlag(swf.DataGridViewElementStates.Selected) ? cellStyle.SelectionBackColor : cellStyle.BackColor);

                graphics.FillRectangle(color, cellBounds);
                var args = new CellPaintEventArgs(cachedGraphics, cellBounds.ToEto(), cellState.ToEto(), value);

                Handler.Callback.OnPaint(Handler.Widget, args);
                graphics.ResetClip();
                graphics.Restore(state);
            }
Exemple #3
0
            protected override void OnPaint(CellPaintEventArgs args)
            {
                var item = (MyGridItem)args.Item;

                if (!args.IsEditing)
                {
                    args.Graphics.DrawText(SystemFonts.Default(), Colors.Black, args.ClipRectangle.Location, item.Text);
                }
                //args.Graphics.DrawLine(Colors.Blue, args.ClipRectangle.TopLeft, args.ClipRectangle.BottomRight);
            }
Exemple #4
0
 protected override void Render(Gdk.Drawable window, Gtk.Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, Gtk.CellRendererState flags)
 {
     if (editingRow == row)
     {
         return;
     }
     using (var graphics = new Graphics(new GraphicsHandler(widget, window)))
     {
         var item = Handler.Source.GetItem(Row);
         var args = new CellPaintEventArgs(graphics, cell_area.ToEto(), flags.ToEto(), item);
         Handler.Callback.OnPaint(Handler.Widget, args);
     }
 }
Exemple #5
0
        static void drawableCell_Paint(object sender, CellPaintEventArgs e)
        {
            var m = e.Item as TreeGridItem;

            if (m != null)
            {
                string text = (string)m.Values[0];
                var    rect = e.ClipRectangle;
                rect.Width--;
                rect.Height--;
                e.Graphics.DrawText(SystemFonts.Label(), Colors.Black, (float)0, (float)0, text != null ? text : string.Empty);
                e.Graphics.DrawLine(Colors.Blue, rect.TopLeft, rect.BottomRight);
                e.Graphics.DrawLine(Colors.Blue, rect.TopRight, rect.BottomLeft);
                e.Graphics.DrawRectangle(Colors.Green, rect);
            }
        }
Exemple #6
0
 public override void PaintCell(CellPaintEventArgs args)
 {
 }
Exemple #7
0
 public override void OnPaint(CellPaintEventArgs args)
 {
 }