コード例 #1
0
ファイル: MainForm.py プロジェクト: madlinux/ironpython
    def _layout(self):
        upperPanel = Panel()
        upperPanel.Top = self.menuStrip.Height + self.PADDING
        upperPanel.Left = self.PADDING
        upperPanel.Width = self.ClientSize.Width - (2 * self.PADDING)
        upperPanel.Anchor = (AnchorStyles.Left |
                             AnchorStyles.Top |
                             AnchorStyles.Right)

        upperPanel.Controls.Add(self.postTextBox)
        upperPanel.Controls.Add(self.postButton)

        self.postTextBox.Left = 0
        self.postTextBox.Top = 0
        self.postTextBox.Width = (upperPanel.ClientSize.Width -
                                  self.postButton.Width -
                                  self.PADDING)
        self.postTextBox.Height *= 2
        self.postTextBox.Anchor = (AnchorStyles.Top |
                                   AnchorStyles.Left |
                                   AnchorStyles.Right)

        self.postButton.Left = self.postTextBox.Width + self.PADDING
        self.postButton.Top = 0
        self.postButton.Anchor = (AnchorStyles.Top |
                                 AnchorStyles.Right)

        upperPanel.Height = self.postTextBox.Height

        self.Controls.Add(upperPanel)

        lowerPanel = Panel()
        lowerPanel.Width = upperPanel.Width
        lowerPanel.Top = upperPanel.Top + upperPanel.Height + self.PADDING
        lowerPanel.Left = self.PADDING
        lowerPanel.Height = (self.ClientSize.Height -
                             lowerPanel.Top -
                             self.PADDING)
        lowerPanel.Anchor = (AnchorStyles.Top |
                             AnchorStyles.Left |
                             AnchorStyles.Right |
                             AnchorStyles.Bottom)

        self.friendsListBox.Top = 0
        self.friendsListBox.Left = 0
        self.friendsListBox.Anchor = (AnchorStyles.Top |
                                      AnchorStyles.Left |
                                      AnchorStyles.Bottom)
        self.friendsListBox.Height = lowerPanel.ClientSize.Height
        lowerPanel.Controls.Add(self.friendsListBox)

        self.tweetsPanel = Panel()
        self.tweetsPanel.BorderStyle = BorderStyle.FixedSingle
        self.tweetsPanel.Anchor = (AnchorStyles.Top |
                                   AnchorStyles.Left |
                                   AnchorStyles.Right |
                                   AnchorStyles.Bottom)
        self.tweetsPanel.AutoScroll = True
        self.tweetsPanel.Top = 0
        self.tweetsPanel.Left = self.friendsListBox.Width + self.PADDING
        self.tweetsPanel.Width = (lowerPanel.ClientSize.Width -
                                  self.tweetsPanel.Left)
        self.tweetsPanel.Height = lowerPanel.ClientSize.Height
        lowerPanel.Controls.Add(self.tweetsPanel)

        self.Controls.Add(lowerPanel)
コード例 #2
0
ファイル: MainForm.py プロジェクト: madlinux/ironpython
    def _layout(self):
        upperPanel = Panel()
        upperPanel.Top = self.menuStrip.Height + self.PADDING
        upperPanel.Left = self.PADDING
        upperPanel.Width = self.ClientSize.Width - (2 * self.PADDING)

        # Practical 1: add the Post button to the form's upper panel

        # Practical 2: uncomment each of the commented lines
        # below, and observe the effect of each on the application form

        # upperPanel.Anchor = (AnchorStyles.Left |
        #                      AnchorStyles.Top |
        #                      AnchorStyles.Right)

        upperPanel.Controls.Add(self.postTextBox)

        self.postTextBox.Left = 0
        self.postTextBox.Top = 0
        self.postTextBox.Width = (upperPanel.ClientSize.Width -
        #                           self.postButton.Width -
                                  self.PADDING)
        self.postTextBox.Height *= 2
        # self.postTextBox.Anchor = (AnchorStyles.Top |
        #                            AnchorStyles.Left |
        #                            AnchorStyles.Right)

        # self.postButton.Left = self.postTextBox.Width + self.PADDING
        # self.postButton.Top = 0
        # self.postButton.Anchor = (AnchorStyles.Top |
        #                          AnchorStyles.Right)

        upperPanel.Height = self.postTextBox.Height

        self.Controls.Add(upperPanel)

        lowerPanel = Panel()
        lowerPanel.Width = upperPanel.Width
        lowerPanel.Top = upperPanel.Top + upperPanel.Height + self.PADDING
        lowerPanel.Left = self.PADDING
        lowerPanel.Height = (self.ClientSize.Height -
                             lowerPanel.Top -
                             self.PADDING)
        lowerPanel.Anchor = (AnchorStyles.Top |
                             AnchorStyles.Left |
                             AnchorStyles.Right |
                             AnchorStyles.Bottom)

        self.friendsListBox.Top = 0
        self.friendsListBox.Left = 0
        self.friendsListBox.Anchor = (AnchorStyles.Top |
                                      AnchorStyles.Left |
                                      AnchorStyles.Bottom)
        self.friendsListBox.Height = lowerPanel.ClientSize.Height
        lowerPanel.Controls.Add(self.friendsListBox)

        self.tweetsPanel = Panel()
        self.tweetsPanel.BorderStyle = BorderStyle.FixedSingle
        self.tweetsPanel.Anchor = (AnchorStyles.Top |
                                   AnchorStyles.Left |
                                   AnchorStyles.Right |
                                   AnchorStyles.Bottom)
        self.tweetsPanel.AutoScroll = True
        self.tweetsPanel.Top = 0
        self.tweetsPanel.Left = self.friendsListBox.Width + self.PADDING
        self.tweetsPanel.Width = (lowerPanel.ClientSize.Width -
                                  self.tweetsPanel.Left)
        self.tweetsPanel.Height = lowerPanel.ClientSize.Height
        lowerPanel.Controls.Add(self.tweetsPanel)

        self.Controls.Add(lowerPanel)