本文整理汇总了C#中Gtk.MenuBar.ModifyBg方法的典型用法代码示例。如果您正苦于以下问题:C# MenuBar.ModifyBg方法的具体用法?C# MenuBar.ModifyBg怎么用?C# MenuBar.ModifyBg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.MenuBar
的用法示例。
在下文中一共展示了MenuBar.ModifyBg方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateShortcutsBar
private MenuBar CreateShortcutsBar()
{
// Adds a hidden menubar that contains to enable keyboard
// shortcuts to close the log
MenuBar menu_bar = new MenuBar ();
MenuItem file_item = new MenuItem ("File");
Menu file_menu = new Menu ();
MenuItem close_1 = new MenuItem ("Close1");
MenuItem close_2 = new MenuItem ("Close2");
// adds specific Ctrl+W and Esc key accelerators to Log Window
AccelGroup accel_group = new AccelGroup ();
AddAccelGroup (accel_group);
// Close on Esc
close_1.AddAccelerator ("activate", accel_group, new AccelKey (Gdk.Key.W, Gdk.ModifierType.ControlMask,
AccelFlags.Visible));
close_1.Activated += delegate { HideAll (); };
// Close on Ctrl+W
close_2.AddAccelerator ("activate", accel_group, new AccelKey (Gdk.Key.Escape, Gdk.ModifierType.None,
AccelFlags.Visible));
close_2.Activated += delegate { HideAll (); };
file_menu.Append (close_1);
file_menu.Append (close_2);
file_item.Submenu = file_menu;
menu_bar.Append (file_item);
// Hacky way to hide the menubar, but the accellerators
// will simply be disabled when using Hide ()
menu_bar.HeightRequest = 1;
menu_bar.ModifyBg (StateType.Normal, Style.Background (StateType.Normal));
return menu_bar;
}
示例2: SparkleLog
public SparkleLog(string path)
: base("")
{
LocalPath = path;
string name = System.IO.Path.GetFileName (LocalPath);
SetDefaultSize (480, 640);
SetPosition (WindowPosition.Center);
BorderWidth = 0;
// TRANSLATORS: {0} is a folder name, and {1} is a server address
Title = String.Format(_("Recent Events in ‘{0}’"), name);
IconName = "folder-sparkleshare";
DeleteEvent += delegate {
Close ();
};
// Adds a hidden menubar that contains to enable keyboard
// shortcuts to close the log
MenuBar = new MenuBar ();
MenuItem file_item = new MenuItem ("File");
Menu file_menu = new Menu ();
MenuItem close_1 = new MenuItem ("Close1");
MenuItem close_2 = new MenuItem ("Close2");
// adds specific Ctrl+W and Esc key accelerators to Log Window
AccelGroup accel_group = new AccelGroup ();
AddAccelGroup (accel_group);
// Close on Esc
close_1.AddAccelerator ("activate", accel_group, new AccelKey (Gdk.Key.W, Gdk.ModifierType.ControlMask,
AccelFlags.Visible));
close_1.Activated += delegate { Close (); };
// Close on Ctrl+W
close_2.AddAccelerator ("activate", accel_group, new AccelKey (Gdk.Key.Escape, Gdk.ModifierType.None,
AccelFlags.Visible));
close_2.Activated += delegate { Close (); };
file_menu.Append (close_1);
file_menu.Append (close_2);
file_item.Submenu = file_menu;
MenuBar.Append (file_item);
// Hacky way to hide the menubar, but the accellerators
// will simply be disabled when using Hide ()
MenuBar.HeightRequest = 1;
MenuBar.ModifyBg (StateType.Normal, Style.Background (StateType.Normal));
LayoutVertical = new VBox (false, 0);
LayoutVertical.PackStart (CreateEventLog (), true, true, 0);
HButtonBox dialog_buttons = new HButtonBox {
Layout = ButtonBoxStyle.Edge,
BorderWidth = 12
};
Button open_folder_button = new Button (_("_Open Folder")) {
UseUnderline = true
};
open_folder_button.Clicked += delegate (object o, EventArgs args) {
Process process = new Process ();
process.StartInfo.FileName = Defines.OPEN_COMMAND;
process.StartInfo.Arguments = LocalPath.Replace (" ", "\\ "); // Escape space-characters
process.Start ();
Close ();
};
Button close_button = new Button (Stock.Close);
close_button.Clicked += delegate {
Close ();
};
dialog_buttons.Add (open_folder_button);
dialog_buttons.Add (close_button);
LayoutVertical.PackStart (new HSeparator (), false, false, 0);
// We have to hide the menubar somewhere...
LayoutVertical.PackStart (MenuBar, false, false, 0);
LayoutVertical.PackStart (dialog_buttons, false, false, 0);
Add (LayoutVertical);
}