當前位置: 首頁>>代碼示例>>C#>>正文


C# Menu.Realize方法代碼示例

本文整理匯總了C#中Gtk.Menu.Realize方法的典型用法代碼示例。如果您正苦於以下問題:C# Menu.Realize方法的具體用法?C# Menu.Realize怎麽用?C# Menu.Realize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Gtk.Menu的用法示例。


在下文中一共展示了Menu.Realize方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: NoteTextMenu


//.........這裏部分代碼省略.........
			MarkupLabel (large);
			large.Data ["Tag"] = "size:large";
			large.Activated += FontSizeActivated;

			small = new Gtk.RadioMenuItem (large.Group,
			                               "<span size=\"small\">" +
			                               Catalog.GetString ("S_mall") +
			                               "</span>");
			MarkupLabel (small);
			small.Data ["Tag"] = "size:small";
			small.Activated += FontSizeActivated;

			hidden_no_size = new Gtk.RadioMenuItem (small.Group, string.Empty);
			hidden_no_size.Hide ();

			increase_font = new Gtk.MenuItem (Catalog.GetString ("Increase Font Size"));
			increase_font.AddAccelerator ("activate",
						accel_group,
						(uint) Gdk.Key.plus,
						Gdk.ModifierType.ControlMask,
						Gtk.AccelFlags.Visible);
			increase_font.AddAccelerator ("activate",
						accel_group,
						(uint) Gdk.Key.KP_Add,
						Gdk.ModifierType.ControlMask,
						Gtk.AccelFlags.Visible);
			increase_font.AddAccelerator ("activate",
						accel_group,
						(uint) Gdk.Key.equal,
						Gdk.ModifierType.ControlMask,
						Gtk.AccelFlags.Visible);
			increase_font.Activated += IncreaseFontClicked;

			decrease_font = new Gtk.MenuItem (Catalog.GetString ("Decrease Font Size"));
			decrease_font.AddAccelerator ("activate",
						accel_group,
						(uint) Gdk.Key.minus,
						Gdk.ModifierType.ControlMask,
						Gtk.AccelFlags.Visible);
			decrease_font.AddAccelerator ("activate",
						accel_group,
						(uint) Gdk.Key.KP_Subtract,
						Gdk.ModifierType.ControlMask,
						Gtk.AccelFlags.Visible);
			decrease_font.AddAccelerator ("activate",
						accel_group,
						(uint) Gdk.Key.underscore,
						Gdk.ModifierType.ControlMask,
						Gtk.AccelFlags.Visible);
			decrease_font.Activated += DecreaseFontClicked;

			Gtk.SeparatorMenuItem spacer2 = new Gtk.SeparatorMenuItem ();

			bullets = new Gtk.CheckMenuItem (Catalog.GetString ("Bullets"));
			bullets.Activated += ToggleBulletsClicked;

			increase_indent = new Gtk.ImageMenuItem (Gtk.Stock.Indent, accel_group);
			increase_indent.AddAccelerator ("activate",
						accel_group,
						(uint) Gdk.Key.Right,
						Gdk.ModifierType.Mod1Mask,
						Gtk.AccelFlags.Visible);
			increase_indent.Activated += IncreaseIndentClicked;
			increase_indent.Show ();

			decrease_indent = new Gtk.ImageMenuItem (Gtk.Stock.Unindent, accel_group);
			decrease_indent.AddAccelerator ("activate",
						accel_group,
						(uint) Gdk.Key.Left,
						Gdk.ModifierType.Mod1Mask,
						Gtk.AccelFlags.Visible);
			decrease_indent.Activated += DecreaseIndentClicked;
			decrease_indent.Show ();

			RefreshState ();

			Append (bold);
			Append (italic);
			Append (strikeout);
			Append (highlight);
			Append (spacer1);
			Append (font_size);
			Append (small);
			Append (normal);
			Append (large);
			Append (huge);
			Append (increase_font);
			Append (decrease_font);
			Append (spacer2);
			Append (bullets);
			Append (increase_indent);
			Append (decrease_indent);
			ShowAll ();

			theme_hack_menu = new Menu ();
			theme_hack_menu.Realize ();
			theme_hack_menu.StyleSet += delegate {
				ModifyBg (StateType.Normal, theme_hack_menu.Style.Background (StateType.Normal));
			};
		}
開發者ID:oluc,項目名稱:tomboy,代碼行數:101,代碼來源:NoteWindow.cs


注:本文中的Gtk.Menu.Realize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。