Inheritance: System.Windows.Forms.Menu
Ejemplo n.º 1
1
        public ListBoxLog(ListBox listBox, string messageFormat, int maxLinesInListbox, bool debug = true)
        {
            _debug = debug;
            _disposed = false;

            _listBox = listBox;
            _messageFormat = messageFormat;
            _maxEntriesInListBox = maxLinesInListbox;

            _paused = false;

            _canAdd = listBox.IsHandleCreated;

            _listBox.SelectionMode = SelectionMode.MultiExtended;

            _listBox.HandleCreated += OnHandleCreated;
            _listBox.HandleDestroyed += OnHandleDestroyed;
            _listBox.DrawItem += DrawItemHandler;
            _listBox.KeyDown += KeyDownHandler;

            MenuItem[] menuItems = new MenuItem[] { new MenuItem("Copy", new EventHandler(CopyMenuOnClickHandler)) };
            _listBox.ContextMenu = new ContextMenu(menuItems);
            _listBox.ContextMenu.Popup += new EventHandler(CopyMenuPopupHandler);

            _listBox.DrawMode = DrawMode.OwnerDrawFixed;
        }
Ejemplo n.º 2
1
        public Transformer()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.DoubleBuffer, true);
            Text = "COMP 4560:  Assignment 5 (A00884869) (Duy Le)";
            ResizeRedraw = true;
            BackColor = Color.Black;
            MenuItem miNewDat = new MenuItem("New &Data...",
                new EventHandler(MenuNewDataOnClick));
            MenuItem miExit = new MenuItem("E&xit",
                new EventHandler(MenuFileExitOnClick));
            MenuItem miDash = new MenuItem("-");
            MenuItem miFile = new MenuItem("&File",
                new MenuItem[] {miNewDat, miDash, miExit});
            MenuItem miAbout = new MenuItem("&About",
                new EventHandler(MenuAboutOnClick));
            Menu = new MainMenu(new MenuItem[] {miFile, miAbout});

            //foreach (var button in Controls.OfType<Button>())
            //{
            //    button.Click += button_Click;
            //}

            _timer = new System.Windows.Forms.Timer();
            _timer.Interval = 1;
        }
Ejemplo n.º 3
1
        /// <summary>
        /// �������˵���
        /// </summary>
        public static void DrawMenuItem(System.Windows.Forms.DrawItemEventArgs e, MenuItem mi)
        {
            if ( (e.State & DrawItemState.HotLight) == DrawItemState.HotLight )
            {

                DrawHoverRect(e, mi);
            }
            else if ( (e.State & DrawItemState.Selected) == DrawItemState.Selected )
            {
                DrawSelectionRect(e, mi);
            }
            else
            {
                Rectangle rect = new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width,
                e.Bounds.Height -1);
                e.Graphics.FillRectangle(new SolidBrush(Globals.MainColor), rect);
                e.Graphics.DrawRectangle(new Pen(Globals.MainColor), rect);
            }

            StringFormat sf = new StringFormat();

            //�������־���
            sf.LineAlignment = StringAlignment.Center;
            sf.Alignment = StringAlignment.Center;

            //��������
            e.Graphics.DrawString(mi.Text,
                Globals.menuFont,
                new SolidBrush(Globals.TextColor),
                e.Bounds,
                sf);
        }
Ejemplo n.º 4
1
        public Notificator(IEventLogger eventLogger, ISettingsManager settingsManager)
        {
            _eventLogger = eventLogger;
            _settingsManager = settingsManager;

            var menuItem = new MenuItem(Strings.Exit);
            menuItem.Click += menuItem_Click;
            var contextMenu = new ContextMenu(new[] {menuItem});
            _notifyIcon = new NotifyIcon
            {
                Icon = new Icon("TryIcon.ico"),
                Visible = true,
                BalloonTipTitle = Strings.Caution,
                Text = Strings.Initializing,
                ContextMenu = contextMenu
            };

            var oneRunTimer = new Timer(3000)
            {
                AutoReset = false,
                Enabled = true
            };
            oneRunTimer.Elapsed += _timer_Elapsed; // runs only once after aplication start

            var timer = new Timer(60000)
            {
                AutoReset = true,
                Enabled = true
            };
            timer.Elapsed += _timer_Elapsed;
        }
Ejemplo n.º 5
1
 public virtual void AddRange( MenuItem[] items )
 {
   for( int i=0; i<items.Length; i++ )
   {
     Add( (MenuItemEx)items[i] );
   }
 }
Ejemplo n.º 6
1
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.mainMenu1 = new System.Windows.Forms.MainMenu();
     this.menuItem1 = new System.Windows.Forms.MenuItem();
     this.menuItem2 = new System.Windows.Forms.MenuItem();
     this.menuItem3 = new System.Windows.Forms.MenuItem();
     //
     // mainMenu1
     //
     this.mainMenu1.MenuItems.Add(this.menuItem1);
     //
     // menuItem1
     //
     this.menuItem1.MenuItems.Add(this.menuItem2);
     this.menuItem1.Text = "Opciones";
     //
     // menuItem2
     //
     this.menuItem2.MenuItems.Add(this.menuItem3);
     this.menuItem2.Text = "Datos de Lectora";
     //
     // menuItem3
     //
     this.menuItem3.Text = "Sincronizar Cortes";
     //
     // SistemasEtiquetas
     //
     this.BackColor = System.Drawing.Color.White;
     this.ClientSize = new System.Drawing.Size(322, 348);
     this.Menu = this.mainMenu1;
     this.Text = "Sistema de Eitquetas";
     this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
 }
Ejemplo n.º 7
1
        public FaceImageControl( FaceImage Face, FaceImageListControl FaceControlParent )
        {
            this.Face = Face;
            this.FaceControlParent = FaceControlParent;
            InitializeComponent();

            SetBounds( 0, 0, Face.Face.Width, Face.Face.Height );

            List<MenuItem> menuitems = new List<MenuItem>();

            MenuItem mi;
            mi = new MenuItem( "Edit URL" );
            mi.Click += new EventHandler( mi_EditURL_Click );
            menuitems.Add( mi );

            mi = new MenuItem( "Edit Name" );
            mi.Click += new EventHandler( mi_EditName_Click );
            menuitems.Add( mi );

            mi = new MenuItem( "Delete" );
            mi.Click += new EventHandler( mi_Delete_Click );
            menuitems.Add( mi );

            RightClickMenuItems = menuitems.ToArray();
            RightClickMenu = new System.Windows.Forms.ContextMenu( RightClickMenuItems );

            ImageAttrs = new System.Drawing.Imaging.ImageAttributes();
            ColorMatrix = new System.Drawing.Imaging.ColorMatrix();
        }
Ejemplo n.º 8
1
        public MainWindow()
        {
            InitializeComponent();
            this.notifyIcon = new NotifyIcon();
            contextMenu = new ContextMenu();

            MenuItem refreshItem = new MenuItem();
            refreshItem.Click += new System.EventHandler(this.refreshQuestionNo);
            refreshItem.Text = "Refresh";
            contextMenu.MenuItems.Add(refreshItem);

            MenuItem openItem = new MenuItem();
            openItem.Click += new System.EventHandler(this.showApp);
            openItem.Text = "Show";
            contextMenu.MenuItems.Add(openItem);

            MenuItem exitItem = new MenuItem();
            exitItem.Click += new System.EventHandler(this.exitApp);
            exitItem.Text = "Exit";
            contextMenu.MenuItems.Add(exitItem);

            dispatcherTimer = new DispatcherTimer();
            dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
            dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
        }
Ejemplo n.º 9
1
		protected override void OnLoad(EventArgs e)
		{
			var menu = new MainMenu();
			MenuItem open = new MenuItem("Open", (s, a) =>
			{
				using (var dialog = new OpenFileDialogAdapter())
				{
					dialog.InitialDirectory = "/tmp";
					if (dialog.ShowDialog() == DialogResult.OK)
					{
						m_datafile = new FileInfo(dialog.FileName);
						m_painted = false;
					}
				}
			});

			MenuItem refresh = new MenuItem("Refresh", (s, a) =>
			{
				m_painted = false;
				this.Invalidate();
			});

			base.OnLoad(e);

			menu.MenuItems.Add(open);
			menu.MenuItems.Add(refresh);
			Menu = menu;
		}
Ejemplo n.º 10
1
        public ShellView()
        {
            InitializeComponent();

            // Check if there was instance before this. If there was-close the current one.
            if (ProcessUtilities.ThisProcessIsAlreadyRunning())
            {
                ProcessUtilities.SetFocusToPreviousInstance("Carnac");
                Application.Current.Shutdown();
            }

            var item = new MenuItem
            {
                Text = "Exit"
            };

            item.Click += (sender, args) => Close();

            var iconStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Carnac.icon.embedded.ico");

            var ni = new NotifyIcon
                         {
                             Icon = new Icon(iconStream),
                             ContextMenu = new ContextMenu(new[] { item })
                         };

            ni.Click += NotifyIconClick;
            ni.Visible = true;
        }
Ejemplo n.º 11
1
        public ServerLogForm(ShadowsocksController controller)
        {
            this.controller = controller;
            this.Icon = Icon.FromHandle(Resources.ssw128.GetHicon());
            InitializeComponent();
            this.Width = 760;

            Configuration config = controller.GetCurrentConfiguration();
            if (config.configs.Count < 8)
            {
                this.Height = 300;
            }
            else if (config.configs.Count < 20)
            {
                this.Height = 300 + (config.configs.Count - 8) * 16;
            }
            else
            {
                this.Height = 500;
            }
            UpdateTexts();
            UpdateLog();

            this.contextMenu1 = new ContextMenu(new MenuItem[] {
                this.clearItem = CreateMenuItem("&Clear", new EventHandler(this.ClearItem_Click)),
            });
            ServerDataGrid.ContextMenu = contextMenu1;
            controller.ConfigChanged += controller_ConfigChanged;
        }
Ejemplo n.º 12
1
        private static ContextMenu CreateMenus()
        {
            MainMenu.MenuItems.Clear();

            foreach (IPlugin plugin in pluginsList)
            {
                MemberInfo info = plugin.GetType();
                string pluginName = plugin.GetType().Namespace + '.' + plugin.GetType().Name;
                string menuName = ((PluginAttributes)Attribute.GetCustomAttribute(info, typeof(PluginAttributes))).PluginLabel;

                MenuItem menuItem = new MenuItem(menuName);
                MainMenu.MenuItems.Add(menuItem);
                MountPluginMenu(plugin, menuItem, plugin.Menus());

                menuItem.Click += (sender, e) =>
                {

                    DoActionPlugin(pluginName, menuName, plugin, null);
                };
            }

            // ===============================================
            // Funções Auxiliares
            // ===============================================
            MainMenu.MenuItems.Add(new MenuItem("Atualizar", (sender, e) =>
            {
                MainMenu.MenuItems.Clear();
                CreateMenus();
            }));
            MainMenu.MenuItems.Add(new MenuItem("Fechar menu"));
            MainMenu.MenuItems.Add(new MenuItem("Sair", (sender, e) => Application.Exit()));

            return MainMenu;
        }
Ejemplo n.º 13
1
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.panelBottom = new System.Windows.Forms.Panel();
			this.grid = new SourceGrid.Grid();
			this.mainMenu1 = new System.Windows.Forms.MainMenu();
			this.mnWindow = new System.Windows.Forms.MenuItem();
			this.panelBottom.SuspendLayout();
			this.SuspendLayout();
			// 
			// panelBottom
			// 
			this.panelBottom.BackColor = System.Drawing.SystemColors.ControlDark;
			this.panelBottom.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.panelBottom.Controls.Add(this.grid);
			this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
			this.panelBottom.Location = new System.Drawing.Point(0, 342);
			this.panelBottom.Name = "panelBottom";
			this.panelBottom.Size = new System.Drawing.Size(772, 128);
			this.panelBottom.TabIndex = 1;
			// 
			// grid
			// 
			this.grid.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.grid.AutoStretchColumnsToFitWidth = false;
			this.grid.AutoStretchRowsToFitHeight = false;
			this.grid.BackColor = System.Drawing.SystemColors.Window;
			this.grid.CustomSort = false;
			this.grid.Location = new System.Drawing.Point(0, 4);
			this.grid.Name = "grid";
			this.grid.OverrideCommonCmdKey = true;
			this.grid.Size = new System.Drawing.Size(768, 120);
			this.grid.SpecialKeys = SourceGrid.GridSpecialKeys.Default;
			this.grid.TabIndex = 0;
			// 
			// mainMenu1
			// 
			this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.mnWindow});
			// 
			// mnWindow
			// 
			this.mnWindow.Index = 0;
			this.mnWindow.Text = "Window";
			// 
			// frmSample25
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(772, 470);
			this.Controls.Add(this.panelBottom);
			this.IsMdiContainer = true;
			this.Menu = this.mainMenu1;
			this.Name = "frmSample25";
			this.Text = "frmSample25";
			this.Load += new System.EventHandler(this.frmSample25_Load);
			this.panelBottom.ResumeLayout(false);
			this.ResumeLayout(false);

		}
Ejemplo n.º 14
1
		public void CloneWindowMenuTest ()
		{
				MenuItem menuitem1 = new MenuItem ();
				menuitem1.MdiList = true;
				MenuItem menuitem2 = menuitem1.CloneMenu ();
				Assert.IsTrue (menuitem2.MdiList, "#1");
		}
Ejemplo n.º 15
0
        private void Form1_Load(object sender, EventArgs e)
        {
            System.Windows.Forms.ContextMenu contextMenu1;
            contextMenu1 = new System.Windows.Forms.ContextMenu();

            System.Windows.Forms.MenuItem menuItem1;
            menuItem1 = new System.Windows.Forms.MenuItem();
            System.Windows.Forms.MenuItem menuItem2;
            menuItem2 = new System.Windows.Forms.MenuItem();
            System.Windows.Forms.MenuItem menuItem3;
            menuItem3 = new System.Windows.Forms.MenuItem();

            contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { menuItem1, menuItem2, menuItem3 });
            menuItem1.Index = 0;
            menuItem1.Text  = "Открыть";
            menuItem2.Index = 1;
            menuItem2.Text  = "Сохранить";
            menuItem3.Index = 2;
            menuItem3.Text  = "Сохранить как";

            richTextBox1.ContextMenu = contextMenu1;
            menuItem1.Click         += new System.EventHandler(this.menuItem1_Click);
            menuItem2.Click         += new System.EventHandler(this.menuItem2_Click);
            menuItem3.Click         += new System.EventHandler(this.menuItem3_Click);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 初始化程序任务栏托盘通知图标
        /// </summary>
        private void InitailizeNotifyIcon()
        {
            this.notifyIcon = new System.Windows.Forms.NotifyIcon();
            // 设置程序启动时显示的文本
            this.notifyIcon.BalloonTipText = "广州番禺电缆可视化监测系统";
            // 最小化到托盘时,鼠标点击时显示的文本
            this.notifyIcon.Text = "广州番禺电缆可视化监测系统";
            // 静应用程序图标设置为托盘通知的图标
            this.notifyIcon.Icon = System.Drawing.Icon.ExtractAssociatedIcon(
                System.Windows.Forms.Application.ExecutablePath);
            this.notifyIcon.Visible = false;
            //打开菜单项
            MenuItem open = new System.Windows.Forms.MenuItem("打开主界面",
                                                              new EventHandler((o, e) => {
                this.Show();
                this.notifyIcon.Visible = false;
            }));
            //退出菜单项
            MenuItem exit = new System.Windows.Forms.MenuItem("退出程序",
                                                              new EventHandler((o, e) => {
                System.Windows.Application.Current.Shutdown(0);
            }));

            //关联托盘控件
            MenuItem[] childen = new System.Windows.Forms.MenuItem[] { open, exit };
            notifyIcon.ContextMenu       = new System.Windows.Forms.ContextMenu(childen);
            notifyIcon.MouseDoubleClick += new MouseEventHandler((o, e) => {
                if (e.Button == MouseButtons.Left)
                {
                    this.Show();
                    this.notifyIcon.Visible = false;
                }
            });
            this.notifyIcon.ShowBalloonTip(1000);
        }
Ejemplo n.º 17
0
        // creates tray icon with menu
        private void InitializeTray()
        {
            ni.Icon         = Properties.Resources.coin;
            ni.Visible      = true;
            ni.DoubleClick +=
                delegate(object sender, EventArgs args)
            {
                this.Show();
                this.WindowState = WindowState.Normal;
            };

            this.components  = new System.ComponentModel.Container();
            this.contextMenu = new System.Windows.Forms.ContextMenu();
            this.menuItem    = new System.Windows.Forms.MenuItem();

            // Initialize contextMenu1
            this.contextMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuItem });

            // Initialize menuItem1
            this.menuItem.Index  = 0;
            this.menuItem.Text   = "E&xit";
            this.menuItem.Click += new System.EventHandler(this.MenuItem_Click);

            ni.ContextMenu = this.contextMenu;
        }
Ejemplo n.º 18
0
        public static void OwnerDrawMenuItem(System.Windows.Forms.MenuItem menuItem, DrawItemEventArgs e, string shortcutText)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }

            Graphics      g         = e.Graphics;
            DrawItemState itemState = e.State;


            Rectangle BitmapBounds = e.Bounds;

            BitmapBounds.Width = BitmapWidth + 2;
            Rectangle ItemBounds = e.Bounds;

            ItemBounds.X = BitmapWidth;
            Rectangle ItemTextBounds = e.Bounds;

            ItemTextBounds.X      = (BitmapWidth + HorizontalTextOffset);
            ItemTextBounds.Y      = (e.Bounds.Y + VerticalTextOffset);
            ItemTextBounds.Width  = (e.Bounds.Width);
            ItemTextBounds.Height = (e.Bounds.Height);

            DrawBackground(g, itemState, e.Bounds);
            //DrawBitmap(g, item, itemState);
            DrawText(g, menuItem, itemState, shortcutText, e.Bounds, ItemTextBounds);
        }
Ejemplo n.º 19
0
        public Transformer()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.DoubleBuffer, true);
            Text = "COMP 4560:  Assignment 5 (201230) (Jeffrey Woo)";
            ResizeRedraw = true;
            BackColor = Color.Black;

            MenuItem miNewDat = new MenuItem("New &Data...",
                new EventHandler(MenuNewDataOnClick));
            MenuItem miExit = new MenuItem("E&xit",
                new EventHandler(MenuFileExitOnClick));
            MenuItem miDash = new MenuItem("-");
            MenuItem miFile = new MenuItem("&File",
                new MenuItem[] { miNewDat, miDash, miExit });
            MenuItem miAbout = new MenuItem("&About",
                new EventHandler(MenuAboutOnClick));
            Menu = new MainMenu(new MenuItem[] { miFile, miAbout });
        }
Ejemplo n.º 20
0
        public static void Main()
        {
            System.IO.Stream icon = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("bakkappah.bakkappah.ico");
            systray.Icon = new System.Drawing.Icon(icon);
            systray.Text = "bakkappah";
            props = new Properties();
            EventHandler quitHandler = new EventHandler(quit);

            ContextMenu menu = new ContextMenu();
            MenuItem item = new MenuItem("Backup now!", new EventHandler(sync));
            menu.MenuItems.Add(item);
            item = new MenuItem("Configuration", new EventHandler(config));
            menu.MenuItems.Add(item);
            item = new MenuItem("-");
            menu.MenuItems.Add(item);
            item = new MenuItem("Quit", quitHandler);
            menu.MenuItems.Add(item);

            systray.ContextMenu = menu;
            systray.Visible = true;

            timer.Tick += new EventHandler(sync);
            timer.Interval = props.Interval * 60000;
            timer.Start();

            Application.ApplicationExit += quitHandler;
            Application.Run();
        }
        void _grid_Click(object sender, EventArgs e)
        {
            MouseEventArgs mouse = (MouseEventArgs)e;

            if (mouse.Button != MouseButtons.Right)
            {
                return;
            }

            // cоздание контекстного меню

            MenuItem[] items = new MenuItem[2];

            items[0]        = new MenuItem();
            items[0].Text   = @"Удалить";
            items[0].Click += AlertDelete_Click;

            items[1] = new MenuItem()
            {
                Text = @"Добавить"
            };
            items[1].Click += AlertCreate_Click;

            ContextMenu menu = new ContextMenu(items);

            _grid.ContextMenu = menu;
            _grid.ContextMenu.Show(_grid, new System.Drawing.Point(mouse.X, mouse.Y));
        }
Ejemplo n.º 22
0
        public Main()
        {
            InitializeComponent();

            //initialize tray icon
            notifyIcon = new NotifyIcon();
            Stream iconStream = System.Windows.Application.GetResourceStream(new Uri("pack://application:,,,/clientWPF;component/sync.ico")).Stream;
            notifyIcon.Icon = new System.Drawing.Icon(iconStream);
            notifyIconMenu = new System.Windows.Forms.ContextMenu();
            System.Windows.Forms.MenuItem mnuItemSyncNow = new System.Windows.Forms.MenuItem();
            System.Windows.Forms.MenuItem mnuItemShow = new System.Windows.Forms.MenuItem();
            mnuItemShow.Text = "Show";
            mnuItemShow.Click += new System.EventHandler(notifyIcon_Click);
            notifyIconMenu.MenuItems.Add(mnuItemShow);
            mnuItemSyncNow.Text = "SyncNow";
            mnuItemSyncNow.Click += new System.EventHandler(syncMenuItem);
            notifyIconMenu.MenuItems.Add(mnuItemSyncNow);
            notifyIcon.Text = "SyncClient";
            notifyIcon.ContextMenu = notifyIconMenu;
            notifyIcon.BalloonTipTitle = "App minimized to tray";
            notifyIcon.BalloonTipText = "Sync sill running.";

            // Settings
            connectionSettings = new ConnectionSettings();
            tAddress.Text = connectionSettings.readSetting("connection", "address");
            tPort.Text = connectionSettings.readSetting("connection", "port");
            tDirectory.Text = connectionSettings.readSetting("account", "directory");
            tTimeout.Text = connectionSettings.readSetting("connection", "syncTime");
        }
Ejemplo n.º 23
0
 private void CreateContextMenu()
 {
     var m = lstFiles.ContextMenu = new ContextMenu();
     var i = new MenuItem("Open");
     i.DefaultItem = true;
     i.Click += (s,e) => lstFiles_MouseDoubleClick(s,e);
     m.MenuItems.Add(i);
     i = new MenuItem("Open in new instance");
     i.Click += (s,e) => RaiseSelectEvent(true, false);
     m.MenuItems.Add(i);
     i = new MenuItem("Open externally");
     i.Click += (s, e) => RaiseSelectEvent(false, true);
     m.MenuItems.Add(i);
     i = new MenuItem("-");
     m.MenuItems.Add(i);
     i = new MenuItem("Explore current folder");
     i.Click += (s, e) =>
     {
         if (OnFileSelect != null)
             OnFileSelect(this, new FileSelectEventArgs()
             {
                 FileName = CurrentFolder, // + (CurrentFolder.EndsWith(Path.DirectorySeparatorChar.ToString()) ? "" : Path.DirectorySeparatorChar.ToString()),
                 InNewInstance = false,
                 InExternalViewer = true
             });
     };
     m.MenuItems.Add(i);
 }
Ejemplo n.º 24
0
 private void AddSubMenuItem(MenuItem parent, string name, bool isChecked, MenuAction action)
 {
     MenuItem item = new MenuItem(name);
     item.Checked = isChecked;
     item.Click += new EventHandler(action);
     parent.MenuItems.Add(item);
 }
Ejemplo n.º 25
0
Archivo: Menu.cs Proyecto: adbre/mono
 		protected Menu (MenuItem[] items)
		{
			menu_items = new MenuItemCollection (this);

			if (items != null)
				menu_items.AddRange (items);
		}
Ejemplo n.º 26
0
        public MainWindow()
        {
            InitializeComponent();
            this.SourceInitialized += MainWindow_SourceInitialized;

            this.notifyIcon                = new NotifyIcon();
            this.notifyIcon.Visible        = true;
            this.notifyIcon.BalloonTipText = "开盖锁屏监控中...";
            this.notifyIcon.ShowBalloonTip(3000);
            this.notifyIcon.Text = "开盖锁屏";
            this.notifyIcon.Icon = System.Drawing.Icon.ExtractAssociatedIcon(System.Windows.Forms.Application.ExecutablePath);

            this.tbx.FontSize = 100;
            this.tbx.Text     = string.Format("开盖锁屏");

            //打开菜单项
            System.Windows.Forms.MenuItem open = new System.Windows.Forms.MenuItem("打开主界面");
            open.Click += new EventHandler(Show);
            //退出菜单项
            System.Windows.Forms.MenuItem exit = new System.Windows.Forms.MenuItem("退出程序");
            exit.Click += new EventHandler(Close);
            //关联托盘控件
            System.Windows.Forms.MenuItem[] childen = new System.Windows.Forms.MenuItem[] { open, exit };
            notifyIcon.ContextMenu = new System.Windows.Forms.ContextMenu(childen);

            this.notifyIcon.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler((o, e) =>
            {
                if (e.Button == MouseButtons.Left)
                {
                    this.Show(o, e);
                }
            });
        }
Ejemplo n.º 27
0
namespace MyGeneration
{
	/// <summary>
	/// Summary description for VBScriptTemplate.
	/// </summary>
	public class VBScriptTemplate : ScriptWindow
	{
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;
		private System.Windows.Forms.MainMenu mainMenu1;
		private System.Windows.Forms.MenuItem Script;
		private System.Windows.Forms.MenuItem ScriptGenerate;
		private ScintillaControl scintillaControl = null;
		public VBScriptTemplate()
		{
			InitializeComponent();
			scintillaControl = new ZeusScintillaControl(ScriptLanguage.VBScript);
			scintillaControl.AddShortcutsFromForm(this);
			
			this.Controls.Add(scintillaControl);
		}
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}
		protected override ScintillaControl ScintillaControl
		{
Ejemplo n.º 28
0
 public PrivateMessageControl CreatePrivateMessageControl(string userName)
 {
     var pmControl = new PrivateMessageControl(userName) { Dock = DockStyle.Fill };
     var isFriend = Program.FriendManager.Friends.Contains(userName);
     User user;
     var isOffline = !Program.TasClient.ExistingUsers.TryGetValue(userName, out user);
     var icon = isOffline ? ZklResources.grayuser : TextImage.GetUserImage(userName);
     var contextMenu = new ContextMenu();
     if (!isFriend)
     {
         var closeButton = new MenuItem();
         closeButton.Click += (s, e) => toolTabs.RemovePrivateTab(userName);
         contextMenu.MenuItems.Add(closeButton);
     }
     toolTabs.AddTab(userName, userName, pmControl, icon, ToolTipHandler.GetUserToolTipString(userName), 0);
     pmControl.ChatLine +=
         (s, e) =>
         {
             if (Program.TasClient.IsLoggedIn)
             {
                 if (Program.TasClient.ExistingUsers.ContainsKey(userName)) Program.TasClient.Say(SayPlace.User, userName, e.Data, false);
                 else Program.TasClient.Say(SayPlace.User, GlobalConst.NightwatchName, e.Data, false, string.Format("!pm {0} ", userName)); // send using PM
             }
         };
     return pmControl;
 }
Ejemplo n.º 29
0
        public ResultWindow(List<List<string>> duplicateResults)
        {
            InitializeComponent();

            MenuItem[] SelectSubitems = new MenuItem[2];
            SelectSubitems[0] = new MenuItem();
            SelectSubitems[0].Text = "First Item in Group";
            SelectSubitems[0].Click += new EventHandler(ResultWindow_Click);
            SelectSubitems[1] = new MenuItem();
            SelectSubitems[1].Text = "Second Item in Group";
            SelectSubitems[1].Click += new EventHandler(ResultWindow2_Click);

            cm.MenuItems.Add(new MenuItem("Select", SelectSubitems));

            cm.MenuItems.Add(new MenuItem("-"));
            cm.MenuItems.Add(new MenuItem("Select All", SelectAll_Click));
            cm.MenuItems.Add(new MenuItem("Select None", SelectNone_Click));
            cm.MenuItems.Add(new MenuItem("Select Inverse", SelectInverse_Click));
            cm.MenuItems.Add(new MenuItem("-"));
            cm.MenuItems.Add(new MenuItem("Delete Selected", DeleteSelected_Click));

            duplicateList.ContextMenu = cm;

            new Thread((ThreadStart)delegate()
            {
                BeginProcessing(duplicateResults);
            }).Start();
        }
        public LayerFilterStatusBar()
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();

            this.ShowPanels = true;
            _selectPanel.Width = _editPanel.Width = _insertPanel.Width = 150;
            _selectPanel.Text = "Select from: ";
            _selectPanel.ToolTipText = _selectPanel.Text;
            _editPanel.Text = "Edit: ";
            _insertPanel.Text = "Draw into: ";

            this.PanelClick +=
                new System.Windows.Forms.StatusBarPanelClickEventHandler(
                        this.statusBarPanelClick);

            _menuItemSelect = new System.Windows.Forms.MenuItem(
                "Choose layers to &Select from...",
                new System.EventHandler(this.MenuItemSelect_Click) );

            _menuItemEdit = new System.Windows.Forms.MenuItem(
                "Choose layers to &Edit...",
                new System.EventHandler(this.MenuItemEdit_Click) );

            _menuItemInsert = new System.Windows.Forms.MenuItem(
                "Choose layers to &Draw new features into...",
                new System.EventHandler(this.MenuItemInsert_Click) );
        }
Ejemplo n.º 31
0
        public Form1()
        {
            this.components = new Container();
            this.contextMenu1 = new ContextMenu();
            this.menuItem1 = new MenuItem();
            this.notifyIcon = new NotifyIcon(this.components);

            this.contextMenu1.MenuItems.AddRange(
                        new MenuItem[] { this.menuItem1 });

            this.menuItem1.Index = 0;
            this.menuItem1.Text = "E&xit";
            menuItem1.Click += new EventHandler(menuItem1_Click);

            this.notifyIcon = new NotifyIcon(this.components);

            notifyIcon.Icon = G930Helper.Properties.Resources.logihelp;

            notifyIcon.ContextMenu = this.contextMenu1;

            notifyIcon.Text = "Logitech G930 Helper";

            notifyIcon.Click += new EventHandler(notifyIcon_Click);
            InitializeComponent();
            TimeoutToHide = TimeSpan.FromMinutes(5);
            System.Timers.Timer aTimer = new System.Timers.Timer();
            aTimer.Elapsed += new ElapsedEventHandler(timer1_Tick);
            aTimer.Interval = 5000;
            aTimer.Enabled = true;
        }
Ejemplo n.º 32
0
        public void AddMenu()
        {
            MainMenu mnuFileMenu = new MainMenu();

            option = new MenuItem("&Options");
            hlp = new MenuItem("&Help");
            aboutDev = new MenuItem("&About Developers");
            nGame = new MenuItem("&New Game");
            ext = new MenuItem("&Exit");
            advanced = new MenuItem("&Show/Hide Developer Console");

            advanced.Shortcut = System.Windows.Forms.Shortcut.F1;

            mnuFileMenu.MenuItems.Add(option);
            mnuFileMenu.MenuItems.Add(hlp);
            hlp.MenuItems.Add(aboutDev);
            option.MenuItems.Add(nGame);
            option.MenuItems.Add(advanced);
            option.MenuItems.Add(ext);

            nGame.Click += new System.EventHandler(this.menuItems_onClick);
            ext.Click += new System.EventHandler(this.menuItems_onClick);
            aboutDev.Click += new System.EventHandler(this.menuItems_onClick);
            advanced.Click += new System.EventHandler(this.menuItems_onClick);
            this.Menu = mnuFileMenu;
        }
Ejemplo n.º 33
0
        private ContextMenu PrinterListContextMenu()
        {
            var contextMenu = new ContextMenu();

            var properties = new MenuItem
            {
                Index = 0,
                Text = "Properties"
            };
            properties.Click += Properties_Click;

            var setAsDefault = new MenuItem
            {
                Index = 1,
                Text = "Set As Default"
            };
            setAsDefault.Click += SetAsDefault_Click;

            var viewDetails = new MenuItem
            {
                Index = 1,
                Text = "View Details"
            };
            viewDetails.Click += ViewDetails_Click;

            contextMenu.MenuItems.AddRange(new MenuItem[] { setAsDefault , viewDetails,properties });

            return contextMenu;
        }
Ejemplo n.º 34
0
		public MainForm ()
		{

			Click += new EventHandler (OnClick);

			MenuItem item1 = new MenuItem ("File");
			MenuItem item2 = new MenuItem ("Print the file");
			MenuItem item3 = new MenuItem ("Print Preview");
			MenuItem item4 = new MenuItem ("-");
			MenuItem item5 = new MenuItem ("Save");
			MenuItem item6 = new MenuItem ("Exit");

			MenuItem item7 = new MenuItem ("Edit");
			item7.BarBreak = true;
			MenuItem item8 = new MenuItem ("Undo");
			MenuItem item9 = new MenuItem ("Cut");
			MenuItem item10 = new MenuItem ("Paste");


			MenuItem item12 = new MenuItem ("Format Table");
			item12.Break = true;
			MenuItem item13 = new MenuItem ("Format Page");

			MenuItem item14 = new MenuItem ();
			item14.Break = true;
			MenuItem item15 = new MenuItem ("Help");

			MenuItem[] items = new MenuItem[] {item1, item2, item3, item4, item5,
				item6, item7, item8, item9, item10, item12,
				item13, item14, item15};

			Text = "Basic ContextMenu Sample";
			context_menu = new 	ContextMenu (items);

		}
Ejemplo n.º 35
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            txtSource.SetVariableNames(this.VariableNames);
            txtTarget.SetVariableNames(this.VariableNames);

            // Add all directories to the button
            foreach (DictionaryEntry var in Environment.GetEnvironmentVariables())
            {
                try
                {
                    if (Directory.Exists(var.Value as string))
                    {
                        MenuItem newItem = new MenuItem(var.Key as string);
                        newItem.Click += new EventHandler(EnvironmentVariableClick);
                        environmentMenu.MenuItems.Add(newItem);
                    }
                }
                catch
                {
                    continue;
                }
            }
        }
Ejemplo n.º 36
0
        internal StatusForm(StatusMonitor statusMonitor, BrowserIntegration browserIntegration, PreferenceStore preferenceStore)
        {
            this.browserIntegration = browserIntegration;
            this.preferenceStore = preferenceStore;

            this.statusMonitor = statusMonitor;

            statusMonitor.DataLoaded += onXmlDataLoaded;

            preferences = preferenceStore.Load();

            MenuItem settingsMenuItem = new MenuItem("Settings...", new EventHandler(onSettingsClicked));
            MenuItem separatorMenuItem = new MenuItem("-");
            MenuItem exitMenuItem = new MenuItem("Exit", new EventHandler(onMenuExitClick));
            MenuItem fileMenu = new MenuItem("File", new MenuItem[] { settingsMenuItem, separatorMenuItem, exitMenuItem });
            MainMenu mainMenu = new MainMenu(new MenuItem[] {fileMenu});
            this.Menu = mainMenu;

            // .NET 1.1 compat
                        EventInfo formClosingEvent = GetType().GetEvent("FormClosing");
                        if (formClosingEvent != null)
                        {
                                formClosingEvent.AddEventHandler(this, new FormClosingEventHandler(this.onClosing));
            }

            InitializeComponent();

            configure();

            timer.Enabled = true;
        }
Ejemplo n.º 37
0
    public Form1()
    {
        // Provide a hook for disposing notifyIcon1
        this.container      = new System.ComponentModel.Container();
        this.RightClickMenu = new System.Windows.Forms.ContextMenu();
        this.menuItem1      = new System.Windows.Forms.MenuItem("E&xit");
        this.subclass       = new MySubclass();

        // Initialize RightClickMenu
        this.RightClickMenu.MenuItems.Add(this.menuItem1);
        this.RightClickMenu.MenuItems.Add("Subclass?", MySubclass);

        // Initialize menuItem1
        this.menuItem1.Index  = 0;
        this.menuItem1.Click += new System.EventHandler(this.MenuItem1_Close);

        // Create the NotifyIcon.
        notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.container);

        notifyIcon1.Visible = true;

        // Set the icon that will appear in the systray.
        notifyIcon1.Icon = new Icon("appicon.ico");

        // Set systray icon right-click menu
        notifyIcon1.ContextMenu = this.RightClickMenu;

        // Set text for tooltip to display
        // when hovering mouse over the systray icon.
        notifyIcon1.Text            = "Form1 NotifyIcon Icon";
        notifyIcon1.BalloonTipTitle = "Form1 notifyIcon1 Balloon Tip Title";

        // DoubleClick event handler activates the form.
        notifyIcon1.DoubleClick += new System.EventHandler(this.NotifyIcon1_DoubleClick);

        // control FormState() MessageBox
        boxing = true;

        // Form1 minimize events launch BallonTips
        this.Resize += new System.EventHandler(this.Form1_Resize);

        /* You get a form, whether wanted or not.
         * It insists on being initially visible
         * unless minimized and hidden on the taskbar.
         */
        FormState("Before Minimixe");
        PreviousWindowState = this.WindowState = FormWindowState.Minimized;
        this.ShowInTaskbar  = false;

        // track Window size changes
        resize_count = 0;

/* Redundant and pointless, here:
 *      this.Hide();
 */

// Visible becomes true AFTER leaving - where documented?
//      FormState("Leaving Form1");
    }
Ejemplo n.º 38
0
 //menuItems---------------------------------------------
 ///<summary>C is for control. Translates the text of this control to another language.</summary>
 public static void C(string classType, System.Windows.Forms.MenuItem mi)
 {
     mi.Text = ConvertString(classType, mi.Text);
     if (itemInserted)
     {
         Refresh();
     }
 }
Ejemplo n.º 39
0
 private void HideWindow(System.Windows.Forms.MenuItem show, System.Windows.Forms.MenuItem hide)
 {
     Visibility   = System.Windows.Visibility.Hidden;
     show.Checked = false;
     show.Enabled = true;
     hide.Checked = true;
     hide.Enabled = false;
 }
Ejemplo n.º 40
0
 ///<summary></summary>
 public static void C(System.Windows.Forms.Control sender, System.Windows.Forms.MenuItem mi)
 {
     mi.Text = ConvertString(sender.GetType().Name, mi.Text);
     if (itemInserted)
     {
         Refresh();
     }
 }
Ejemplo n.º 41
0
        private void Locked(object sender, EventArgs e)
        {
            System.Windows.Forms.MenuItem item = (System.Windows.Forms.MenuItem)sender;
            bool check = item.Checked;

            item.Checked = !check;
            this.move1   = !item.Checked;
        }
Ejemplo n.º 42
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.ItemListLV = new System.Windows.Forms.ListView();
     this.PopupMenu  = new System.Windows.Forms.ContextMenu();
     this.EditMI     = new System.Windows.Forms.MenuItem();
     this.NewMI      = new System.Windows.Forms.MenuItem();
     this.DeleteMI   = new System.Windows.Forms.MenuItem();
     this.SuspendLayout();
     //
     // ItemListLV
     //
     this.ItemListLV.ContextMenu      = this.PopupMenu;
     this.ItemListLV.Dock             = System.Windows.Forms.DockStyle.Fill;
     this.ItemListLV.FullRowSelect    = true;
     this.ItemListLV.Location         = new System.Drawing.Point(0, 0);
     this.ItemListLV.Name             = "ItemListLV";
     this.ItemListLV.ShowItemToolTips = true;
     this.ItemListLV.Size             = new System.Drawing.Size(432, 272);
     this.ItemListLV.Sorting          = System.Windows.Forms.SortOrder.Ascending;
     this.ItemListLV.TabIndex         = 0;
     this.ItemListLV.UseCompatibleStateImageBehavior = false;
     this.ItemListLV.View         = System.Windows.Forms.View.Details;
     this.ItemListLV.DoubleClick += new System.EventHandler(this.EditMI_Click);
     this.ItemListLV.ColumnClick += new ColumnClickEventHandler(SortHandler.listView_ColumnClick);
     //
     // PopupMenu
     //
     this.PopupMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
         this.EditMI,
         this.NewMI,
         this.DeleteMI
     });
     //
     // EditMI
     //
     this.EditMI.Index  = 0;
     this.EditMI.Text   = "&Edit...";
     this.EditMI.Click += new System.EventHandler(this.EditMI_Click);
     //
     // NewMI
     //
     this.NewMI.Index  = 1;
     this.NewMI.Text   = "&New...";
     this.NewMI.Click += new System.EventHandler(this.NewMI_Click);
     //
     // DeleteMI
     //
     this.DeleteMI.Index  = 2;
     this.DeleteMI.Text   = "&Delete";
     this.DeleteMI.Click += new System.EventHandler(this.RemoveMI_Click);
     //
     // ItemListEditCtrl
     //
     this.Controls.Add(this.ItemListLV);
     this.Name = "ItemListEditCtrl";
     this.Size = new System.Drawing.Size(432, 272);
     this.ResumeLayout(false);
 }
Ejemplo n.º 43
0
 private static SWF.Menu GetRootMenu(SWF.MenuItem item)
 {
     SWF.Menu parentMenu = item.GetMainMenu();
     if (parentMenu == null)
     {
         parentMenu = item.GetContextMenu();
     }
     return(parentMenu);
 }
Ejemplo n.º 44
0
 private void ShowWindow(System.Windows.Forms.MenuItem show, System.Windows.Forms.MenuItem hide)
 {
     Visibility = System.Windows.Visibility.Visible;
     Activate();
     show.Checked = true;
     show.Enabled = false;
     hide.Checked = false;
     hide.Enabled = true;
 }
Ejemplo n.º 45
0
        private void AutomaticHideItem_Click(object sender, EventArgs e)
        {
            WF.MenuItem automaticHideItem = (WF.MenuItem)sender;

            configuration.Data.AutomaticFlyoutHideAfterClick = !configuration.Data.AutomaticFlyoutHideAfterClick;
            automaticHideItem.Checked = configuration.Data.AutomaticFlyoutHideAfterClick;

            configuration.Save();
        }
Ejemplo n.º 46
0
        private void OnlyDefaultSchemas_Click(object sender, EventArgs e)
        {
            WF.MenuItem onlyDefaultSchemasItem = (WF.MenuItem)sender;

            configuration.Data.ShowOnlyDefaultSchemas = !configuration.Data.ShowOnlyDefaultSchemas;
            onlyDefaultSchemasItem.Checked            = configuration.Data.ShowOnlyDefaultSchemas;

            configuration.Save();
        }
Ejemplo n.º 47
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.button1         = new System.Windows.Forms.Button();
     this.mainMenu1       = new System.Windows.Forms.MainMenu();
     this.menuItem1       = new System.Windows.Forms.MenuItem();
     this.JpegCompression = new System.Windows.Forms.MenuItem();
     this.ConvertToPNG    = new System.Windows.Forms.MenuItem();
     this.SuspendLayout();
     //
     // button1
     //
     this.button1.Location = new System.Drawing.Point(32, 232);
     this.button1.Name     = "button1";
     this.button1.Size     = new System.Drawing.Size(96, 32);
     this.button1.TabIndex = 0;
     this.button1.Text     = "Save Image";
     this.button1.Click   += new System.EventHandler(this.button1_Click);
     //
     // mainMenu1
     //
     this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
         this.menuItem1
     });
     //
     // menuItem1
     //
     this.menuItem1.Index = 0;
     this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
         this.JpegCompression,
         this.ConvertToPNG
     });
     this.menuItem1.Text = "Encoder/Decoder";
     //
     // JpegCompression
     //
     this.JpegCompression.Index  = 0;
     this.JpegCompression.Text   = "JPEG Compression";
     this.JpegCompression.Click += new System.EventHandler(this.JpegCompression_Click);
     //
     // ConvertToPNG
     //
     this.ConvertToPNG.Index  = 1;
     this.ConvertToPNG.Text   = "Convert to PNG";
     this.ConvertToPNG.Click += new System.EventHandler(this.ConvertToPNG_Click);
     //
     // Form1
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.ClientSize        = new System.Drawing.Size(384, 273);
     this.Controls.AddRange(new System.Windows.Forms.Control[] {
         this.button1
     });
     this.Menu = this.mainMenu1;
     this.Name = "Form1";
     this.Text = "Form1";
     this.ResumeLayout(false);
 }
Ejemplo n.º 48
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.contextMenu              = new System.Windows.Forms.ContextMenu();
     this.menuItemEdit             = new System.Windows.Forms.MenuItem();
     this.menuItemDelete           = new System.Windows.Forms.MenuItem();
     this.menuItemRotate           = new System.Windows.Forms.MenuItem();
     this.menuItemClockwise        = new System.Windows.Forms.MenuItem();
     this.menuItemCounterclockwise = new System.Windows.Forms.MenuItem();
     //
     // contextMenu
     //
     this.contextMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
         this.menuItemEdit,
         this.menuItemDelete,
         this.menuItemRotate
     });
     //
     // menuItemEdit
     //
     this.menuItemEdit.Index  = 0;
     this.menuItemEdit.Text   = "Edit...";
     this.menuItemEdit.Click += new System.EventHandler(this.menuItemEdit_Click);
     //
     // menuItemDelete
     //
     this.menuItemDelete.Index  = 1;
     this.menuItemDelete.Text   = "Delete";
     this.menuItemDelete.Click += new System.EventHandler(this.menuItemDelete_Click);
     //
     // menuItemRotate
     //
     this.menuItemRotate.Index = 2;
     this.menuItemRotate.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
         this.menuItemClockwise,
         this.menuItemCounterclockwise
     });
     this.menuItemRotate.Text = "Rotate";
     //
     // menuItemClockwise
     //
     this.menuItemClockwise.Index  = 0;
     this.menuItemClockwise.Text   = "Clockwise";
     this.menuItemClockwise.Click += new System.EventHandler(this.menuItemClockwise_Click);
     //
     // menuItemCounterclockwise
     //
     this.menuItemCounterclockwise.Index  = 1;
     this.menuItemCounterclockwise.Text   = "Counterclockwise";
     this.menuItemCounterclockwise.Click += new System.EventHandler(this.menuItemCounterclockwise_Click);
     //
     // ProcessStreamBaseControl
     //
     this.ContextMenu = this.contextMenu;
     this.Name        = "ProcessStreamBaseControl";
     //this.Size = new System.Drawing.Size(150, 131);
     this.Size = new System.Drawing.Size(UI.STREAM_CTRL_W, UI.STREAM_CTRL_H);
 }
Ejemplo n.º 49
0
 private static SWF.MouseEventArgs GetMouseArgs(SWF.MenuItem item)
 {
     System.Windows.Rect rect = GetBounds(item);
     return(new SWF.MouseEventArgs(SWF.MouseButtons.Left,
                                   1,
                                   (int)rect.Left + (int)(rect.Width / 2),
                                   (int)rect.Top + (int)(rect.Height / 2),
                                   0));
 }
Ejemplo n.º 50
0
        public static ContextMenu GetBotContextMenu(string botName)
        {
            var contextMenu = new ContextMenu();

            try
            {
                var botStatus = Enumerable.Single <BotBattleStatus>(Program.TasClient.MyBattle.Bots.Values, b => b.Name == botName);

                {
                    var item = new System.Windows.Forms.MenuItem("Remove")
                    {
                        Enabled = botStatus.owner == Program.TasClient.UserName
                    };
                    item.Click += (s, e) => Program.TasClient.RemoveBot(botName);
                    contextMenu.MenuItems.Add(item);
                }
                {
                    var item = new System.Windows.Forms.MenuItem("Ally With")
                    {
                        Enabled = botStatus.owner == Program.TasClient.UserName
                    };
                    int freeAllyTeam;

                    var existingTeams = GetExistingTeams(out freeAllyTeam).Where(t => t != botStatus.AllyNumber).Distinct();
                    if (existingTeams.Any())
                    {
                        foreach (var allyTeam in existingTeams)
                        {
                            var at = allyTeam;
                            if (allyTeam != botStatus.AllyNumber)
                            {
                                var subItem = new System.Windows.Forms.MenuItem("Join Team " + (allyTeam + 1));
                                subItem.Click += (s, e) =>
                                {
                                    Program.TasClient.UpdateBot(botName, botStatus.aiLib, at, botStatus.TeamNumber);
                                };
                                item.MenuItems.Add(subItem);
                            }
                        }
                        item.MenuItems.Add("-");
                    }
                    var newTeamItem = new System.Windows.Forms.MenuItem("New Team");
                    newTeamItem.Click += (s, e) =>
                    {
                        Program.TasClient.UpdateBot(botName, null, freeAllyTeam, null);
                    };
                    item.MenuItems.Add(newTeamItem);
                    contextMenu.MenuItems.Add(item);
                }
            }
            catch (Exception e)
            {
                Trace.WriteLine("Error generating bot context menu: " + e);
            }
            return(contextMenu);
        }
Ejemplo n.º 51
0
 private void InitializeComponent()
 {
     this.mainMenu1          = new System.Windows.Forms.MainMenu();
     this.fileMenu           = new System.Windows.Forms.MenuItem();
     this.fileMenuSeparator1 = new System.Windows.Forms.MenuItem();
     this.fileCloseMenu      = new System.Windows.Forms.MenuItem();
     this.fileOpenMenu       = new System.Windows.Forms.MenuItem();
     this.fileMenuSeparator2 = new System.Windows.Forms.MenuItem();
     //
     // mainMenu1
     //
     this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
         this.fileMenu
     });
     //
     // fileMenu
     //
     this.fileMenu.Index = 0;
     this.fileMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
         this.fileOpenMenu,
         this.fileMenuSeparator1,
         this.fileMenuSeparator2,
         this.fileCloseMenu
     });
     this.fileMenu.Text = "&Datei";
     //
     // fileMenuSeparator1
     //
     this.fileMenuSeparator1.Index = 1;
     this.fileMenuSeparator1.Text  = "-";
     //
     // fileCloseMenu
     //
     this.fileCloseMenu.Index = 3;
     this.fileCloseMenu.Text  = "&Schließen";
     //
     // fileOpenMenu
     //
     this.fileOpenMenu.Index  = 0;
     this.fileOpenMenu.Text   = "&Öffnen";
     this.fileOpenMenu.Click += new System.EventHandler(this.fileOpenMenu_Click);
     //
     // fileMenuSeparator2
     //
     this.fileMenuSeparator2.Index = 2;
     this.fileMenuSeparator2.Text  = "-";
     //
     // StartForm
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.ClientSize        = new System.Drawing.Size(280, 145);
     this.Menu  = this.mainMenu1;
     this.Name  = "StartForm";
     this.Text  = "Laufzeit-Menüs";
     this.Load += new System.EventHandler(this.StartForm_Load);
 }
Ejemplo n.º 52
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
     System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
     this.timer1    = new System.Windows.Forms.Timer(this.components);
     this.mainMenu1 = new System.Windows.Forms.MainMenu();
     this.menuItem1 = new System.Windows.Forms.MenuItem();
     this.menuItem2 = new System.Windows.Forms.MenuItem();
     this.menuItem3 = new System.Windows.Forms.MenuItem();
     //
     // timer1
     //
     this.timer1.Interval = 50;
     this.timer1.Tick    += new System.EventHandler(this.timer1_Tick);
     //
     // mainMenu1
     //
     this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
         this.menuItem1
     });
     //
     // menuItem1
     //
     this.menuItem1.Index = 0;
     this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
         this.menuItem2,
         this.menuItem3
     });
     this.menuItem1.Text = "File";
     //
     // menuItem2
     //
     this.menuItem2.Index  = 0;
     this.menuItem2.Text   = "Restart...";
     this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
     //
     // menuItem3
     //
     this.menuItem3.Index  = 1;
     this.menuItem3.Text   = "Exit";
     this.menuItem3.Click += new System.EventHandler(this.Menu_Exit);
     //
     // Form1
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.BackgroundImage   = ((System.Drawing.Bitmap)(resources.GetObject("$this.BackgroundImage")));
     this.ClientSize        = new System.Drawing.Size(672, 622);
     this.KeyPreview        = true;
     this.Menu      = this.mainMenu1;
     this.Name      = "Form1";
     this.Text      = "Space Invaders Game";
     this.KeyDown  += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown);
     this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.Form1_KeyPress);
     this.KeyUp    += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyUp);
     this.Paint    += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);
 }
Ejemplo n.º 53
0
        private void EnableShortcutsToggleItem_Click(object sender, EventArgs e)
        {
            WF.MenuItem enableShortcutsToggleItem = (WF.MenuItem)sender;

            configuration.Data.ShowOnShortcutSwitch = !configuration.Data.ShowOnShortcutSwitch;
            enableShortcutsToggleItem.Checked       = configuration.Data.ShowOnShortcutSwitch;
            enableShortcutsToggleItem.Enabled       = !(Application.Current as App).HotKeyFailed;

            configuration.Save();
        }
Ejemplo n.º 54
0
        private WF.MenuItem getNewPowerSchemaItem(IPowerSchema powerSchema, EventHandler clickedHandler, bool isChecked)
        {
            var newItemMain = new WF.MenuItem(powerSchema.Name);

            newItemMain.Name    = $"pwrScheme{powerSchema.Guid}";
            newItemMain.Checked = isChecked;
            newItemMain.Click  += clickedHandler;

            return(newItemMain);
        }
        private void ClickMusic(System.Windows.Forms.MenuItem _music)
        {
            music_playName = _music.Text + ".mp3";
            wplayer.URL    = music_playPath + music_playName;
            Debug.WriteLine("{0}", wplayer.URL);

            music_List[currentMusic].Checked = false;
            currentMusic = _music.Index;
            music_List[currentMusic].Checked = true;
        }
Ejemplo n.º 56
0
 public MenuItemProvider(SWF.MenuItem menuItem) :
     base(menuItem)
 {
     this.menuItem = menuItem;
     parentMenu    = mainMenu = menuItem.GetMainMenu();
     if (parentMenu == null)
     {
         parentMenu = menuItem.GetContextMenu();
     }
 }
        private System.Windows.Forms.MenuItem CreateMusicrMenuItem(int mpList_Index)
        {
            var item = new System.Windows.Forms.MenuItem()
            {
                Index = mpList_Index,
                Text  = music_Name[mpList_Index]
            };

            return(item);
        }
        private System.Windows.Forms.MenuItem CreateStickerMenuItem(int sticker_Index)
        {
            var item = new System.Windows.Forms.MenuItem()
            {
                Index = sticker_Index,
                Text  = sticker_Name[sticker_Index]
            };

            return(item);
        }
        private void ClickSticker(System.Windows.Forms.MenuItem _sticker)
        {
            //Debug.WriteLine(_sticker.Text);
            bitmapName = _sticker.Text + ".png";
            CreateFrame();

            sticker_List[currentSticker].Checked = false;
            currentSticker = _sticker.Index;
            sticker_List[currentSticker].Checked = true;
        }
Ejemplo n.º 60
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.mainMenu        = new System.Windows.Forms.MainMenu();
     this.Go              = new System.Windows.Forms.MenuItem();
     this.Stop            = new System.Windows.Forms.MenuItem();
     this.statusBar       = new System.Windows.Forms.StatusBar();
     this.statusBarPanel1 = new System.Windows.Forms.StatusBarPanel();
     ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).BeginInit();
     this.SuspendLayout();
     //
     // mainMenu
     //
     this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.Go, this.Stop });
     //
     // Go
     //
     this.Go.Index  = 0;
     this.Go.Text   = "Go!";
     this.Go.Click += new System.EventHandler(this.Go_Click);
     //
     // Stop
     //
     this.Stop.Index  = 1;
     this.Stop.Text   = "Stop!";
     this.Stop.Click += new System.EventHandler(this.Stop_Click);
     //
     // statusBar
     //
     this.statusBar.Location = new System.Drawing.Point(0, 568);
     this.statusBar.Name     = "statusBar";
     this.statusBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] { this.statusBarPanel1 });
     this.statusBar.ShowPanels = true;
     this.statusBar.Size       = new System.Drawing.Size(768, 22);
     this.statusBar.TabIndex   = 0;
     this.statusBar.Text       = "Ready. Click on the \'GO!\' button to start.";
     //
     // statusBarPanel1
     //
     this.statusBarPanel1.Width = 300;
     //
     // MainForm
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.ClientSize        = new System.Drawing.Size(768, 590);
     this.Controls.Add(this.statusBar);
     this.Menu     = this.mainMenu;
     this.Name     = "MainForm";
     this.Text     = "DominoSnapshotTrigger";
     this.Load    += new System.EventHandler(this.MainForm_Load);
     this.Paint   += new System.Windows.Forms.PaintEventHandler(this.MainForm_Paint);
     this.Closed  += new System.EventHandler(this.MainForm_Closed);
     this.Closing += new System.ComponentModel.CancelEventHandler(this.MainForm_Closing);
     ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).EndInit();
     this.ResumeLayout(false);
 }