本文整理汇总了C#中Gdk.DrawRectangle方法的典型用法代码示例。如果您正苦于以下问题:C# Gdk.DrawRectangle方法的具体用法?C# Gdk.DrawRectangle怎么用?C# Gdk.DrawRectangle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdk
的用法示例。
在下文中一共展示了Gdk.DrawRectangle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
public override void Render (Gdk.Drawable window, Gdk.Rectangle bounds, Gtk.StateType state)
{
Gdk.GC gc = new Gdk.GC (window);
gc.RgbFgColor = (Gdk.Color) Value;
window.DrawRectangle (gc, true, bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1);
window.DrawRectangle (Container.Style.BlackGC, false, bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1);
}
示例2: Render
public override void Render (Gdk.Drawable window, Gdk.Rectangle bounds, Gtk.StateType state)
{
Gdk.GC gc = new Gdk.GC (window);
gc.RgbFgColor = GetColor ();
int yd = (bounds.Height - ColorBoxSize) / 2;
window.DrawRectangle (gc, true, bounds.X, bounds.Y + yd, ColorBoxSize - 1, ColorBoxSize - 1);
window.DrawRectangle (Container.Style.BlackGC, false, bounds.X, bounds.Y + yd, ColorBoxSize - 1, ColorBoxSize - 1);
bounds.X += ColorBoxSize + ColorBoxSpacing;
bounds.Width -= ColorBoxSize + ColorBoxSpacing;
base.Render (window, bounds, state);
}
示例3: Render
public override void Render (Gdk.Drawable window, Cairo.Context ctx, Gdk.Rectangle bounds, Gtk.StateType state)
{
using (Gdk.GC gc = new Gdk.GC (window)) {
gc.RgbFgColor = GetColor ();
int yd = (bounds.Height - ColorBoxSize) / 2;
window.DrawRectangle (gc, true, bounds.X, bounds.Y + yd, ColorBoxSize - 1, ColorBoxSize - 1);
window.DrawRectangle (Container.GetNativeWidget<Gtk.Widget> ().Style.BlackGC, false, bounds.X, bounds.Y + yd, ColorBoxSize - 1, ColorBoxSize - 1);
bounds.X += ColorBoxSize + ColorBoxSpacing;
bounds.Width -= ColorBoxSize + ColorBoxSpacing;
base.Render (window, ctx, bounds, state);
}
}
示例4: Draw
internal protected override void Draw (Gdk.Drawable drawable, Gdk.Rectangle area, long line, int x, int y)
{
drawable.DrawRectangle (GetGC (Style.HexOffsetBg), true, x, y, Width, Editor.LineHeight);
LayoutWrapper layout = GetLayout (line);
int w, h;
layout.Layout.GetPixelSize (out w, out h);
drawable.DrawLayout (GetGC (line != Caret.Line ? Style.HexOffset : Style.HexOffsetHighlighted), x + Width - w - 4, y, layout.Layout);
if (layout.IsUncached)
layout.Dispose ();
}
示例5: Draw
internal protected override void Draw (Gdk.Drawable win, Gdk.Rectangle area, long line, int x, int y)
{
if (backgroundGC == null)
OptionsChanged ();
win.DrawRectangle (backgroundGC, true, x, y, Width, Editor.LineHeight);
win.DrawLine (separatorGC, x + Width - 1, y, x + Width - 1, y + Editor.LineHeight);
foreach (long bookmark in Data.Bookmarks) {
if (line * Editor.BytesInRow <= bookmark && bookmark < line * Editor.BytesInRow + Editor.BytesInRow) {
DrawBookmark (win, x, y);
return;
}
}
}
示例6: Render
public override void Render(Gdk.Drawable window, Gdk.Rectangle bounds, Gtk.StateType state)
{
int iy = bounds.Y + (bounds.Height - imgSize) / 2;
if (image != null) {
int dy = (imgSize - image.Height) / 2;
int dx = (imgSize - image.Width) / 2;
window.DrawPixbuf (Container.Style.BackgroundGC (state), image, 0, 0, bounds.X + dx, iy + dy, -1, -1, Gdk.RgbDither.None, 0, 0);
}
window.DrawRectangle (Container.Style.DarkGC (state), false, bounds.X, iy, imgSize - 1, imgSize - 1);
bounds.X += imgSize + spacing;
base.Render (window, bounds, state);
}
示例7: Render
protected override void Render(Gdk.Drawable window, Widget widget, Gdk.Rectangle background_area,
Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags)
{
int width = 0, height = 0, x_offset = 0, y_offset = 0;
GetSize (widget, ref cell_area, out x_offset, out y_offset, out width, out height);
width -= (int) this.Xpad * 2;
height -= (int) this.Ypad * 2;
Gdk.Rectangle clipping_area = new Gdk.Rectangle ((int) (cell_area.X + x_offset + this.Xpad),
(int) (cell_area.Y + y_offset + this.Ypad), width - 1, height - 1);
using (Gdk.GC gc = new Gdk.GC (window)) {
gc.RgbFgColor = ColorFromBrush (List.TypeBrushes [Idx]);
window.DrawRectangle (gc,
true,
clipping_area);
}
}
示例8: Paint
public override void Paint(Gdk.Drawable wnd, Rectangle rect)
{
HighlightColor lineNumberPainterColor = textArea.Document.HighlightingStrategy.GetColorFor("LineNumbers");
Gdk.Color rect_fg = TextArea.Style.White;
Gdk.Color text_fg = new Gdk.Color (lineNumberPainterColor.Color);
Gdk.Color text_bg = new Gdk.Color (lineNumberPainterColor.BackgroundColor);
using (Gdk.GC gc = new Gdk.GC (wnd)) {
gc.RgbFgColor = rect_fg;
wnd.DrawRectangle (gc, true, new System.Drawing.Rectangle (drawingPosition.X, rect.Top, drawingPosition.Width - 1, rect.Height));
//g.DrawLine(SystemPens.ControlDark, base.drawingPosition.Right - 1, rect.Top, base.drawingPosition.Right - 1, rect.Bottom);
// paint icons
foreach (int mark in textArea.Document.BookmarkManager.Marks) {
int lineNumber = textArea.Document.GetLogicalLine(mark);
int yPos = (int)(lineNumber * textArea.TextView.FontHeight) - textArea.VirtualTop.Y;
// if (yPos >= rect.Y && yPos <= rect.Bottom) {
DrawBookmark(gc, wnd, yPos);
// }
}
}
}
示例9: Draw
/// <summary>
/// Render an annotation on each line
/// </summary>
protected override void Draw (Gdk.Drawable drawable, Gdk.Rectangle area, int line, int x, int y, int lineHeight)
{
string ann = (line < annotations.Count)? annotations[line]: string.Empty;
Gdk.Rectangle drawArea = new Gdk.Rectangle (x, y, Width, lineHeight);
drawable.DrawRectangle (locallyModified.Equals (ann, StringComparison.Ordinal)? locallyModifiedGC: lineNumberBgGC, true, drawArea);
if (!locallyModified.Equals (ann, StringComparison.Ordinal) &&
(line < annotations.Count)) {
layout.SetText (annotations[line]);
drawable.DrawLayout ((editor.Caret.Line == line)? lineNumberHighlightGC: lineNumberGC, x + 1, y, layout);
}
}
示例10: ErasePaint
/*
*
* DRAWINGAREA
*
*/
public static void ErasePaint(Gtk.DrawingArea da, Gdk.Pixmap px)
{
px.DrawRectangle (da.Style.WhiteGC, true, 0, 0, da.Allocation.Width, da.Allocation.Height);
da.QueueDraw(); // -- refresh
}
示例11: Paint
public override void Paint(Gdk.Drawable wnd, System.Drawing.Rectangle rect)
{
int one_width = (int) textArea.TextView.GetWidth ('w');
using (Gdk.GC gc = new Gdk.GC (wnd)) {
using (Pango.Layout ly = new Pango.Layout (TextArea.PangoContext)) {
ly.FontDescription = FontContainer.DefaultFont;
ly.Width = drawingPosition.Width;
ly.Alignment = Pango.Alignment.Right;
HighlightColor lineNumberPainterColor = textArea.Document.HighlightingStrategy.GetColorFor("LineNumbers");
gc.RgbBgColor = new Gdk.Color (lineNumberPainterColor.BackgroundColor);
gc.RgbFgColor = TextArea.Style.White;
wnd.DrawRectangle (gc, true, drawingPosition);
gc.RgbFgColor = new Gdk.Color (lineNumberPainterColor.Color);
gc.SetLineAttributes (1, LineStyle.OnOffDash, CapStyle.NotLast, JoinStyle.Miter);
wnd.DrawLine (gc, drawingPosition.X + drawingPosition.Width, drawingPosition.Y, drawingPosition.X + drawingPosition.Width, drawingPosition.Height);
//FIXME: This doesnt allow different fonts and what not
int fontHeight = TextArea.TextView.FontHeight;
for (int y = 0; y < (DrawingPosition.Height + textArea.TextView.VisibleLineDrawingRemainder) / fontHeight + 1; ++y) {
int ypos = drawingPosition.Y + fontHeight * y - textArea.TextView.VisibleLineDrawingRemainder;
int curLine = y + textArea.TextView.FirstVisibleLine;
if (curLine < textArea.Document.TotalNumberOfLines) {
ly.SetText ((curLine + 1).ToString ());
wnd.DrawLayout (gc, drawingPosition.X + drawingPosition.Width - one_width, ypos, ly);
}
}
}}
}
示例12: DrawBorder
/// <summary>
/// Draws the border around the control, in this case the border around the content area between
/// the slider arrows.
/// </summary>
private void DrawBorder(Gdk.Window g)
{
// To make the control look like Adobe Photoshop's the border around the control will be a gray line
// on the top and left side, a white line on the bottom and right side, and a black rectangle (line)
// inside the gray/white rectangle
Gdk.GC gc = new Gdk.GC( g );
gc.RgbFgColor = GraphUtil.gdkColorFromWinForms(Color.FromArgb(172,168,153));
//The same gray color used by Photoshop
g.DrawLine(gc, this.Allocation.Width - 10, 2, 9, 2); // Draw top line
g.DrawLine(gc, 9, 2, 9, this.Allocation.Height - 4); // Draw left hand line
gc = new Gdk.GC( g );
gc.RgbFgColor = GraphUtil.gdkColorFromWinForms( Color.White );
g.DrawLine(gc, this.Allocation.Width - 9, 2, this.Allocation.Width - 9,this.Allocation.Height - 3); // Draw right hand line
g.DrawLine(gc, this.Allocation.Width - 9,this.Allocation.Height - 3, 9,this.Allocation.Height - 3); // Draw bottome line
gc = new Gdk.GC( g );
gc.RgbFgColor = GraphUtil.gdkColorFromWinForms( Color.Black );
g.DrawRectangle(gc, false, 10, 3, this.Allocation.Width - 20, this.Allocation.Height - 7); // Draw inner black rectangle
}
示例13: DrawMoveHint
private void DrawMoveHint(Gdk.Window window)
{
string letters = "abcdefgh";
string numbers = "87654321";
if (moveHint == null)
return;
for (int k = 0; k < moveHint.Length; k += 3)
{
int i = -1, j = -1;
i = letters.IndexOf (moveHint[k]);
j = numbers.IndexOf (moveHint[k + 1]);
if (i < 0 && j < 0)
continue;
if (side)
{
i = 7 - i;
j = 7 - j;
}
int x = start_x + i * (space + size);
int y = start_y + j * (space + size);
window.DrawRectangle (Style.
BackgroundGC
(StateType.Prelight),
true, x, y, size,
size);
}
}
示例14: RenderSelection
private void RenderSelection (Gdk.Drawable drawable, Gdk.Rectangle background_area,
bool selected, StateType state)
{
if (view == null) {
return;
}
if (selected && view.Cr != null) {
Gdk.Rectangle rect = background_area;
rect.X -= 2;
rect.Width += 4;
// clear the standard GTK selection and focus
drawable.DrawRectangle (view.Style.BaseGC (StateType.Normal), true, rect);
// draw the hot cairo selection
if (!view.EditingRow) {
view.Theme.DrawRowSelection (view.Cr, background_area.X + 1, background_area.Y + 1,
background_area.Width - 2, background_area.Height - 2);
}
} else if (!TreeIter.Zero.Equals (iter) && iter.Equals (view.HighlightedIter) && view.Cr != null) {
view.Theme.DrawRowSelection (view.Cr, background_area.X + 1, background_area.Y + 1,
background_area.Width - 2, background_area.Height - 2, false);
} else if (view.NotifyStage.ActorCount > 0 && view.Cr != null) {
if (!TreeIter.Zero.Equals (iter) && view.NotifyStage.Contains (iter)) {
Actor<TreeIter> actor = view.NotifyStage[iter];
Cairo.Color color = view.Theme.Colors.GetWidgetColor (GtkColorClass.Background, StateType.Active);
color.A = Math.Sin (actor.Percent * Math.PI);
view.Theme.DrawRowSelection (view.Cr, background_area.X + 1, background_area.Y + 1,
background_area.Width - 2, background_area.Height - 2, true, true, color);
}
}
}
示例15: Paint
public override void Paint(Gdk.Drawable wnd, System.Drawing.Rectangle rect)
{
HighlightColor lineNumberPainterColor = textArea.Document.HighlightingStrategy.GetColorFor("LineNumbers");
Gdk.Color rect_fg = TextArea.Style.White;
Gdk.Color text_fg = new Gdk.Color (lineNumberPainterColor.Color);
Gdk.Color text_bg = new Gdk.Color (lineNumberPainterColor.BackgroundColor);
using (Gdk.GC gc = new Gdk.GC(wnd)) {
for (int y = 0; y < (DrawingPosition.Height + textArea.TextView.VisibleLineDrawingRemainder) / textArea.TextView.FontHeight + 1; ++y) {
gc.RgbFgColor = rect_fg;
System.Drawing.Rectangle markerRectangle = new System.Drawing.Rectangle(DrawingPosition.X, DrawingPosition.Top + y * textArea.TextView.FontHeight - textArea.TextView.VisibleLineDrawingRemainder, DrawingPosition.Width, textArea.TextView.FontHeight);
if (rect.IntersectsWith(markerRectangle)) {
wnd.DrawRectangle (gc, true, new System.Drawing.Rectangle (markerRectangle.X + 1, markerRectangle.Y, markerRectangle.Width - 1, markerRectangle.Height));
int currentLine = textArea.TextView.FirstVisibleLine + y;
PaintFoldMarker(wnd, currentLine, markerRectangle);
} //Using
}
}
}