private void OnItemDraw( object sender, DrawItemEventArgs args ) { String text = cmb.List.Items[ args.ItemIndex ].ToString(); //take font from style Font font = new Font( Style.FontDesc.Family , Style.FontDesc.Size / 1000, FontStyle.Bold ); // take color from style Color c = Color.Blue; if( args.ItemIndex % 2 == 0 ) c = Color.Red; Brush b = new SolidBrush( c ); //set quality to HighSpeed args.Graphics.CompositingQuality = CompositingQuality.HighSpeed; args.Graphics.DrawString( text, font, b, args.CellArea.X, args.CellArea.Y ); args.Graphics.Dispose(); }
public virtual void OnDrawItem( int ItemIndex, TreeIter iter, Gdk.Drawable window, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags) { DrawItemEventArgs args = new DrawItemEventArgs( ItemIndex, iter, window, widget, background_area, cell_area, expose_area, flags ); // if( OwnerDraw && DrawItem != null ) { DrawItem( this, args ); } else { String text = getNodeFromIter( args.Iter ).Text; Pango.Layout l = new Pango.Layout( this.PangoContext ); l.SetText( text ); int width, height; l.GetPixelSize( out width, out height ); args.Drawable.DrawLayout( this.Style.TextGC( this.State ) , args.CellArea.X, args.CellArea.Y + (height/2), l ); } }
public virtual void OnDrawItem( DrawItemEventArgs args ) { //TODO: }
public virtual void OnDrawItem( int ItemIndex, Gdk.Drawable window, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags) { DrawItemEventArgs args = new DrawItemEventArgs( ItemIndex, window, widget, background_area, cell_area, expose_area, flags ); // if( OwnerDraw && DrawItem != null ) { DrawItem( this, args ); } else { String text = Items[ItemIndex].ToString(); //take font from style Font font = new Font( Style.FontDesc.Family , Style.FontDesc.Size / 1000 ); // take color from style Gdk.Color gcolor = Style.Foreground( StateType.Normal ); Color c = Color.FromArgb( gcolor.Red, gcolor.Green, gcolor.Blue ); Brush b = new SolidBrush( c ); //set quality to HighSpeed args.Graphics.CompositingQuality = CompositingQuality.HighSpeed; args.Graphics.DrawString( text, font, b, args.CellArea.X, args.CellArea.Y ); args.Graphics.Dispose(); } }
private void OnItemDrawn( object sender, DrawItemEventArgs args ) { //take the text String text = tree.getNodeFromIter( args.Iter ).Text; //take font from style Font font = new Font( "Courier New" , 14F ); // take color from style Color c = Color.DarkCyan; Brush b = new SolidBrush( c ); //set quality to HighSpeed args.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighSpeed; args.Graphics.DrawString( text, font, b, args.CellArea.X, args.CellArea.Y ); args.Graphics.Dispose(); }