本文整理汇总了C#中Gtk.Window.Move方法的典型用法代码示例。如果您正苦于以下问题:C# Gtk.Window.Move方法的具体用法?C# Gtk.Window.Move怎么用?C# Gtk.Window.Move使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Window
的用法示例。
在下文中一共展示了Gtk.Window.Move方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NativeWindowFrameHasCorrectScreenBounds
public void NativeWindowFrameHasCorrectScreenBounds ()
{
var nativeWindow = new Gtk.Window ("Foo");
nativeWindow.Resize (450, 320);
nativeWindow.Move (13, 50);
nativeWindow.ShowAll ();
WaitForEvents ();
var window = Toolkit.CurrentEngine.WrapWindow (nativeWindow);
var bounds = window.ScreenBounds;
Assert.AreEqual (450, bounds.Width);
Assert.AreEqual (320, bounds.Height);
Assert.AreEqual (13, bounds.X);
Assert.AreEqual (50, bounds.Y);
nativeWindow.Move (30, 100);
WaitForEvents ();
bounds = window.ScreenBounds;
Assert.AreEqual (30, bounds.X);
Assert.AreEqual (100, bounds.Y);
Assert.AreEqual (450, bounds.Width);
Assert.AreEqual (320, bounds.Height);
nativeWindow.Resize (100, 100);
WaitForEvents ();
bounds = window.ScreenBounds;
Assert.AreEqual (30, bounds.X);
Assert.AreEqual (100, bounds.Y);
Assert.AreEqual (100, bounds.Width);
Assert.AreEqual (100, bounds.Height);
}
示例2: TestReparenting_ShouldDrawALineInForm
public void TestReparenting_ShouldDrawALineInForm()
{
Gtk.Application.Init();
Form testForm = new Form();
testForm.Show();
Application.DoEvents();
var containerWindow = new Gtk.Window(Gtk.WindowType.Popup);
containerWindow.ShowNow();
containerWindow.Move(-5000, -5000);
while (Gtk.Application.EventsPending()) {
Gtk.Application.RunIteration(false);
}
var gdkWrapperOfForm = Gdk.Window.ForeignNewForDisplay(Gdk.Display.Default, (uint)testForm.Handle);
containerWindow.GdkWindow.Reparent(gdkWrapperOfForm, 0, 0);
Gdk.GC color = containerWindow.Style.DarkGC (Gtk.StateType.Normal);
containerWindow.GdkWindow.DrawLine(color, 0, 0, 100, 100);
while (Gtk.Application.EventsPending()) {
Gtk.Application.RunIteration(false);
}
Application.DoEvents();
}
示例3: Drag
// Drag function for automatic sources, called from DragBegin
static void Drag(Gtk.Widget source, Gdk.DragContext ctx, WidgetDropCallback dropCallback, Gtk.Widget dragWidget)
{
if (ctx == null)
return;
Gtk.Window dragWin;
Gtk.Requisition req;
ShowFaults ();
DND.dragWidget = dragWidget;
DND.dropCallback = dropCallback;
dragWin = new Gtk.Window (Gtk.WindowType.Popup);
dragWin.Add (dragWidget);
req = dragWidget.SizeRequest ();
if (req.Width < 20 && req.Height < 20)
dragWin.SetSizeRequest (20, 20);
else if (req.Width < 20)
dragWin.SetSizeRequest (20, -1);
else if (req.Height < 20)
dragWin.SetSizeRequest (-1, 20);
req = dragWin.SizeRequest ();
int px, py, rx, ry;
Gdk.ModifierType pmask;
ctx.SourceWindow.GetPointer (out px, out py, out pmask);
ctx.SourceWindow.GetRootOrigin (out rx, out ry);
dragWin.Move (rx + px, ry + py);
dragWin.Show ();
dragHotX = req.Width / 2;
dragHotY = -3;
Gtk.Drag.SetIconWidget (ctx, dragWin, dragHotX, dragHotY);
if (source != null) {
source.DragDataGet += DragDataGet;
source.DragEnd += DragEnded;
}
}