当前位置: 首页>>代码示例>>C#>>正文


C# Gtk.Window.SetSizeRequest方法代码示例

本文整理汇总了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 ();
		}
开发者ID:jorisrietveld,项目名称:SmsApp,代码行数:49,代码来源:SendMessagesOverviewWindow.cs

示例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;
            }
        }
开发者ID:mono,项目名称:stetic,代码行数:44,代码来源:DND.cs


注:本文中的Gtk.Window.SetSizeRequest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。