本文整理汇总了C#中Gdk.DrawLine方法的典型用法代码示例。如果您正苦于以下问题:C# Gdk.DrawLine方法的具体用法?C# Gdk.DrawLine怎么用?C# Gdk.DrawLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdk
的用法示例。
在下文中一共展示了Gdk.DrawLine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawGrid
public static void DrawGrid(Gdk.Drawable wnd, int Size)
{
int Width, Height;
var gc = new Gdk.GC (wnd);
Gdk.Color line_color = new Gdk.Color (0, 255, 255);
gc.RgbFgColor = line_color;
wnd.GetSize (out Width, out Height);
for (int i = 0; i < Width; i += Size)
wnd.DrawLine (gc, i, 0, i, Height);
for (int i = 0; i < Height; i += Size)
wnd.DrawLine (gc, 0, i, Width, i);
}
示例2: 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;
}
}
}
示例3: Draw
public override void Draw(TextEditor editor, Gdk.Drawable win,Pango.Layout layout, bool selected, int startOffset, int endOffset, int y, int startXPos, int endXPos)
{
int markerStart = LineSegment.Offset + System.Math.Max (StartCol, 0);
int markerEnd = LineSegment.Offset + (EndCol < 0? LineSegment.Length : EndCol);
if (markerEnd < startOffset || markerStart > endOffset)
return;
int from;
int to;
if (markerStart < startOffset && endOffset < markerEnd) {
from = startXPos;
to = endXPos;
} else {
int start = startOffset < markerStart ? markerStart : startOffset;
int end = endOffset < markerEnd ? endOffset : markerEnd;
from = startXPos + editor.GetWidth (editor.Document.GetTextAt (startOffset, start - startOffset));
to = startXPos + editor.GetWidth (editor.Document.GetTextAt (startOffset, end - startOffset));
}
from = System.Math.Max (from, editor.TextViewMargin.XOffset);
to = System.Math.Max (to, editor.TextViewMargin.XOffset);
if (from >= to) {
return;
}
using (Gdk.GC gc = new Gdk.GC (win)) {
// gc.RgbFgColor = ColorName == null ? Color : editor.ColorStyle.GetColorFromDefinition (ColorName);
int drawY = y + editor.LineHeight - 1;
win.DrawLine (gc, from, drawY, to, drawY);
if(@from<to){
//gc.RgbFgColor = editor.ColorStyle.BracketHighlightRectangle.BackgroundColor;
//win.DrawRectangle (gc, true, @from + 1, y + 1, to - @from - 1, editor.LineHeight - 2);
gc.RgbFgColor = editor.ColorStyle.BracketHighlightRectangle.Color;
win.DrawRectangle (gc, false, @from, y, to - @from, editor.LineHeight - 1);
}
}
}
示例4: Draw_Style_Hue
// The following functions do the real work of the control, drawing the primary content (the area between the slider)
//
/// <summary>
/// Fills in the content of the control showing all values of Hue (from 0 to 360)
/// </summary>
private void Draw_Style_Hue(Gdk.Window g)
{
GraphUtil.HSL _hsl = new GraphUtil.HSL();
_hsl.S = 1.0; // S and L will both be at 100% for this DrawStyle
_hsl.L = 1.0;
for ( int i = 0; i < this.Allocation.Height - 8; i++ ) // i represents the current line of pixels we want to draw horizontally
{
_hsl.H = 1.0 - (double)i/(this.Allocation.Height - 8); // H (hue) is based on the current vertical position
Color c = GraphUtil.HSL_to_RGB(_hsl);
Gdk.GC gc = new Gdk.GC( g );
gc.RgbFgColor = GraphUtil.gdkColorFromWinForms( c );
g.DrawLine( gc, 11, i + 4, this.Allocation.Width - 11, i +4 );// Draw the line and loop back for next line
}
}
示例5: 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
}
示例6: DrawVerticalRuler
void DrawVerticalRuler(Gdk.Drawable g, System.Drawing.Rectangle lineRectangle)
{
if (TextEditorProperties.VerticalRulerRow < textArea.VirtualTop.X) {
return;
}
HighlightColor vRulerColor = textArea.Document.HighlightingStrategy.GetColorFor("VRulerColor");
int xpos = (int)MeasureString(FontContainer.DefaultFont, "12345678901234567890123456789012345678901234567890123456789012345678901234567890");
//int xpos = (int)(drawingPosition.Left + GetWidth(g, ' ') * (TextEditorProperties.VerticalRulerRow - textArea.VirtualTop.X));
using (Gdk.GC gc = new Gdk.GC(g)) {
gc.RgbFgColor = new Gdk.Color(vRulerColor.Color);
g.DrawLine(gc,
xpos,
lineRectangle.Top,
xpos,
lineRectangle.Bottom);
}
}
示例7: DrawFoldSegment
void DrawFoldSegment (Gdk.Drawable win, int x, int y, bool isOpen, bool isSelected)
{
Gdk.Rectangle drawArea = new Gdk.Rectangle (x + (Width - foldSegmentSize) / 2, y + (editor.LineHeight - foldSegmentSize) / 2, foldSegmentSize, foldSegmentSize);
win.DrawRectangle (foldBgGC, true, drawArea);
win.DrawRectangle (isSelected ? foldLineHighlightedGC : foldLineGC, false, drawArea);
win.DrawLine (foldToggleMarkerGC,
drawArea.Left + drawArea.Width * 3 / 10,
drawArea.Top + drawArea.Height / 2,
drawArea.Right - drawArea.Width * 3 / 10,
drawArea.Top + drawArea.Height / 2);
if (!isOpen)
win.DrawLine (foldToggleMarkerGC,
drawArea.Left + drawArea.Width / 2,
drawArea.Top + drawArea.Height * 3 / 10,
drawArea.Left + drawArea.Width / 2,
drawArea.Bottom - drawArea.Height * 3 / 10);
}
示例8: DrawCaret
public void DrawCaret (Gdk.Drawable win)
{
if (!this.textEditor.IsInDrag) {
if (!(this.caretX >= 0 && (!this.textEditor.IsSomethingSelected || this.textEditor.SelectionRange.Length == 0))) {
return;
}
}
if (Settings.Default.CursorBlink && (!Caret.IsVisible || !caretBlink)) {
return;
}
switch (Caret.Mode) {
case CaretMode.Insert:
win.DrawLine (caretGc, caretX, caretY, caretX, caretY + LineHeight - 1);
break;
case CaretMode.Block:
win.DrawRectangle (caretGc, true, new Gdk.Rectangle (caretX, caretY, this.charWidth, LineHeight));
/* textRenderer.BeginDraw (win);
// textRenderer.SetClip (clipRectangle);
textRenderer.Color = ColorStyle.Caret.BackgroundColor;
textRenderer.SetText (caretChar.ToString ());
textRenderer.DrawText (win, caretX, caretY);
textRenderer.EndDraw ();*/
break;
case CaretMode.Underscore:
int bottom = caretY + lineHeight;
win.DrawLine (caretGc, caretX, bottom, caretX + this.charWidth, bottom);
break;
}
}
示例9: Draw
internal protected override void Draw (Gdk.Drawable win, Gdk.Rectangle area, int line, int x, int y, int lineHeight)
{
win.DrawLine (UseBGColor ? bgGC : gc, x, y, x, y + lineHeight);
// int top = y;
// int bottom = top + lineHeight;
// bool isOdd = (top + (int)editor.VAdjustment.Value) % 2 != 0;
// win.DrawLine (isOdd? bgGC : bgGC2, x, top, x, bottom);
// win.DrawLine (isOdd? foldDashedLineGC : foldDashedLineGC2, x, top, x, bottom);
}
示例10: 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);
}
}
}}
}
示例11: DrawPower
// Redraw power samples for the exposed area.
void DrawPower(Gdk.Window win, Gdk.Rectangle rect)
{
SampleQueue data = debugManager.PowerData;
if (data == null)
return;
int[] slice = new int[rect.Width];
int len;
len = data.Fetch(rect.X * scale, slice, scale);
for (int i = 0; i < len; i++)
{
int x = rect.X + i;
int h = slice[i] * allocation.Height / vertMax;
win.DrawLine(gcBar, x, allocation.Height - 1 - h,
x, allocation.Height - 1);
}
}
示例12: DrawHorizontalGrid
// Redraw horizontal gridlines for the exposed area.
void DrawHorizontalGrid(Gdk.Window win, Gdk.Rectangle rect)
{
int x1 = rect.X;
int x2 = rect.X + rect.Width - 1;
// Align the horizontal region so the dotted pattern always
// appears continuous.
x1 -= x1 % dotsPeriod;
x2 += dotsPeriod - (x2 % dotsPeriod);
for (int i = 1; i < 10; i++) {
int y = allocation.Height * i / 10;
win.DrawLine(gcGrid, x1, y, x2, y);
}
}
示例13: drawCardFace
public void drawCardFace(Gdk.Window win, Gdk.GC outline, Gdk.GC fill, int x, int y, int w, int h)
{
int top = y, bottom = h+y, left = x, right = w+x, corner = 25;
int hcorner = (int)Math.Ceiling((double)corner/2); // half corner
/* Outline of Arcs */
win.DrawArc(outline, true, left-1, top-1, corner, corner, 90 * 64, 90 * 64);
win.DrawArc(outline, true, left-1, bottom-corner+1, corner, corner, 180 * 64, 90 * 64);
win.DrawArc(outline, true, right-corner+1, bottom-corner+1, corner, corner, 270 * 64, 90 * 64);
win.DrawArc(outline, true, right-corner+1, top-1, corner, corner, 360 * 64, 90 * 64);
/* Fill of Arcs */
win.DrawArc(fill, true, left, top, corner, corner, 90 * 64, 90 * 64);
win.DrawArc(fill, true, left, bottom-corner, corner, corner, 180 * 64, 90 * 64);
win.DrawArc(fill, true, right-corner, bottom-corner, corner, corner, 270 * 64, 90 * 64);
win.DrawArc(fill, true, right-corner, top, corner, corner, 360 * 64, 90 * 64);
/* Fill of Card */
win.DrawRectangle(fill, true, left+hcorner, top, right-left-corner, bottom-top);
win.DrawRectangle(fill, true, left, top+hcorner, right-left, bottom-top-corner);
/* Outline of Card */
win.DrawLine(outline, left+hcorner, top, right-hcorner, top);
win.DrawLine(outline, left+hcorner, bottom, right-hcorner, bottom);
win.DrawLine(outline, left, top+hcorner, left, bottom-hcorner);
win.DrawLine(outline, right, top+hcorner, right, bottom-hcorner);
}
示例14: Draw
internal protected override void Draw (Gdk.Drawable win, Gdk.Rectangle area, int line, int x, int y, int lineHeight)
{
Gdk.Rectangle drawArea = new Gdk.Rectangle (x, y, Width, lineHeight);
win.DrawRectangle (backgroundGC, true, drawArea);
win.DrawLine (separatorGC, x + Width - 1, drawArea.Top, x + Width - 1, drawArea.Bottom);
if (line < editor.Document.LineCount) {
LineSegment lineSegment = editor.Document.GetLine (line);
foreach (TextMarker marker in lineSegment.Markers) {
if (marker is IIconBarMarker)
((IIconBarMarker)marker).DrawIcon (editor, win, lineSegment, line, x, y, Width, editor.LineHeight);
}
if (DrawEvent != null)
DrawEvent (this, new BookmarkMarginDrawEventArgs (editor, win, lineSegment, line, x, y));
}
}
示例15: priv_DrawList
private static int priv_DrawList(Gdk.GC gc, Gdk.Drawable wnd, Node Root, int Padding, int Level, int Parent)
{
if (Root == null)
return Level;
int ret = Level;
wnd.DrawRectangle (gc, false, Padding * cellsize, Level * cellsize, nodesize, nodesize);
//FIXME: make node size configurable via UI, huh?
if (Parent != Level) {
wnd.DrawLine (gc, Padding * cellsize - 1, Level * cellsize + (nodesize >> 1), Padding * cellsize - 2, Level * cellsize + (nodesize >> 1));
wnd.DrawLine (gc, Padding * cellsize - 2, Level * cellsize + (nodesize >> 1), Padding * cellsize - 2, Parent * cellsize + (nodesize >> 1));
wnd.DrawLine (gc, Padding * cellsize - 4, Parent * cellsize + (nodesize >> 1), Padding * cellsize - 2, Parent * cellsize + (nodesize >> 1));
}
string msg = null;
switch (Root.sym) {
case 259:
msg = "INT";
break;
case 258:
msg = "RT";
break;
case 257:
msg = "NYT";
break;
case 256:
msg = "EOF";
break;
default:
char c = (char)Root.sym;
if (char.IsLetterOrDigit (c))
msg = c.ToString ();
else
msg = string.Format("{0:x}h", Root.sym);
break;
}
Pango.Context pango_ctx = PangoHelper.ContextGet ();
Pango.Layout pango_lay = new Pango.Layout (pango_ctx);
pango_lay.SetText (msg);
pango_lay.FontDescription = Pango.FontDescription.FromString ("monospace 9");
wnd.DrawLayout (gc, Padding * cellsize + 1, Level * cellsize + 1, pango_lay);
if (Root.right != null)
ret = priv_DrawList (gc, wnd, Root.right, Padding + 1, Level + 1, Level);
if (Root.left != null)
ret = priv_DrawList (gc, wnd, Root.left, Padding + 1, ret + 1, Level);
return ret;
}