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


C# Alignment.SizeRequest方法代码示例

本文整理汇总了C#中Gtk.Alignment.SizeRequest方法的典型用法代码示例。如果您正苦于以下问题:C# Alignment.SizeRequest方法的具体用法?C# Alignment.SizeRequest怎么用?C# Alignment.SizeRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gtk.Alignment的用法示例。


在下文中一共展示了Alignment.SizeRequest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetLabel

		public void SetLabel (Gtk.Widget page, Xwt.Drawing.Image icon, string label)
		{
			this.label = label;
			this.page = page;
			if (Child != null) {
				Gtk.Widget oc = Child;
				Remove (oc);
				oc.Destroy ();
			}
			
			Gtk.HBox box = new HBox ();
			box.Spacing = -2;
			
			if (icon == null)
				icon = ImageService.GetIcon ("md-empty");

			tabIcon = new ImageView (icon);
			tabIcon.Show ();
			box.PackStart (tabIcon, false, false, 3);

			if (!string.IsNullOrEmpty (label)) {
				labelWidget = new ExtendedLabel (label);
				labelWidget.UseMarkup = true;
				labelWidget.Name = label;
				var alignLabel = new Alignment (0.0f, 0.5f, 1, 1);
				alignLabel.BottomPadding = 0;
				alignLabel.RightPadding = 15;
				alignLabel.Add (labelWidget);
				box.PackStart (alignLabel, false, false, 0);
			} else {
				labelWidget = null;
			}

			btnDock = new ImageButton ();
			btnDock.Image = pixAutoHide;
			btnDock.TooltipText = GettextCatalog.GetString ("Auto Hide");
			btnDock.CanFocus = false;
//			btnDock.WidthRequest = btnDock.HeightRequest = 17;
			btnDock.Clicked += OnClickDock;
			btnDock.ButtonPressEvent += (o, args) => args.RetVal = true;
			btnDock.WidthRequest = btnDock.SizeRequest ().Width;
			btnDock.Name = string.Format("btnDock_{0}", label ?? string.Empty);

			btnClose = new ImageButton ();
			btnClose.Image = pixClose;
			btnClose.TooltipText = GettextCatalog.GetString ("Close");
			btnClose.CanFocus = false;
//			btnClose.WidthRequest = btnClose.HeightRequest = 17;
			btnClose.WidthRequest = btnDock.SizeRequest ().Width;
			btnClose.Clicked += delegate {
				item.Visible = false;
			};
			btnClose.ButtonPressEvent += (o, args) => args.RetVal = true;
			btnClose.Name = string.Format ("btnClose_{0}", label ?? string.Empty);

			Gtk.Alignment al = new Alignment (0, 0.5f, 1, 1);
			HBox btnBox = new HBox (false, 0);
			btnBox.PackStart (btnDock, false, false, 3);
			btnBox.PackStart (btnClose, false, false, 1);
			al.Add (btnBox);
			box.PackEnd (al, false, false, 3);

			Add (box);
			
			// Get the required size before setting the ellipsize property, since ellipsized labels
			// have a width request of 0
			box.ShowAll ();
			Show ();

			minWidth = tabIcon.SizeRequest ().Width + al.SizeRequest ().Width + 10;

			UpdateBehavior ();
			UpdateVisualStyle ();
		}
开发者ID:sushihangover,项目名称:monodevelop,代码行数:74,代码来源:DockItemTitleTab.cs


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