本文整理汇总了C#中Gtk.Window.SetSizeRequest方法的典型用法代码示例。如果您正苦于以下问题:C# Gtk.Window.SetSizeRequest方法的具体用法?C# Gtk.Window.SetSizeRequest怎么用?C# Gtk.Window.SetSizeRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Window
的用法示例。
在下文中一共展示了Gtk.Window.SetSizeRequest方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendMessagesOverviewWindow
public SendMessagesOverviewWindow()
{
// Create window
Gtk.Window window = new Gtk.Window ( "Verzonden Berichten" );
window.SetSizeRequest (700, 200);
// Add tree to window
Gtk.TreeView tree = new Gtk.TreeView ();
window.Add (tree);
// Create the column for displaying the telephone number.
Gtk.TreeViewColumn numberReceiverColumn = new Gtk.TreeViewColumn ();
numberReceiverColumn.Title = "Telefoon nummer";
numberReceiverColumn.MinWidth = 200;
// Create the text cell that will display the telephone number.
Gtk.CellRendererText numberReceiverCell = new Gtk.CellRendererText ();
// Add the cell to the column.
numberReceiverColumn.PackStart (numberReceiverCell, true);
// Create the column for displaing the message.
Gtk.TreeViewColumn messageColumn = new Gtk.TreeViewColumn ();
messageColumn.Title = "Bericht";
messageColumn.MinWidth = 300;
// Create the text cell that will display the message.
Gtk.CellRendererText messageCell = new Gtk.CellRendererText ();
messageColumn.PackStart (messageCell, true);
// Create the column for displaying the date send.
Gtk.TreeViewColumn sendAtColumn = new Gtk.TreeViewColumn ();
sendAtColumn.Title = "Verstuurd op";
sendAtColumn.MinWidth = 200;
// Create the text cell that will display the date send.
Gtk.CellRendererText sendAtCell = new Gtk.CellRendererText ();
sendAtColumn.PackStart (sendAtCell, true);
tree.AppendColumn (numberReceiverColumn);
tree.AppendColumn (messageColumn);
tree.AppendColumn (sendAtColumn);
// Tell the cell renderers which items in the model to display
numberReceiverColumn.AddAttribute (numberReceiverCell, "text", 0);
messageColumn.AddAttribute (messageCell, "text", 1);
sendAtColumn.AddAttribute (sendAtCell, "text", 2);
// Assign the model to the TreeView
tree.Model = this.getMessageList ();
// Show the window and everythin on it.
window.ShowAll ();
}
示例2: 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;
}
}