本文整理汇总了C#中Xwt.Drawing.Context.Rectangle方法的典型用法代码示例。如果您正苦于以下问题:C# Context.Rectangle方法的具体用法?C# Context.Rectangle怎么用?C# Context.Rectangle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xwt.Drawing.Context
的用法示例。
在下文中一共展示了Context.Rectangle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnDraw
protected override void OnDraw(Context ctx, Rectangle dirtyRect)
{
// Line arround
ctx.SetColor(Colors.DarkGray);
// Drive line arround
ctx.Rectangle(Bounds);
ctx.Fill();
ctx.SetColor(Colors.Gray);
ctx.Rectangle(Bounds.Inflate(-margin, -margin));
ctx.Fill();
// Draw image
ctx.DrawImage(Image.FromResource(Logo), 5.0, 5.0);
// Draw text
ctx.SetColor(Colors.White);
TextLayout _layout = new TextLayout();
_layout.Font = Font.WithSize(22);
_layout.Text = Label;
_layout.SetFontWeight(FontWeight.Bold, 0, Label.Length);
// Cocoa layouts
ctx.DrawTextLayout(_layout, 45, ((Config.Cocoa || Config.Gtk) ? 5 : 2));
}
示例2: PatternsAndImages
public void PatternsAndImages (Context ctx, double x, double y)
{
ctx.Save ();
ctx.Translate (x, y);
ctx.SetColor (Colors.Black);
// Dashed lines
ctx.SetLineWidth (2);
ctx.SetLineDash (15, 10, 10, 5, 5);
ctx.Rectangle (10, 10, 100, 100);
ctx.Stroke ();
ctx.SetLineDash (0);
// Image
var arcColor = new Color (1, 0, 1);
ImageBuilder ib = new ImageBuilder (30, 30);
ib.Context.Arc (15, 15, 15, 0, 360);
ib.Context.SetColor (arcColor);
ib.Context.Fill ();
ib.Context.SetColor (Colors.DarkKhaki);
ib.Context.Rectangle (0, 0, 5, 5);
ib.Context.Fill ();
var img = ib.ToVectorImage ();
ctx.DrawImage (img, 0, 0);
ctx.DrawImage (img, 0, 50, 50, 10);
ctx.Arc (100, 100, 15, 0, 360);
arcColor.Alpha = 0.4;
ctx.SetColor (arcColor);
ctx.Fill ();
// ImagePattern
ctx.Save ();
ctx.Translate (x + 130, y);
ctx.Pattern = new ImagePattern (img);
ctx.Rectangle (0, 0, 100, 100);
ctx.Fill ();
ctx.Restore ();
ctx.Restore ();
// Setting pixels
ctx.SetLineWidth (1);
for (int i=0; i<50;i++) {
for (var j=0; j<50;j++) {
Color c = Color.FromHsl (0.5, (double)i / 50d, (double)j / 50d);
ctx.Rectangle (i, j, 1, 1);
ctx.SetColor (c);
ctx.Fill ();
}
}
}
示例3: OnDraw
protected override void OnDraw(Context ctx, Rectangle dirtyRect)
{
ctx.SetColor(new Color(0.5, 0.5, 0.5));
ctx.Rectangle(Bounds);
ctx.Fill();
ctx.SetColor(new Color(0.8, 0.8, 0.8));
ctx.Rectangle(Bounds.Inflate(-margin, -margin));
ctx.Fill();
ctx.SetColor(highlight ? Color.BlendWith(Xwt.Drawing.Colors.White, 0.5) : Color);
ctx.Rectangle(Bounds.Width / 2 - coreSize.Width / 2, Bounds.Height / 2 - coreSize.Height / 2, coreSize.Width, coreSize.Height);
ctx.Fill();
}
示例4: DrawBackground
protected internal override void DrawBackground(Context cr, Xwt.Rectangle area, DocumentLine line, int lineNumber, double x, double y, double height)
{
cr.Save();
cr.SetColor(Colors.LightGray);
cr.Rectangle(x, y, Width, height + 1);
cr.Fill();
cr.Restore();
}
示例5: OnDraw
protected override void OnDraw(Context ctx)
{
ctx.SetLineWidth (5);
ctx.SetColor (new Color (1.0f, 0f, 0.5f));
ctx.Rectangle (5, 5, 200, 100);
ctx.FillPreserve ();
ctx.SetColor (new Color (0f, 0f, 1f));
ctx.Stroke ();
}
示例6: OnDraw
protected override void OnDraw(Context ctx, Rectangle dirtyRect)
{
if (Window?.DrawRedDebugOutline ?? false)
{
ctx.SetColor(Colors.Blue);
ctx.Rectangle(0, 0, Bounds.Width, Bounds.Height);
ctx.Stroke();
ctx.SetColor(Colors.Black);
}
}
示例7: InitBlank
protected void InitBlank (int width = 50, int height = 50)
{
if (builder != null)
builder.Dispose ();
builder = new ImageBuilder (width, height);
context = builder.Context;
context.Rectangle (0, 0, width, height);
context.SetColor (Colors.White);
context.Fill ();
context.SetColor (Colors.Black);
context.SetLineWidth (1);
}
示例8: OnDraw
protected override void OnDraw(Context ctx, Rectangle cellArea)
{
var pct = GetValue (ValueField);
var size = (cellArea.Width * pct) / 100f;
cellArea.Width = (int) size;
ctx.SetLineWidth (1);
ctx.Rectangle (cellArea.Inflate (-0.5, -0.5));
ctx.SetColor (Colors.LightBlue);
ctx.FillPreserve ();
ctx.SetColor (Colors.Gray);
ctx.Stroke ();
}
示例9: OnDraw
protected override void OnDraw(Context ctx, Rectangle dirtyRect)
{
base.OnDraw(ctx, dirtyRect);
ctx.Save();
ctx.SetColor(editor.Options.Background);
ctx.Rectangle(dirtyRect);
ctx.Fill();
ctx.Restore();
UpdateMarginXOffsets();
RenderMargins(ctx, dirtyRect);
}
示例10: OnDraw
protected override void OnDraw (Context ctx, Rectangle dirtyRect)
{
base.OnDraw (ctx, dirtyRect);
ctx.Rectangle (0, 0, Size.Width, Size.Height);
ctx.SetColor (Colors.LightGray);
ctx.Fill ();
ctx.SetColor (Colors.Black);
using (var layout = new TextLayout (this))
{
layout.Text = text;
ctx.DrawTextLayout (layout, new Point (0, 20));
}
}
示例11: Draw
internal protected override void Draw (Context ctx, Rectangle area, long line, double x, double y)
{
ctx.Rectangle (x, y, Width, Editor.LineHeight);
ctx.SetColor (Style.HexOffsetBg);
ctx.Fill ();
if (line >= 0 && line * Editor.BytesInRow < Data.Length) {
LayoutWrapper layout = GetLayout (line);
var sz = layout.Layout.GetSize ();
ctx.SetColor (line != Caret.Line ? Style.HexOffset : Style.HexOffsetHighlighted);
ctx.DrawTextLayout (layout.Layout, x + Width - sz.Width - 4, y);
if (layout.IsUncached)
layout.Dispose ();
}
}
示例12: Draw
internal protected override void Draw (Context win, Rectangle area, long line, double x, double y)
{
win.Rectangle (x, y, Width, Editor.LineHeight);
win.SetColor (Style.IconBarBg);
win.Fill ();
win.MoveTo (x + Width - 1, y);
win.LineTo (x + Width - 1, y + Editor.LineHeight);
win.SetColor (Style.IconBarSeperator);
win.Stroke ();
foreach (long bookmark in Data.Bookmarks) {
if (line * Editor.BytesInRow <= bookmark && bookmark < line * Editor.BytesInRow + Editor.BytesInRow) {
DrawBookmark (win, x, y);
return;
}
}
}
示例13: OnDraw
protected override void OnDraw(Context ctx, Rectangle dirtyRect)
{
base.OnDraw(ctx, dirtyRect);
ctx.SetColor(Colors.Gray);
ctx.SetLineWidth(1);
ctx.RoundRectangle(0, Padding.Top / 2 - .5, Width - 4.5, Height - Padding.Bottom * 1.5, 3);
ctx.Stroke();
var tl = new TextLayout(this) { Text = title, Width = Width - Padding.Left - Padding.Right / 2 };
ctx.SetColor(Colors.White);
ctx.Rectangle(Padding.Left, 0, tl.GetSize().Width, Padding.Top);
ctx.Fill();
ctx.SetColor(Colors.Black);
ctx.DrawTextLayout(tl, Padding.Left, 0);
}
示例14: OnDraw
protected override void OnDraw (Context ctx, Rectangle dirtyRect)
{
if (colorBox == null) {
using (var ib = new ImageBuilder (size, size)) {
for (int i=0; i<size; i++) {
for (int j=0; j<size; j++) {
ib.Context.Rectangle (i, j, 1, 1);
ib.Context.SetColor (GetColor (i,j));
ib.Context.Fill ();
}
}
if (ParentWindow != null)
colorBox = ib.ToBitmap (this); // take screen scale factor into account
else
colorBox = ib.ToBitmap ();
}
}
ctx.DrawImage (colorBox, padding, padding);
ctx.SetLineWidth (1);
ctx.SetColor (Colors.Black);
ctx.Rectangle (selection.X + padding - 2 + 0.5, selection.Y + padding - 2 + 0.5, 4, 4);
ctx.Stroke ();
}
示例15: FillCellBackground
void FillCellBackground (Context ctx, Color color)
{
ctx.Rectangle (BackgroundBounds);
ctx.SetColor (color);
ctx.Fill ();
}