def __init__(self):
        self.Text = 'Simple Menu'
        self.Size = Size(380, 200)

        ms = MenuStrip()
        ms.Parent = self

        filem = ToolStripMenuItem("&File")
        exit = ToolStripMenuItem("&Exit", None,
            self.OnExit)

        importm = ToolStripMenuItem()
        importm.Text = "Import"

        filem.DropDownItems.Add(importm)

        temp = ToolStripMenuItem()
        temp.Text = "Import newsfeed list..."
        importm.DropDownItems.Add(temp)

        temp = ToolStripMenuItem()
        temp.Text = "Import bookmarks..."
        importm.DropDownItems.Add(temp)

        temp = ToolStripMenuItem()
        temp.Text = "Import mail..."
        importm.DropDownItems.Add(temp)

        filem.DropDownItems.Add(exit)

        ms.Items.Add(filem)
        self.MainMenuStrip = ms
        
        self.CenterToScreen()
示例#2
0
    def initialiseMenus(self):
        menuStrip = MenuStrip()
        menuStrip.Dock = DockStyle.Top

        fileMenu = self.createMenuItem('&File')
        
        openKeys = Keys.Control | Keys.O
        openMenuItem  = self.createMenuItem(
            '&Open...', 
            lambda sender, event: self.openCommand.execute(),
            keys=openKeys
        )
        
        saveKeys = Keys.Control | Keys.S
        saveMenuItem  = self.createMenuItem(
            '&Save...', 
            lambda sender, event: self.saveCommand.execute(),
            keys=saveKeys
        )

        saveAsKeys = Keys.Control | Keys.Shift | Keys.S
        saveAsMenuItem  = self.createMenuItem(
            'S&ave As...', 
            lambda sender, event: self.saveAsCommand.execute(),
            keys=saveAsKeys
        )
        
        fileMenu.DropDownItems.Add(openMenuItem)
        fileMenu.DropDownItems.Add(saveMenuItem)
        fileMenu.DropDownItems.Add(saveAsMenuItem)
        
        menuStrip.Items.Add(fileMenu)
        self.Controls.Add(menuStrip)
示例#3
0
    def _generate_menu_strip(self):
        menu_strip = MenuStrip()
        menu_strip.Parent = self

        file_item = ToolStripMenuItem("File")
        menu_strip.Items.Add(file_item)

        new_game = ToolStripMenuItem("New game")
        file_item.DropDownItems.Add(new_game)

        self._easy = ToolStripMenuItem("Easy")
        self._easy.Click += self._on_new_game_click
        new_game.DropDownItems.Add(self._easy)

        self._normal = ToolStripMenuItem("Normal")
        self._normal.Click += self._on_new_game_click
        new_game.DropDownItems.Add(self._normal)

        self._hard = ToolStripMenuItem("Hard")
        self._hard.Click += self._on_new_game_click
        new_game.DropDownItems.Add(self._hard)

        self._new_game_handlers = []

        self.checkBox = CheckBox()
        self.checkBox.Text = "Nightmare"
        self.checkBox.Size = Size(100, 20)
        self.checkBox.Checked = False
        nightmare = ToolStripControlHost(self.checkBox)
        nightmare.Size = Size(100, 20)
        new_game.DropDownItems.Add(nightmare)

        self._exit = ToolStripMenuItem("Exit")
        self._exit.Click += self._exit_game
        file_item.DropDownItems.Add(self._exit)
    def __init__(self):
        self.Text = 'Simple Menu'
        self.Size = Size(250, 200)

        ms = MenuStrip()
        ms.Parent = self
        
        filem = ToolStripMenuItem("&File")         
        exit = ToolStripMenuItem("&Exit", None,
            self.OnExit)  
        exit.ShortcutKeys = Keys.Control | Keys.X
        filem.DropDownItems.Add(exit)

        ms.Items.Add(filem)
        self.MainMenuStrip = ms
        
        self.CenterToScreen()
示例#5
0
    def __init__(self):
        self.Text = self.Name = "Gas Property Calculator"
        self.Size = Size(800, 600)

        self.SuspendLayout()

        pc = Plot.PlotControl()
        pc.Location = Point(0, 22)
        pc.Width = 640
        pc.Height = 480
        pc.Dock = DockStyle.Fill
        pc.Plot = self.CreatePlot()
        self.Controls.Add(pc)

        menu = MenuStrip()
        menu.Items.Add(pc.CreatePlotMenu())
        self.Controls.Add(menu)
        self.MainMenuStrip = menu

        self.ResumeLayout()
示例#6
0
def EzMenuBar(parent, menubar_table):
    menubar = MenuStrip()
    menubar.Parent = parent
    for m in menubar_table:
        menubar.Items.Add(EzMenu(m['name'], m['item']))
    return menubar
示例#7
0
    def initialiseMenus(self):
        menuStrip = MenuStrip()
        menuStrip.Dock = DockStyle.Top

        fileMenu = self.createMenuItem('&File')
        
        openKeys = Keys.Control | Keys.O
        openMenuItem  = self.createMenuItem(
            '&Open...', 
            lambda sender, event: self.openCommand.execute(),
            keys=openKeys
        )
        
        newKeys = Keys.Control | Keys.N
        newMenuItem  = self.createMenuItem(
            '&New', 
            lambda sender, event: self.newDocumentCommand.execute(),
            keys=newKeys
        )
        
        saveKeys = Keys.Control | Keys.S
        saveMenuItem  = self.createMenuItem(
            '&Save...', 
            lambda sender, event: self.saveCommand.execute(),
            keys=saveKeys
        )

        saveAsKeys = Keys.Control | Keys.Shift | Keys.S
        saveAsMenuItem  = self.createMenuItem(
            'S&ave As...', 
            lambda sender, event: self.saveAsCommand.execute(),
            keys=saveAsKeys
        )
        
        fileMenu.DropDownItems.Add(newMenuItem)
        fileMenu.DropDownItems.Add(openMenuItem)
        fileMenu.DropDownItems.Add(saveMenuItem)
        fileMenu.DropDownItems.Add(saveAsMenuItem)
        
        editMenu = self.createMenuItem('&Edit')
        
        newPageItem  = self.createMenuItem(
            '&New Page...', 
            lambda sender, event: self.newPageCommand.execute()
        )
        renamePageItem  = self.createMenuItem(
            '&Rename Page...', 
            lambda sender, event: self.renameCommand.execute()
        )
        removePageItem  = self.createMenuItem(
            'Remove &Page...', 
            lambda sender, event: self.removeCommand.execute()
        )

        editMenu.DropDownItems.Add(newPageItem)
        editMenu.DropDownItems.Add(renamePageItem)
        editMenu.DropDownItems.Add(removePageItem)

        menuStrip.Items.Add(fileMenu)
        menuStrip.Items.Add(editMenu)
        self.Controls.Add(menuStrip)