本文整理汇总了C#中Xwt.Rectangle类的典型用法代码示例。如果您正苦于以下问题:C# Rectangle类的具体用法?C# Rectangle怎么用?C# Rectangle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Rectangle类属于Xwt命名空间,在下文中一共展示了Rectangle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: using
void ICanvasCellViewFrontend.Draw(object ctxBackend, Rectangle cellArea)
{
using (var ctx = new Context (ctxBackend, Toolkit.CurrentEngine)) {
ctx.Reset (null);
OnDraw (ctx, cellArea);
}
}
示例2: DrawAxisTests
private void DrawAxisTests(Context ctx, Rectangle bounds)
{
Rectangle boundingBox;
Point tl = Point.Zero;
Point br = Point.Zero;;
tl.X = bounds.Left + 30; tl.Y = bounds.Top + 20;
br.X = bounds.Right - 30; br.Y = bounds.Top + 20;
LogAxis log = new LogAxis (1, 10000);
log.Draw (ctx, tl, br, out boundingBox);
log.Reversed = true;
tl.Y += 50; br.Y += 50;
log.Draw (ctx, br, tl, out boundingBox);
// Test for default TicksAngle on positive X-axis, ie Ticks below X-axis
LogAxis lx = new LogAxis (100, 100000);
lx.NumberFormat = "{0:0.0E+0}";
tl.X = bounds.Left + 30; tl.Y = bounds.Bottom - 60;
br.X = bounds.Right - 30; br.Y = bounds.Bottom - 60;
lx.Draw (ctx, tl, br, out boundingBox);
}
示例3: OnDraw
protected override void OnDraw(Xwt.Drawing.Context ctx, Rectangle dirtyRect)
{
if (!Sensitive)
{
ctx.GlobalAlpha = .5d;
}
if (image == null)
{
ctx.SetColor(bg);
ctx.Rectangle(dirtyRect);
ctx.Fill();
}
else
ctx.DrawImage(image, new Rectangle(0, 0, WidthRequest, HeightRequest));
if (mOver && Sensitive)
{
ctx.SetColor(mOverColor);
ctx.Rectangle(dirtyRect);
ctx.Fill();
}
if (mDown)
{
ctx.SetColor(mOverColor);
ctx.Rectangle(dirtyRect);
ctx.Fill();
}
//ctx.SetColor(Colors.Red);
//ctx.Rectangle(0, 0, WidthRequest, HeightRequest);
//ctx.Stroke();
}
示例4: DrawAxisTests
private void DrawAxisTests(Context ctx, Rectangle bounds)
{
Rectangle boundingBox;
Point tl = Point.Zero;
Point br = Point.Zero;
tl.X = bounds.Left + 30; tl.Y = bounds.Top + 20;
br.X = bounds.Right - 30; br.Y = bounds.Top + 20;
DateTime timeMin = new DateTime (2003, 10, 22, 15, 00, 00);
DateTime timeMax = new DateTime (2004, 03, 12, 13, 30, 00);
TradingDateTimeAxis axis = new TradingDateTimeAxis ();
axis.WorldMin = (double)timeMin.Ticks;
axis.WorldMax = (double)timeMax.Ticks;
axis.Draw (ctx, tl, br, out boundingBox);
timeMin = new DateTime (2013, 09, 17, 12, 30, 10);
timeMax = new DateTime (2014, 01, 23, 12, 59, 30);
axis.WorldMin = (double)timeMin.Ticks;
axis.WorldMax = (double)timeMax.Ticks;
tl.Y += 50; br.Y += 50;
axis.Draw (ctx, tl, br, out boundingBox);
}
示例5: OnDraw
protected override void OnDraw (Context ctx, Rectangle dirtyRect)
{
Image image = new CustomImage ();
int x = 0;
for (int n=4; n < 50; n += 4) {
ctx.DrawImage (image.WithSize (n, n), x, 0);
x += n;
}
int maxSize = 48;
var warn = StockIcons.Error;
x = 0;
for (int n=8; n <= maxSize; n += 2) {
ctx.DrawImage (warn, x, 50, n, n);
x += n;
}
warn = StockIcons.Error.WithSize (maxSize).ToBitmap ();
x = 0;
for (int n=8; n <= maxSize; n += 2) {
ctx.DrawImage (warn, x, 100, n, n);
x += n;
}
ctx.DrawImage (image.WithSize (1000), new Rectangle (400, 0, 200, 1000), new Rectangle (0, 200, 200, 200));
ctx.DrawImage (image.WithSize (1000), new Rectangle (400, 0, 200, 50), new Rectangle (210, 200, 200, 200));
}
示例6: 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));
}
示例7: DrawAxisTests
private void DrawAxisTests(Context ctx, Rectangle bounds)
{
Rectangle boundingBox;
Point tl = Point.Zero;
Point br = Point.Zero;;
tl.X = bounds.Left + 30; tl.Y = bounds.Top + 10;
br.X = tl.X; br.Y = bounds.Bottom - 100;
LinearAxis a = new LinearAxis (0, 10);
a.Draw (ctx, tl, br, out boundingBox);
a.Reversed = true;
a.Draw (ctx, new Point (60,10), new Point (60, 200), out boundingBox);
a.SmallTickSize = 0;
a.Draw (ctx, new Point(90,10), new Point(90, 200), out boundingBox);
a.LargeTickStep = 2.5;
a.Draw (ctx, new Point(120,10), new Point(120,200), out boundingBox);
a.NumberOfSmallTicks = 5;
a.SmallTickSize = 2;
a.Draw (ctx, new Point(150,10), new Point(150,200), out boundingBox);
a.LineColor = Colors.DarkBlue;
a.Draw (ctx, new Point(180,10), new Point(180,200), out boundingBox);
a.TickTextColor= Colors.DarkBlue;
a.Draw (ctx, new Point(210,10), new Point(210,200), out boundingBox);
a.TickTextColor = Colors.Black;
a.Draw (ctx, new Point(240,10), new Point(300,200), out boundingBox);
a.WorldMax = 100000;
a.WorldMin = -3;
a.LargeTickStep = double.NaN;
a.Draw (ctx, new Point(330,10), new Point(330,200), out boundingBox);
a.NumberFormat = "{0:0.0E+0}";
a.Draw (ctx, new Point(380,10), new Point(380,200), out boundingBox);
// Test for default TicksAngle (+90) on positive X-axis, ie Ticks below X-axis
LinearAxis aX = new LinearAxis (0, 10);
tl.X = bounds.Left + 30; tl.Y = bounds.Bottom - 60;
br.X = bounds.Right - 20; br.Y = bounds.Bottom - 60;
aX.Draw (ctx, tl, br, out boundingBox);
// Set TicksAngle to -45 anti-clockwise from positive X-axis direction
aX.TicksAngle = Math.PI / 4.0;
tl.Y += 50; br.Y += 50;
aX.Draw (ctx, tl, br, out boundingBox);
}
示例8: OnDraw
protected override void OnDraw(Context ctx, Rectangle dirtyRect)
{
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 ();
}
示例9: OnDraw
/// <summary>
/// Handles OnDraw Events by drawing AxisTests to the canvas
/// </summary>
protected override void OnDraw(Context ctx, Rectangle dirtyRect)
{
// Get Canvas Bounds as region to draw into
Rectangle bounds = this.Bounds;
DrawAxisTests (ctx, bounds);
base.OnDraw (ctx, dirtyRect);
}
示例10: OnDraw
protected override void OnDraw (Context ctx, Rectangle dirtyRect)
{
var w = Math.Truncate (Bounds.Width / 2);
var h = Math.Truncate (Bounds.Height / 2);
ctx.DrawImage (img_ss, new Rectangle (0, 0, w, h).Inflate (-10, -10));
ctx.DrawImage (img_tt, new Rectangle (w, 0, w, h).Inflate (-10, -10));
ctx.DrawImage (img_st, new Rectangle (0, h, w, h).Inflate (-10, -10));
ctx.DrawImage (img_ts, new Rectangle (w, h, w, h).Inflate (-10, -10));
}
示例11: OnDrawOverlay
protected override void OnDrawOverlay(Context ctx, Rectangle dirtyArea)
{
// check if sufficiently inside Canvas
// only draw once inside focusRadius
if (lastCursor.X > focusRadius && lastCursor.X < Bounds.Right - focusRadius &&
lastCursor.Y > focusRadius && lastCursor.Y < Bounds.Bottom - focusRadius) {
DrawFocus (ctx, lastCursor);
}
}
示例12: OnDraw
protected override void OnDraw(Xwt.Drawing.Context ctx, Rectangle dirtyRect)
{
base.OnDraw(ctx, dirtyRect);
//ctx.SetColor(PluginType.GetColor());
ctx.SetLineDash(0, 4d, 4d);
ctx.Rectangle(0, 0, PluginWidget.Size.Width, PluginWidget.Size.Height);
ctx.Stroke();
}
示例13: OnDraw
protected override void OnDraw(Xwt.Drawing.Context ctx, Rectangle dirtyRect)
{
base.OnDraw(ctx, dirtyRect);
ctx.SetColor(Colors.DarkGray);
ctx.SetLineWidth(1);
ctx.MoveTo(0, 0);
ctx.LineTo(0, Bounds.Height);
ctx.Stroke();
}
示例14: OnDraw
protected override void OnDraw (Context ctx, Rectangle dirtyRect)
{
base.OnDraw (ctx, dirtyRect);
for (int y = 0; y < img.Size.Height / 50; ++y) {
for (int x = 0; x < img.Size.Width / 50; ++x) {
ctx.DrawImage (img, new Rectangle (x*50, y*50, 50, 50), new Rectangle (x*55, y*55, 50, 50));
}
}
}
示例15: 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);
}
}