本文整理汇总了C#中MainWindow.Add方法的典型用法代码示例。如果您正苦于以下问题:C# MainWindow.Add方法的具体用法?C# MainWindow.Add怎么用?C# MainWindow.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainWindow
的用法示例。
在下文中一共展示了MainWindow.Add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main(string[] args)
{
Application.Init ();
MainWindow win = new MainWindow ();
DrawingArea a = new DrawingArea ();
a.ButtonPressEvent += HandleAButtonPressEvent;
a.ButtonPressEvent += delegate(object o, ButtonPressEventArgs PressArgs) {
Console.WriteLine ("Button Pressed");
};
win.Add (a);
win.Show ();
Application.Run ();
}
示例2: Main
public static void Main(string[] args)
{
Application.Init ();
MainWindow win = new MainWindow ();
Gtk.Canvas canvas = new Gtk.Canvas ();
canvas.Engine.SetBackground (new Color (0.5, 0.5, 0.5));
win.Add (canvas);
BoxNode box = new BoxNode (new Color (1, 1, 1), 100, 100);
box.Draggable = true;
canvas.Root.Add (box);
PolygonNode poly = new PolygonNode (50, 50);
poly.Color = new Color (0, 0, 1);
poly.SetVerticies (new [] {
new Point (0, 1),
new Point (0, 0),
new Point (1, 0.5),
});
poly.Draggable = true;
canvas.Root.Add (poly);
LabelNode label = new LabelNode ("Label Node Test");
label.Color = new Color (1, 0, 0);
label.Draggable = true;
label.ClipInputToTextExtents = true;
canvas.Root.Add (label);
Random r = new Random ();
box.ActivatedEvent += (sender, e) => {
box.RotateTo (r.NextDouble () * 5);
};
ButtonNode button = new ButtonNode (new LabelNode ("Button"));
canvas.Root.Add (button);
button.MoveTo (300, 100);
win.SetSizeRequest (800, 200);
win.ShowAll ();
Application.Run ();
}
示例3: Main
public static void Main(string[] args)
{
configpath = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + "/";
Application.Init();
win = new MainWindow();
var eventbox = new EventBox();
//win.ExposeEvent += OnExposed;
var chars = "abcdefghijklmnopqrstuvwxyz0123456789"; //ABCDEFGHIJKLMNOPQRSTUVWXYZ
var stringChars = new char[ssnamelength];
var random = new Random();
for (int i = 0; i < stringChars.Length; i++)
{
stringChars[i] = chars[random.Next(chars.Length)];
}
finalString = new string(stringChars) + ".png";
win.Hide();
TakeScreenshot(configpath + finalString.Replace(".png", "_pre.png"));
win.Show();
win.Decorated = false;
img = new Gtk.Image(configpath + finalString.Replace(".png", "_pre.png"));
eventbox.ButtonPressEvent += (ButtonPressHandler);
eventbox.ButtonReleaseEvent += (ButtonReleaseHandler);
img.Xalign = 0.5f;
img.Yalign = 0.5f;
eventbox.Add(img);
eventbox.ShowAll();
win.Add(eventbox);
win.ShowAll();
win.Move(0, 0);
Application.Run();
}
示例4: Main
public static void Main (string[] args)
{
Application.Init ();
MainWindow win = new MainWindow ();
win.Resize (800, 200);
Canvas canvas = new Canvas ();
canvas.Realized += (sender, e) => {
SearchBoxCanvasElement searchBox = new SearchBoxCanvasElement ();
searchBox.WidthRequest = 790;
searchBox.X = 5;
searchBox.Y = 3;
canvas.AddElement (searchBox);
// PhysicsCanvasElement physics = new PhysicsCanvasElement ();
// physics.WidthRequest = 800;
// physics.HeightRequest = 800;
// canvas.AddElement (physics);
};
win.Add (canvas);
win.ShowAll ();
Application.Run ();
}