本文整理汇总了C#中Gtk.Window.SetSizeRequest方法的典型用法代码示例。如果您正苦于以下问题:C# Window.SetSizeRequest方法的具体用法?C# Window.SetSizeRequest怎么用?C# Window.SetSizeRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Window
的用法示例。
在下文中一共展示了Window.SetSizeRequest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
/// <summary>
/// Defines the entry point of the application.
/// </summary>
private static void Main()
{
Application.Init();
var window = new Window("GtkSharpDemo");
var plotModel = new PlotModel
{
Title = "Trigonometric functions",
Subtitle = "Example using the FunctionSeries",
PlotType = PlotType.Cartesian,
Background = OxyColors.White
};
plotModel.Series.Add(new FunctionSeries(Math.Sin, -10, 10, 0.1, "sin(x)") { Color = OxyColors.Black });
plotModel.Series.Add(new FunctionSeries(Math.Cos, -10, 10, 0.1, "cos(x)") { Color = OxyColors.Green });
plotModel.Series.Add(new FunctionSeries(t => 5 * Math.Cos(t), t => 5 * Math.Sin(t), 0, 2 * Math.PI, 0.1, "cos(t),sin(t)") { Color = OxyColors.Yellow });
var plotView = new OxyPlot.GtkSharp.PlotView { Model = plotModel };
plotView.SetSizeRequest(400, 400);
plotView.Visible = true;
window.SetSizeRequest(600, 600);
window.Add(plotView);
window.Focus = plotView;
window.Show();
window.DeleteEvent += (s, a) =>
{
Application.Quit();
a.RetVal = true;
};
Application.Run();
}
示例2: Run
public void Run(IGuiExternalInterface IGuiExternalInterface)
{
CommonGuiDisplayOpengl = new CommonGuiDisplayOpengl(IGuiExternalInterface, this);
CommonGuiInput = new CommonGuiInput(IGuiExternalInterface);
this.IGuiExternalInterface = IGuiExternalInterface;
//var Window = new Window("Hello world!");
Application.Init();
Window = new Window("Soywiz's Psp Emulator");
this.GLWidget = new GLWidget(OpenglGpuImpl.UsedGraphicsMode);
Window.WindowPosition = WindowPosition.Center;
Window.SetSizeRequest(480, 272);
Window.Child = GLWidget;
GLWidget.RenderFrame += GLWidget_RenderFrame;
GLWidget.SetSizeRequest(480, 272);
//GLWidget.ShowAll();
Window.Removed += Window_Removed;
Window.KeyPressEvent += Window_KeyPressEvent;
Window.KeysChanged += Window_KeysChanged;
Window.KeyReleaseEvent += Window_KeyReleaseEvent;
Window.ShowAll();
//GLWidget.KeyPressEvent += Window_KeyPressEvent;
//GLWidget.KeyReleaseEvent += Window_KeyReleaseEvent;
PspDisplay.DrawEvent += PspDisplay_DrawEvent;
OpenOpenDialog();
CommonGuiInput.ReLoadControllerConfig();
Application.Run();
}
示例3: Run
public void Run ()
{
var poof_file = DockServices.Paths.SystemDataFolder.GetChild ("poof.png");
if (!poof_file.Exists)
return;
poof = new Pixbuf (poof_file.Path);
window = new Gtk.Window (Gtk.WindowType.Toplevel);
window.AppPaintable = true;
window.Resizable = false;
window.KeepAbove = true;
window.CanFocus = false;
window.TypeHint = WindowTypeHint.Splashscreen;
window.SetCompositeColormap ();
window.Realized += delegate { window.GdkWindow.SetBackPixmap (null, false); };
window.SetSizeRequest (size, size);
window.ExposeEvent += HandleExposeEvent;
GLib.Timeout.Add (30, delegate {
if (AnimationState == 1) {
window.Hide ();
window.Destroy ();
poof.Dispose ();
return false;
} else {
window.QueueDraw ();
return true;
}
});
window.Move (x, y);
window.ShowAll ();
run_time = DateTime.UtcNow;
}
示例4: okButton_Clicked
void okButton_Clicked(object sender, EventArgs e)
{
if(width > max || height > max)
{
Window messageWindow = new Window("Info");
messageWindow.SetSizeRequest(250, 100);
messageWindow.SetPosition(WindowPosition.Mouse);
MessageDialog messageDialog = new MessageDialog(messageWindow, DialogFlags.DestroyWithParent, MessageType.Info, ButtonsType.Close, "Width and height have to be below 6000");
messageDialog.Run();
messageDialog.Destroy();
return;
}
response = ResponseType.Ok;
}
示例5: HTMLView
/// <summary>
/// Constructor
/// </summary>
public HTMLView(ViewBase owner)
: base(owner)
{
Glade.XML gxml = new Glade.XML("ApsimNG.Resources.Glade.HTMLView.glade", "vpaned1");
gxml.Autoconnect(this);
_mainWidget = vpaned1;
// Handle a temporary browser created when we want to export a map.
if (owner == null)
{
popupWin = new Gtk.Window(Gtk.WindowType.Popup);
popupWin.SetSizeRequest(500, 500);
// Move the window offscreen; the user doesn't need to see it.
// This works with IE, but not with WebKit
// Not yet tested on OSX
if (ProcessUtilities.CurrentOS.IsWindows)
popupWin.Move(-10000, -10000);
popupWin.Add(MainWidget);
popupWin.ShowAll();
while (Gtk.Application.EventsPending())
Gtk.Application.RunIteration();
}
memoView1 = new MemoView(this);
hbox1.PackStart(memoView1.MainWidget, true, true, 0);
vpaned1.PositionSet = true;
vpaned1.Position = 200;
hbox1.Visible = false;
hbox1.NoShowAll = true;
memoView1.ReadOnly = false;
memoView1.MemoChange += this.TextUpdate;
vpaned1.ShowAll();
frame1.ExposeEvent += OnWidgetExpose;
hbox1.Realized += Hbox1_Realized;
_mainWidget.Destroyed += _mainWidget_Destroyed;
}
示例6: CreateScopeWindow
private void CreateScopeWindow()
{
if(scope_window != null) {
return;
}
scope_window = new Window("Scope");
scope_window.DeleteEvent += delegate {
scope_window.Destroy();
scope_window = null;
GLib.Source.Remove(poll_timeout);
poll_timeout = 0;
};
scope_view = new ScopeView();
scope_window.Add(scope_view);
scope_window.SetSizeRequest(150, 80);
scope_window.ShowAll();
poll_timeout = GLib.Timeout.Add(150, PollScope);
}
示例7: GetFeed
static void GetFeed(string ticket)
{
nv = new NameValueCollection ();
nv.Add ("ticket", ticket);
XmlNodeList nl = Request (
"http://live.nicovideo.jp/api/getalertstatus",
@"//communities|//addr|//port|//thread",
nv);
if (nl.Count == 0) {
Console.WriteLine ("チケットの値が不正です");
LoginRequest ();
return;
}
Server sv = new Server ();
Notebook nb = new Notebook ();
nb.AppendPage(sv.Page_all (), new MultiTab("最新の放送",nb));
nb.AppendPage(sv.Page_mylist (), new MultiTab("お気に入り",nb));
nb.AppendPage(Page_tab ("common"), new MultiTab("タブ(一般)",nb));
nb.AppendPage(Page_tab ("live"), new MultiTab("タブ(ゲーム)",nb));
nb.AppendPage(Page_tab ("face"), new MultiTab("タブ(顔出し)",nb));
nb.AppendPage(Page_tab ("totu"), new MultiTab("タブ(凸待ち)",nb));
nb.AppendPage(Page_tab ("req"), new MultiTab("タブ(動画紹介)",nb));
nb.AppendPage(Page_tab ("try"), new MultiTab("タブ(やってみた)",nb));
nb.AppendPage(Page_tab ("r18"), new MultiTab("タブ(R―18)",nb));
//nb.SwitchPage += (sender, e) => PageChangedEvent(sender, e);
Gtk.Window window = new Gtk.Window ("ニコ生フィーダー v1.0");
window.DeleteEvent += new DeleteEventHandler (OnQuit);
window.SetSizeRequest (300, 550);
window.KeepAbove = true;
Toolbar bar = new Toolbar ();
ToggleToolButton sendBackBtn = new ToggleToolButton ();
sendBackBtn.Toggled += (sender, e) => SendBack(sender, e, ref window);
sendBackBtn.TooltipText = "最前面での固定を解除";
ToggleToolButton logoutBtn = new ToggleToolButton ();
logoutBtn.TooltipText = "ログアウト";
logoutBtn.Clicked += (sender, e) => Logout(sender, e, ref window);
bar.HeightRequest = 25;
Gtk.Image img = new Gtk.Image();
img.Pixbuf = new Gdk.Pixbuf("go_back.png",12,12);
sendBackBtn.IconWidget = img;
Gtk.Image img2 = new Gtk.Image();
img2.Pixbuf = new Gdk.Pixbuf("logout.png",16,16);
logoutBtn.IconWidget = img2;
logoutBtn.HeightRequest = 25;
sendBackBtn.HeightRequest = 25;
bar.Add (logoutBtn);
bar.Add (sendBackBtn);
bar.ShowAll ();
VBox vbox = new VBox(false, 0);
vbox.PackStart (bar, false, true, 0);
vbox.PackStart (nb, true, true, 0);
window.Add (vbox);
window.ShowAll ();
window.Focus = nb;
MainClass.communities = nl [0].InnerText;
sv.receiveFromServer (nl [1].InnerText, nl [2].InnerText, nl [3].InnerText);
}
示例8: test
private static void test(){
Gtk.Window window = new Gtk.Window ("ニコ生フィーダー v1.0");
window.DeleteEvent += new DeleteEventHandler (OnQuit);
window.Gravity = Gdk.Gravity.North;
window.SetSizeRequest (300, 550);
Notebook nb = new Notebook ();
nb.AppendPage(Page_tab ("common"), new MultiTab("タブ(一般)",nb));
nb.AppendPage(Page_tab ("live"), new MultiTab("タブ(ゲーム)",nb));
//sc.Add (tree);
window.Add (nb);
window.ShowAll ();
}
示例9: TreeView
public static void TreeView()
{
NpgsqlConnection connection = new NpgsqlConnection("Server=127.0.0.1; Database=dbprueba;" +
"User Id=dbprueba; Password=sistemas;");
connection.Open();
IDbCommand command = connection.CreateCommand();
command.CommandText="SELECT * FROM prueba";
IDataReader dataReader = command.ExecuteReader();
columnas = new ArrayList ();
while (dataReader.Read()) {
int ids = (int)dataReader["id"];
string n = (string)dataReader["nombre"];
string a1 = (string)dataReader["apellido1"];
string a2 = (string)dataReader["apellido2"];
columnas.Add (new Columna (ids,n,a1,a2));
}
Gtk.Window window = new Gtk.Window ("TreeView Example");
window.SetSizeRequest (500,200);
Gtk.TreeView tree = new Gtk.TreeView ();
window.Add (tree);
//-----------
Gtk.TreeViewColumn columnaId = new Gtk.TreeViewColumn ();
columnaId.Title = dataReader.GetName(0);
Gtk.CellRendererText columnaIdCelda = new Gtk.CellRendererText ();
columnaId.PackStart (columnaIdCelda, true);
Gtk.TreeViewColumn columnaNom = new Gtk.TreeViewColumn ();
columnaNom.Title = dataReader.GetName(1);
Gtk.CellRendererText columnaNomCelda = new Gtk.CellRendererText ();
columnaNom.PackStart (columnaNomCelda, true);
Gtk.TreeViewColumn columnaAp1 = new Gtk.TreeViewColumn ();
columnaAp1.Title = dataReader.GetName(2);
Gtk.CellRendererText columnaAp1Celda = new Gtk.CellRendererText ();
columnaAp1.PackStart (columnaAp1Celda, true);
Gtk.TreeViewColumn columnaAp2 = new Gtk.TreeViewColumn ();
columnaAp2.Title = dataReader.GetName(3);
Gtk.CellRendererText columnaAp2Celda = new Gtk.CellRendererText ();
columnaAp2.PackStart (columnaAp2Celda, true);
//---------
Gtk.ListStore listStore = new Gtk.ListStore (typeof (Columna));
foreach (Columna col in columnas) {
listStore.AppendValues (col);
}
for(int i=0; i<dataReader.FieldCount; i++) {
}
columnaId.SetCellDataFunc (columnaIdCelda, new Gtk.TreeCellDataFunc (RenderId));
columnaNom.SetCellDataFunc (columnaNomCelda, new Gtk.TreeCellDataFunc (RenderNom));
columnaAp1.SetCellDataFunc (columnaAp1Celda, new Gtk.TreeCellDataFunc (RenderAp1));
columnaAp2.SetCellDataFunc (columnaAp2Celda, new Gtk.TreeCellDataFunc (RenderAp2));
tree.Model = listStore;
tree.AppendColumn (columnaId);
tree.AppendColumn (columnaNom);
tree.AppendColumn (columnaAp1);
tree.AppendColumn (columnaAp2);
window.ShowAll ();
dataReader.Close();
connection.Close();
}
示例10: Main
public static void Main(string[] args)
{
Application.Init ();
client = new AgarioClient ();
w = new Gtk.Window ("Agario gtk client");
w.Decorated = false;
w.Maximize ();
w.SetSizeRequest (1024, 768);
darea = new CairoGraphic (client);
darea.DoubleBuffered = true;
darea.SetSizeRequest (800, 800);
Box box = new HBox (false, 0);
box.Add (darea);
w.Add (box);
w.Resize (500, 500);
w.DeleteEvent += close_window;
w.ShowAll ();
w.KeyPressEvent += OnKeyPressEvent;
//Timer loop for ui display
new Timer (TimerCallback, null, 0, 20);
//Timer loop for mouse events
new Timer (UIControl, null, 0, 100);
Application.Run ();
}
示例11: Client
internal Client (bool loadFiles)
{
app_count++;
Window = new Gtk.Window (Gtk.WindowType.Toplevel) { Title = Catalog.GetString ("PDF Mod") };
Window.SetSizeRequest (640, 480);
Window.DeleteEvent += delegate (object o, DeleteEventArgs args) {
Quit ();
args.RetVal = true;
};
// PDF Icon View
IconView = new DocumentIconView (this);
var iconview_sw = new Gtk.ScrolledWindow ();
iconview_sw.AddWithViewport (IconView);
query_box = new QueryBox (this) { NoShowAll = true };
query_box.Hide ();
// ActionManager
ActionManager = new Hyena.Gui.ActionManager ();
Window.AddAccelGroup (ActionManager.UIManager.AccelGroup);
Actions = new Actions (this, ActionManager);
// Status bar
StatusBar = new Gtk.Statusbar () { HasResizeGrip = true };
status_label = new Label () { Xalign = 0.0f };
StatusBar.PackStart (status_label, true, true, 6);
StatusBar.ReorderChild (status_label, 0);
var zoom_slider = new ZoomSlider (this);
StatusBar.PackEnd (zoom_slider, false, false, 0);
StatusBar.ReorderChild (zoom_slider, 1);
// Properties editor box
EditorBox = new MetadataEditorBox (this) { NoShowAll = true };
EditorBox.Hide ();
// Menubar
menu_bar = ActionManager.UIManager.GetWidget ("/MainMenu") as MenuBar;
// Toolbar
HeaderToolbar = ActionManager.UIManager.GetWidget ("/HeaderToolbar") as Gtk.Toolbar;
HeaderToolbar.ShowArrow = false;
HeaderToolbar.ToolbarStyle = ToolbarStyle.Icons;
HeaderToolbar.Tooltips = true;
HeaderToolbar.NoShowAll = true;
HeaderToolbar.Visible = Configuration.ShowToolbar;
// BookmarksView
BookmarkView = new BookmarkView (this);
BookmarkView.NoShowAll = true;
BookmarkView.Visible = false;
var vbox = new VBox ();
vbox.PackStart (menu_bar, false, false, 0);
vbox.PackStart (HeaderToolbar, false, false, 0);
vbox.PackStart (EditorBox, false, false, 0);
vbox.PackStart (query_box, false, false, 0);
var hbox = new HPaned ();
hbox.Add1 (BookmarkView);
hbox.Add2 (iconview_sw);
vbox.PackStart (hbox, true, true, 0);
vbox.PackStart (StatusBar, false, true, 0);
Window.Add (vbox);
Window.ShowAll ();
if (loadFiles) {
RunIdle (LoadFiles);
Application.Run ();
}
}
示例12: inicia
private void inicia()
{
/* Create a new window */
Window window = new Window ("Ejemplo de frames y tal ...");
/* Here we connect the "destroy" event to a signal handler */
window.DeleteEvent += delete_event;
window.SetSizeRequest(500, 400);
/* Sets the border width of the window. */
window.BorderWidth= 10;
/* Create a Frame */
//Frame frame = new Frame("MyFrame");
frame = new Frame("MyFrame");
window.Add(frame);
/* Set the frame's label */
frame.Label = "Mueveme!!!!";
/* Align the label at the right of the frame */
//frame.SetLabelAlign((float)1.0,(float)0.0); esta anticuado
//valores entre 0.0 y 1.0, indica cada extremo
frame.LabelXalign = (float)1.0;
frame.LabelYalign = (float)1.0;
/* Set the style of the frame */
frame.ShadowType = (ShadowType) 4;
/* añade mis cositas*/
frame.Add(rellenoDelFrame());
frame.Show();
/* Display the window & all widgets*/
window.ShowAll();
}
示例13: OpenFile
protected void OpenFile(object sender, EventArgs e)
{
FileChooserDialog fc = new FileChooserDialog ("Choose the directory containing the hives to open",
this,
FileChooserAction.SelectFolder,
"Cancel", ResponseType.Cancel,
"Open", ResponseType.Accept);
if (fc.Run () == (int)ResponseType.Accept) {
string dir = fc.Filename;
fc.Destroy();
List<Thread> threads = new List<Thread>();
Window window = new Gtk.Window(Gtk.WindowType.Toplevel);
VBox progressBox = new VBox(false, 5);
reading = new Label("Reading hives, please wait...");
pulseBar = new ProgressBar();
progressBox.PackStart(reading, true, true, 0);
progressBox.PackStart(pulseBar, true, true, 0);
reading.Show();
pulseBar.Show ();
progressBox.Show();
window.Add(progressBox);
window.SetPosition(Gtk.WindowPosition.CenterOnParent);
window.SetSizeRequest(500,100);
window.Title = "Loading...";
window.Show();
_hives = new List<RegistryHive>();
_filenames = new List<string>();
foreach (var file in System.IO.Directory.GetFiles(dir))
{
using (BinaryReader reader = new BinaryReader(File.OpenRead(file)))
{
reader.BaseStream.Position = 0;
if (reader.BaseStream.Length > 4)
{
byte[] magic = reader.ReadBytes(4);
if (magic[0] == 'r' && magic[1] == 'e' && magic[2] == 'g' && magic[3] == 'f')
{
_total += reader.BaseStream.Length;
_filenames.Add(file);
}
}
}
}
threads = GetReadThreads ();
foreach (Thread thread in threads)
thread.Start();
new Thread(new ThreadStart(delegate {
foreach (Thread thread in threads)
{
while (thread.IsAlive)
{
Application.Invoke(delegate {
pulseBar.Pulse();
});
System.Threading.Thread.Sleep(100);
}
}
Application.Invoke(delegate {
window.Destroy();
Populate();
});
})).Start();
}
else
fc.Destroy();
}
示例14: OnFullscreenActionActivated
protected void OnFullscreenActionActivated (object sender, EventArgs e)
{
Button b = (Button)sender;
Window w = new Window("Content Type Viewer");
w.DeleteEvent += delegate(object o, DeleteEventArgs args) {
_window_vbox.Remove(this);
_parent.Add(this);
b.ShowAll();
};
w.SetSizeRequest(800,600);
_parent = (VBox)this.Parent;
_parent.Remove(this);
_window_vbox = new Gtk.VBox();
w.Add(_window_vbox);
_window_vbox.Add(this);
w.ShowAll();
w.Show();
b.HideAll();
}
示例15: InitGUI
/// <summary>
/// Initialize the user interface of the KeyboardCode app; in other words,
/// place all of the components/widgets that are part of the user interface
/// to the user interface. This method does not show the user interface;
/// it only places the components. Call the <see cref="Gtk.Window.ShowAll"/> method
/// to show the user interface
/// </summary>
private void InitGUI()
{
window = new Window ("KeyboardCode");
window.DeleteEvent += OnDeleteEvent;
window.SetSizeRequest(600, 500);
window.Maximize ();
}