本文整理汇总了C#中Gdk.GetPosition方法的典型用法代码示例。如果您正苦于以下问题:C# Gdk.GetPosition方法的具体用法?C# Gdk.GetPosition怎么用?C# Gdk.GetPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdk
的用法示例。
在下文中一共展示了Gdk.GetPosition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WindowPositionAndSize
Rectangle WindowPositionAndSize(Gdk.Window window)
{
int x,y,width,height;
window.GetPosition(out x, out y);
window.GetSize(out width, out height);
return new Rectangle(x,y,width,height);
}
示例2: DrawFocus
void DrawFocus(Gdk.Window window, Color c)
{
int x, y, width, height;
window.GetPosition(out x, out y);
window.GetSize(out width, out height);
System.Drawing.Rectangle r = new System.Drawing.Rectangle(x, y, width, height);
using (Cairo.Context context = Gdk.CairoHelper.Create(window))
{
uint b = mainBox.BorderWidth;
// Top
using (Cairo.Gradient gradient = createGradient(0.0, 0.0, 0, b, c))
{
context.SetSource(gradient);
context.MoveTo(0, 0);
context.LineTo(r.Width, 0);
context.LineTo(r.Width - b + 1, b);
context.LineTo(b - 1, b);
context.ClosePath();
context.Fill();
}
// Left
using (Cairo.Gradient gradient = createGradient(0.0, 0.0, b, 0, c))
{
context.SetSource(gradient);
context.MoveTo(0, 0);
context.LineTo(b, b - 1);
context.LineTo(b, r.Height - b + 1);
context.LineTo(0, r.Height);
context.ClosePath();
context.Fill();
}
// Bottom
using (Cairo.Gradient gradient = createGradient(0.0, r.Height, 0, r.Height - b, c))
{
context.SetSource(gradient);
context.MoveTo(0, r.Height);
context.LineTo(b - 1, r.Height - b);
context.LineTo(r.Width - b + 1, r.Height - b);
context.LineTo(r.Width, r.Height);
context.ClosePath();
context.Fill();
}
// Right
using (Cairo.Gradient gradient = createGradient(r.Width, 0, r.Width - b, 0, c))
{
context.SetSource(gradient);
context.MoveTo(r.Width, 0);
context.LineTo(r.Width - b, b - 1);
context.LineTo(r.Width - b, r.Height - b + 1);
context.LineTo(r.Width, r.Height);
context.ClosePath();
context.Fill();
}
}
}
示例3: GetRect
private static Gdk.Rectangle GetRect(Gdk.Window window)
{
Gdk.Rectangle rect = Gdk.Rectangle.Zero;
int vx, vy;
window.GetPosition(out vx, out vy);
rect.X = vx;
rect.Y = vy;
window.GetSize(out vx, out vy);
rect.Width = vx;
rect.Height = vy;
return rect;
}