本文整理汇总了C#中Window.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Window.Add方法的具体用法?C# Window.Add怎么用?C# Window.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Window
的用法示例。
在下文中一共展示了Window.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main(string[] args) {
Opts options = new Opts();
options.ProcessArgs(args);
if (options.RemainingArguments.Length < 2) {
options.DoHelp();
return;
}
Application.Init ();
Window win = new Window("NDiff");
win.DeleteEvent += new DeleteEventHandler(Window_Delete);
win.SetDefaultSize(800, 600);
DiffWidget.Options dopts = new DiffWidget.Options();
dopts.SideBySide = options.sidebyside;
if (options.RemainingArguments.Length == 2) {
dopts.LeftName = options.RemainingArguments[0];
dopts.RightName = options.RemainingArguments[1];
Diff diff = new Diff(options.RemainingArguments[0], options.RemainingArguments[1], options.caseinsensitive, true);
win.Add(new DiffWidget(diff, dopts));
} else {
Diff[] diffs = new Diff[options.RemainingArguments.Length-1];
for (int i = 0; i < options.RemainingArguments.Length-1; i++)
diffs[i] = new Diff(options.RemainingArguments[0], options.RemainingArguments[i+1], options.caseinsensitive, true);
Merge merge = new Merge(diffs);
win.Add(new DiffWidget(merge, dopts));
}
win.ShowAll();
Application.Run();
}
示例2: FilezooPanel
public FilezooPanel(Filezoo fz)
: base("Filezoo Panel")
{
Fz = fz;
Decorated = false;
Resizable = false;
SkipPagerHint = true;
SkipTaskbarHint = true;
FilezooWindow = new Window ("Filezoo");
Gdk.Colormap cm = FilezooWindow.Screen.RgbaColormap;
if (cm != null && FilezooWindow.Screen.IsComposited) {
Widget.DefaultColormap = cm;
FilezooWindow.Colormap = cm;
}
FilezooWindow.Decorated = false;
FilezooWindow.Add (Fz);
byte r, g, b;
r = (byte)(Fz.Renderer.BackgroundColor.R * 255);
g = (byte)(Fz.Renderer.BackgroundColor.G * 255);
b = (byte)(Fz.Renderer.BackgroundColor.B * 255);
FilezooWindow.ModifyBg (StateType.Normal, new Gdk.Color(r,g,b));
Controls = new FilezooPanelControls(Fz, FilezooWindow);
Add (Controls);
Stick ();
Fz.Width = 400;
Fz.Height = 1000;
}
示例3: Main9
public static int Main9 (string[] args)
{
Gtk.Application.Init ();
Window win = new Window ("Custom Widget Test");
win.DeleteEvent += new DeleteEventHandler (OnQuit);
VPaned paned = new VPaned ();
CustomWidget cw = new CustomWidget ();
cw.Label = "This one contains a button";
Button button = new Button ("Ordinary button");
cw.Add (button);
paned.Pack1 (cw, true, false);
cw = new CustomWidget ();
cw.Label = "And this one a TextView";
cw.StockId = Stock.JustifyLeft;
ScrolledWindow sw = new ScrolledWindow (null, null);
sw.ShadowType = ShadowType.In;
sw.HscrollbarPolicy = PolicyType.Automatic;
sw.VscrollbarPolicy = PolicyType.Automatic;
TextView textView = new TextView ();
sw.Add (textView);
cw.Add (sw);
paned.Pack2 (cw, true, false);
win.Add (paned);
win.ShowAll ();
Gtk.Application.Run ();
return 0;
}
示例4: Main
static int Main (string [] args)
{
HTML html;
Window win;
Application.Init ();
html = new HTML ();
win = new Window ("Test");
ScrolledWindow sw = new ScrolledWindow ();
win.Add (sw);
sw.Add (html);
HTMLStream s = html.Begin ("text/html");
if (args.Length > 0) {
using (StreamReader r = File.OpenText (args [0]))
s.Write (r.ReadToEnd ());
} else {
s.Write ("<html><body>");
s.Write ("Hello world!");
}
html.End (s, HTMLStreamStatus.Ok);
win.ShowAll ();
Application.Run ();
return 0;
}
示例5: Run
public void Run(string[] args)
{
Application.Init ();
PopulateStore ();
store.SetSortColumnId(2, SortType.Ascending);
Window win = new Window ("Gtk Widget Attributes");
win.DeleteEvent += new DeleteEventHandler (DeleteCB);
win.SetDefaultSize (640,480);
ScrolledWindow sw = new ScrolledWindow ();
win.Add (sw);
TreeView tv = new TreeView (store);
tv.HeadersVisible = true;
tv.AppendColumn ("Name", new CellRendererText (), "markup", 0);
tv.AppendColumn ("Type", new CellRendererText (), "text", 1);
foreach(TreeViewColumn col in tv.Columns)
col.Resizable = true;
tv.SearchColumn = 2;
sw.Add (tv);
dialog.Destroy ();
dialog = null;
win.ShowAll ();
Application.Run ();
}
示例6: Gui
// Constructor
public Gui()
{
Application.Init();
ioh = new IoHandler();
win = new Window("Drawing lines");
darea = new DrawingArea();
painter = new DrawShape(DrawLine);
listenOnMouse = false; // Við hlustum ekki á mús við núllstöðu.
// Aukum viðburðasett teikniborðs með ,möskum'.
darea.AddEvents(
(int)Gdk.EventMask.PointerMotionMask
| (int)Gdk.EventMask.ButtonPressMask
| (int)Gdk.EventMask.ButtonReleaseMask);
// Úthlutum virkni á viðburði.
win.Hidden += delegate {Application.Quit();};
win.KeyPressEvent += onKeyboardPressed;
darea.ExposeEvent += onDrawingAreaExposed;
darea.ButtonPressEvent += onMouseClicked;
darea.ButtonReleaseEvent += onMouseReleased;
darea.MotionNotifyEvent += onMouseMotion;
// Grunnstillum stærð glugga.
win.SetDefaultSize(500,500);
// Lokasamantekt til að virkja glugga.
win.Add(darea);
win.ShowAll();
Application.Run();
}
示例7: Main
public static void Main()
{
BusG.Init ();
Application.Init ();
Button btn = new Button ("Click me");
btn.Clicked += OnClick;
VBox vb = new VBox (false, 2);
vb.PackStart (btn, false, true, 0);
Window win = new Window ("D-Bus#");
win.SetDefaultSize (640, 480);
win.Add (vb);
win.Destroyed += delegate {Application.Quit ();};
win.ShowAll ();
bus = Bus.Session;
string bus_name = "org.ndesk.gtest";
ObjectPath path = new ObjectPath ("/org/ndesk/test");
if (bus.RequestName (bus_name) == RequestNameReply.PrimaryOwner) {
//create a new instance of the object to be exported
demo = new DemoObject ();
bus.Register (path, demo);
} else {
//import a remote to a local proxy
demo = bus.GetObject<DemoObject> (bus_name, path);
}
//run the main loop
Application.Run ();
}
示例8: Main
public static void Main()
{
BusG.Init ();
Application.Init ();
btn = new Button ("Click me");
btn.Clicked += OnClick;
VBox vb = new VBox (false, 2);
vb.PackStart (btn, false, true, 0);
Window win = new Window ("D-Bus#");
win.SetDefaultSize (640, 480);
win.Add (vb);
win.Destroyed += delegate {Application.Quit ();};
win.ShowAll ();
bus = Bus.Session;
string bus_name = "org.ndesk.gtest";
ObjectPath path = new ObjectPath ("/org/ndesk/btn");
if (bus.RequestName (bus_name) == RequestNameReply.PrimaryOwner) {
bus.Register (path, btn);
rbtn = btn;
} else {
rbtn = bus.GetObject<Button> (bus_name, path);
}
//run the main loop
Application.Run ();
}
示例9: Main
static void Main (string [] args)
{
Application.Init ();
if (args.Length <= 0) {
Console.WriteLine ("\nUSAGE: ImageBrowser.exe <directory>\n");
return;
}
string dir = args [0];
Window window = new Window ("Image Browser");
ScrolledWindow scroll = new ScrolledWindow ();//(new Adjustment (IntPtr.Zero), new Adjustment (IntPtr.Zero));
ArrayList images = GetItemsFromDirectory (dir);
Table table = PopulateTable (images);
window.Title = String.Format ("{0}: {1} ({2} images)", window.Title, dir, images.Count);
window.SetDefaultSize (300, 200);
//window.DeleteEvent += Window_Delete;
scroll.AddWithViewport (table);
//scroll.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
window.Add (scroll);
window.ShowAll ();
Application.Run ();
}
示例10: Main
public static void Main()
{
Application.Init();
//-- Crear el interfaz
Window w = new Window("Prueba");
Button b1 = new Button("Test 1");
Button b2 = new Button("Test 2");
HBox h= new HBox();
w.DeleteEvent += new DeleteEventHandler(Window_Delete);
b1.Clicked += new EventHandler(Button_Clicked);
b2.Clicked += new EventHandler(Button2_Clicked);
h.PackStart(b1,false,false,0);
h.PackStart(b2,false,false,0);
w.Add(h);
w.SetDefaultSize(100,100);
w.ShowAll();
//-- Inicializar chronopic
cp = new Chronopic("/dev/ttyUSB0");
//-- Inicializar otras cosas
Cola = new Queue();
//-- Inicializar temporizador
GLib.Timeout.Add(100, new GLib.TimeoutHandler(Time_Out));
Application.Run();
}
示例11: TreeViewDemo
public TreeViewDemo()
{
Application.Init ();
PopulateStore ();
Window win = new Window ("TreeView demo");
win.DeleteEvent += new DeleteEventHandler (DeleteCB);
win.SetDefaultSize (640,480);
ScrolledWindow sw = new ScrolledWindow ();
win.Add (sw);
TreeView tv = new TreeView (store);
tv.EnableSearch = true;
tv.HeadersVisible = true;
tv.HeadersClickable = true;
tv.AppendColumn ("Name", new CellRendererText (), "text", 0);
tv.AppendColumn ("Type", new CellRendererText (), "text", 1);
sw.Add (tv);
dialog.Destroy ();
dialog = null;
win.ShowAll ();
Application.Run ();
}
示例12: Main
public static void Main(string[] args)
{
Application.Init();
//Create the Window
Window myWin = new Window("GtkSpell# Sample App");
myWin.Resize(200,200);
//Create a TextView
TextView myTextView = new TextView();
SpellCheck mySpellCheck;
//Bind GtkSpell to our textview
if (args.Length > 0)
mySpellCheck = new SpellCheck(myTextView, args[0]);
else
mySpellCheck = new SpellCheck(myTextView, "en-us");
//spellCheck.Detach();
//spellCheck.();
//Add the TextView to the form
myWin.Add(myTextView);
//Show Everything
myWin.ShowAll();
myWin.DeleteEvent += new DeleteEventHandler(delete);
Application.Run();
}
示例13: Main
public static void Main()
{
BusG.Init ();
Application.Init ();
tv = new TextView ();
ScrolledWindow sw = new ScrolledWindow ();
sw.Add (tv);
Button btn = new Button ("Click me");
btn.Clicked += OnClick;
Button btnq = new Button ("Click me (thread)");
btnq.Clicked += OnClickQuit;
VBox vb = new VBox (false, 2);
vb.PackStart (sw, true, true, 0);
vb.PackStart (btn, false, true, 0);
vb.PackStart (btnq, false, true, 0);
Window win = new Window ("D-Bus#");
win.SetDefaultSize (640, 480);
win.Add (vb);
win.Destroyed += delegate {Application.Quit ();};
win.ShowAll ();
bus = Bus.Session.GetObject<IBus> ("org.freedesktop.DBus", new ObjectPath ("/org/freedesktop/DBus"));
Application.Run ();
}
示例14: Knockout
Knockout ()
{
Window win = new Window ("Cairo with Gtk#");
win.SetDefaultSize (400, 400);
win.DeleteEvent += new DeleteEventHandler (OnQuit);
win.Add (this);
win.ShowAll ();
}
示例15: Initialize
public override void Initialize() {
base.Initialize();
mDialog = new Window(WindowManager);
mDialog.Init();
mDialog.Width = mWidth;
mDialog.Height = mHeight;
mDialog.Text = mTitle;
mDialog.Visible = true;
mDialog.Resizable = false;
mDialog.Closed += new WindowClosedEventHandler(mDialog_Closed);
Label lbl = new Label(WindowManager);
lbl.Init();
lbl.Width = mDialog.ClientWidth - 10;
lbl.Height = mDialog.ClientHeight - 40;
lbl.Left = 5;
lbl.Top = 5;
lbl.Text = mMessage;
lbl.Alignment = EAlignment.TopCenter;
mDialog.Add(lbl);
Panel pnl = new Panel(WindowManager);
pnl.Height = 40;
pnl.Top = mDialog.ClientHeight - pnl.Height;
pnl.BevelBorder = EBevelBorder.Top;
pnl.BevelMargin = 1;
pnl.BackColor = new Color(16, 16, 16);
pnl.Anchor = EAnchors.Bottom | EAnchors.Horizontal;
pnl.Width = mDialog.ClientWidth;
mDialog.Add(pnl);
/*
* wont work oO
Button btnOK = new Button( WindowManager );
btnOK.Init();
//btnOK.Width = 20;
btnOK.Height = 24;
btnOK.Text = "OK";
btnOK.Click += new WindowLibrary.Controls.EventHandler( btnOK_Click );
pnl.Controls.Add( btnOK );
*/
AddWindow(mDialog);
}