本文整理汇总了Python中System.Windows.Forms.Button.Anchor方法的典型用法代码示例。如果您正苦于以下问题:Python Button.Anchor方法的具体用法?Python Button.Anchor怎么用?Python Button.Anchor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Button
的用法示例。
在下文中一共展示了Button.Anchor方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from System.Windows.Forms import Button [as 别名]
# 或者: from System.Windows.Forms.Button import Anchor [as 别名]
def __init__(self):
self.Text = 'Buttons'
self.Size = Size(WIDTH, HEIGHT)
ok = Button()
PANEL_HEIGHT = ok.Height + PANEL_SPACE
panel = Panel()
panel.Height = PANEL_HEIGHT
panel.Dock = DockStyle.Bottom
panel.Parent = self
x = ok.Width * 2 + BUTTONS_SPACE
y = (PANEL_HEIGHT - ok.Height) / 2
ok.Text = "Ok"
ok.Parent = panel
ok.Location = Point(WIDTH-x, y)
ok.Anchor = AnchorStyles.Right
close = Button()
x = close.Width
close.Text = "Close"
close.Parent = panel
close.Location = Point(WIDTH-x-CLOSE_SPACE, y)
close.Anchor = AnchorStyles.Right
self.CenterToScreen()
示例2: __init__
# 需要导入模块: from System.Windows.Forms import Button [as 别名]
# 或者: from System.Windows.Forms.Button import Anchor [as 别名]
def __init__(self):
self.Text = 'Directories'
self.Size = Size(400, 400)
self.tv = TreeView()
self.SuspendLayout()
self.tv.Parent = self
self.tv.Location = Point(10,10)
self.tv.Size = Size(self.ClientSize.Width - 20, self.Height - 200)
self.tv.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right
self.tv.FullRowSelect = False
self.tv.ShowLines = True
self.tv.ShowPlusMinus = True
self.tv.Scrollable = True
self.tv.AfterSelect += self.AfterSelect
expand = Button()
expand.Parent = self
expand.Location = Point(20, self.tv.Bottom + 20)
expand.Text = 'Expand'
expand.Anchor = AnchorStyles.Left | AnchorStyles.Top
expand.Click += self.OnExpand
expandAll = Button()
expandAll.Parent = self
expandAll.Location = Point(20, expand.Bottom + 5)
expandAll.Text = 'Expand All'
expandAll.Anchor = AnchorStyles.Left | AnchorStyles.Top
expandAll.Click += self.OnExpandAll
collapse = Button()
collapse.Parent = self
collapse.Location = Point(expandAll.Right + 5, expand.Top)
collapse.Text = 'Collapse'
collapse.Anchor = AnchorStyles.Left | AnchorStyles.Top
collapse.Click += self.OnCollapse
collapseAll = Button()
collapseAll.Parent = self
collapseAll.Location = Point(collapse.Left, collapse.Bottom + 5)
collapseAll.Text = 'Collapse All'
collapseAll.Anchor = AnchorStyles.Left | AnchorStyles.Top
collapseAll.Click += self.OnCollapseAll
self.sb = StatusBar()
self.sb.Parent = self
self.ShowDirectories(self.tv.Nodes, HOME_DIR)
self.ResumeLayout()
self.CenterToScreen()
示例3: showBox
# 需要导入模块: from System.Windows.Forms import Button [as 别名]
# 或者: from System.Windows.Forms.Button import Anchor [as 别名]
def showBox(self):
'''
set the remaining box controls and launch
'''
self.buttonpanel = Panel()
self.buttonpanel.Parent = self
self.buttonpanel.Location = Point(0,self.panel.Bottom)
self.buttonpanel.Size = Size(Fconfig.smwidth, 2* Fconfig.unitline)
self.buttonpanel.Dock = DockStyle.Bottom
self.warning = Label()
self.warning.Parent = self.buttonpanel
self.warning.Location = Point(Fconfig.margin, 0)
self.warning.Size = Size(Fconfig.smwidth, Fconfig.unitline)
self.warning.Font = Font(Fconfig.basefont, Fconfig.sizefont, FontStyle.Bold)
self.warning.ForeColor = Color.Coral
self.warning.TextAlign = ContentAlignment.MiddleCenter
okay = Button()
okay.Parent = self.buttonpanel
okay.Text = Fconfig.buttonOK
okay.Location = Point(50, Fconfig.unitline)
okay.Width = 140
okay.Click += self.onValidate
okay.Anchor = AnchorStyles.Right
cancel = Button()
cancel.Text = Fconfig.buttonCANCEL
cancel.Parent = self.buttonpanel
cancel.Location = Point(okay.Right, Fconfig.unitline)
cancel.Click += self.onCancel
cancel.Anchor = AnchorStyles.Right
self.Width = Fconfig.width
self.Height = self.panel.Bottom + 105
self.CenterToScreen()
ModeDBG.say('\npanel top :{0}, bottom :{1}'.format(
self.panel.Top, self.panel.Bottom))
ModeDBG.say('\n\nPanel loaded with {0} items\n'.format(
len(self.panelparams)))
# Display the form
try:
if Application.MessageLoop:
TaskDialog.Show('UserForm', 'Another window is running...')
else:
Application.Run(self)
except:
TaskDialog.Show('UserForm','Loading failed...')
示例4: __build_cancelbutton
# 需要导入模块: from System.Windows.Forms import Button [as 别名]
# 或者: from System.Windows.Forms.Button import Anchor [as 别名]
def __build_cancelbutton(self):
''' Builds and returns the cancel button for this form. '''
button = Button()
button.Text="" # gets updated by the 'update' method
def cancel(sender, args):
button.Enabled = False
self.Close()
button.Click+=cancel
button.Location = Point(78, 572)
button.Size = Size(190, 23)
button.Anchor = AnchorStyles.Bottom
return button
示例5: __init__
# 需要导入模块: from System.Windows.Forms import Button [as 别名]
# 或者: from System.Windows.Forms.Button import Anchor [as 别名]
def __init__(self):
self.Text = 'Anchor'
self.Size = Size(210, 210)
btn1 = Button()
btn1.Text = "Button"
btn1.Parent = self
btn1.Location = Point(30, 30)
btn2 = Button()
btn2.Text = "Button"
btn2.Parent = self
btn2.Location = Point(30, 80)
btn2.Anchor = AnchorStyles.Right
self.CenterToScreen()
示例6: __init__
# 需要导入模块: from System.Windows.Forms import Button [as 别名]
# 或者: from System.Windows.Forms.Button import Anchor [as 别名]
def __init__(self):
self.Text = 'Player'
self.Size = Size(350, 280)
mainMenu = MainMenu()
filem = mainMenu.MenuItems.Add("&File")
playm = mainMenu.MenuItems.Add("&Play")
view = mainMenu.MenuItems.Add("&View")
tools = mainMenu.MenuItems.Add("&Tools")
favourites = mainMenu.MenuItems.Add("&Favourites")
help = mainMenu.MenuItems.Add("&Help")
filem.MenuItems.Add(MenuItem("E&xit",
self.OnExit, Shortcut.CtrlX))
self.Menu = mainMenu
panel = Panel()
panel.Parent = self
panel.BackColor = Color.Black
panel.Dock = DockStyle.Fill
buttonPanel = Panel()
buttonPanel.Parent = self
buttonPanel.Height = 40
buttonPanel.Dock = DockStyle.Bottom
pause = Button()
pause.FlatStyle = FlatStyle.Popup
pause.Parent = buttonPanel
pause.Location = Point(5, 10)
pause.Size = Size(25, 25)
pause.Image = Bitmap("pause.png")
play = Button()
play.FlatStyle = FlatStyle.Popup
play.Parent = buttonPanel
play.Location = Point(35, 10)
play.Size = Size(25, 25)
play.Image = Bitmap("play.png")
forward = Button()
forward.FlatStyle = FlatStyle.Popup
forward.Parent = buttonPanel
forward.Location = Point(80, 10)
forward.Size = Size(25, 25)
forward.Image = Bitmap("forward.png")
backward = Button()
backward.FlatStyle = FlatStyle.Popup
backward.Parent = buttonPanel
backward.Location = Point(110, 10)
backward.Size = Size(25, 25)
backward.Image = Bitmap("backward.png")
tb = TrackBar()
tb.Parent = buttonPanel
tb.TickStyle = TickStyle.None
tb.Size = Size(150, 25)
tb.Location = Point(200, 10)
tb.Anchor = AnchorStyles.Right
audio = Button()
audio.FlatStyle = FlatStyle.Popup
audio.Parent = buttonPanel
audio.Size = Size(25, 25)
audio.Image = Bitmap("audio.png")
audio.Location = Point(170, 10)
audio.Anchor = AnchorStyles.Right
sb = StatusBar()
sb.Parent = self
sb.Text = "Ready"
self.CenterToScreen()