コード例 #1
0
        private void InitializeComponents()
        {
            this.topPanel          = new Panel();
            this.flowPanel         = new FlowLayoutPanel();
            this.usernameTextBox   = new TextBox();
            this.addSkillbarButton = new Button();
            this.getStatsButton    = new Button();
            this.closeTabButton    = new XButton();
            this.closeTabTooltip   = new ToolTip();

            this.UseVisualStyleBackColor = true;

            //
            // topPanel
            //
            this.topPanel.Dock     = DockStyle.Top;
            this.topPanel.Location = new System.Drawing.Point(0, 0);
            this.topPanel.Size     = new System.Drawing.Size(0, 32);
            //
            // flowPanel
            //
            this.flowPanel.Padding    = new Padding(0, 0, 0, 20);
            this.flowPanel.Dock       = DockStyle.Fill;
            this.flowPanel.AutoScroll = true;
            this.AllowDrop            = true;
            //
            // usernameTextBox
            //
            this.usernameTextBox.Location = new System.Drawing.Point(1, 6);
            this.usernameTextBox.Name     = "usernameTextBox";
            this.usernameTextBox.Size     = new System.Drawing.Size(248, 20);
            this.usernameTextBox.TabIndex = 0;
            this.usernameTextBox.Text     = (TrackingPlayer != null) ? this.TrackingPlayer.Username : defaultUsername;
            //
            // getStatsButton
            //
            this.getStatsButton.Location = new System.Drawing.Point(255, 6);
            this.getStatsButton.Name     = "getStatsButton";
            this.getStatsButton.Size     = new System.Drawing.Size(60, 20);
            this.getStatsButton.TabIndex = 1;
            this.getStatsButton.Text     = "Refresh";
            this.getStatsButton.UseVisualStyleBackColor = true;
            this.getStatsButton.Click += new EventHandler(getStatsButton_Click);
            //
            // addSkillbarButton
            //
            this.addSkillbarButton.Dock      = System.Windows.Forms.DockStyle.Bottom;
            this.addSkillbarButton.Location  = new System.Drawing.Point(3, 32);
            this.addSkillbarButton.Name      = "addSkillbarButton";
            this.addSkillbarButton.Size      = new System.Drawing.Size(623, 20);
            this.addSkillbarButton.TabIndex  = 2;
            this.addSkillbarButton.Text      = " + Track another skill";
            this.addSkillbarButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.addSkillbarButton.UseVisualStyleBackColor = true;
            this.addSkillbarButton.Click += new System.EventHandler(addSkillbarButton_Click);
            //
            // closeTabButton
            //
            this.closeTabButton.Location = new System.Drawing.Point(618, 0);
            this.closeTabButton.Click   += new System.EventHandler(closeTabButton_Click);
            this.closeTabTooltip.SetToolTip(closeTabButton, "Close this user tracker tab.");

            this.Controls.Add(this.topPanel);
            this.topPanel.Controls.Add(this.usernameTextBox);
            this.topPanel.Controls.Add(this.getStatsButton);
            this.topPanel.Controls.Add(this.closeTabButton);
            this.Controls.Add(this.flowPanel);
            this.Controls.Add(this.addSkillbarButton);
        }
コード例 #2
0
ファイル: SkillTrackerBar.cs プロジェクト: PRSears/RS_Tracker
        private void InitializeComponents()
        {
            this.Size      = SkillTrackerBar.BarSize;
            this.AllowDrop = true;

            this.SkillsDropdown   = new ComboBox();
            this.SkillProgressBar = new ProgressBar();
            this.CurSkillExpBox   = new TextBox();
            this.GoalBox          = new TextBox();
            this.DividerLabel     = new Label();
            this.GoalTypeDropdown = new ComboBox();
            this.CloseButton      = new XButton();

            this.Controls.Add(this.CloseButton);
            this.Controls.Add(this.SkillsDropdown);
            this.Controls.Add(this.SkillProgressBar);
            this.Controls.Add(this.CurSkillExpBox);
            this.Controls.Add(this.GoalBox);
            this.Controls.Add(this.DividerLabel);
            this.Controls.Add(this.GoalTypeDropdown);

            this.CloseButton.Size     = new Size(18, 14);
            this.CloseButton.Location = new Point(-3, 6);
            this.Controls.SetChildIndex(this.CloseButton, 10);
            this.CloseButton.Click += new System.EventHandler(closeButton_Click);

            this.SkillsDropdown.FormattingEnabled = true;
            foreach (Skills skill in Skills.SkillList)
            {
                if (skill != Skills.Placeholder)
                {
                    this.SkillsDropdown.Items.Add(skill.ToString());
                }
            }
            this.SkillsDropdown.SelectedIndex   = this.SkillsDropdown.Items.IndexOf(this.SkillName.ToString());
            this.SkillsDropdown.Location        = new Point(18, this.Margin.Top);
            this.SkillsDropdown.Name            = "SkillsDropdown";
            this.SkillsDropdown.Size            = new Size(101, 20);
            this.SkillsDropdown.DropDownClosed += new EventHandler(SkillsDropdown_Closed);

            this.SkillProgressBar.Location   = new Point(125, this.Margin.Top);
            this.SkillProgressBar.Name       = "SkillProgressBar";
            this.SkillProgressBar.Size       = new Size(262, 20);
            this.SkillProgressBar.MouseDown += new MouseEventHandler(SkillProgressBar_Click);

            this.CurSkillExpBox.Location  = new Point(393, this.Margin.Top);
            this.CurSkillExpBox.Name      = "CurSkillExpBox";
            this.CurSkillExpBox.ReadOnly  = true;
            this.CurSkillExpBox.TextAlign = HorizontalAlignment.Center;
            this.CurSkillExpBox.Size      = new Size(66, 20);
            this.CurSkillExpBox.Text      = "0";

            this.GoalBox.Location     = new Point(483, this.Margin.Top);
            this.GoalBox.Name         = "GoalBox";
            this.GoalBox.TextAlign    = HorizontalAlignment.Center;
            this.GoalBox.Size         = new Size(66, 20);
            this.GoalBox.Text         = Skill.MaxSkillXP.ToString("N0");
            this.GoalBox.TextChanged += new EventHandler(GoalBox_TextChanged);
            this.GoalBox.Enter       += new EventHandler(GoalBox_Entered);
            this.GoalBox.Leave       += new EventHandler(GoalBox_Left);

            this.DividerLabel.AutoSize = true;
            this.DividerLabel.Location = new Point(465, this.Margin.Top);
            this.DividerLabel.Name     = "DividerLabel";
            this.DividerLabel.Size     = new Size(12, 13);
            this.DividerLabel.Text     = "/";

            this.GoalTypeDropdown.FormattingEnabled = true;
            this.GoalTypeDropdown.Items.AddRange(new object[] { "By Exp", "By Level" });
            this.GoalTypeDropdown.SelectedIndex   = 0;
            this.GoalTypeDropdown.Location        = new System.Drawing.Point(555, this.Margin.Top);
            this.GoalTypeDropdown.Name            = "GoalTypeDropdown";
            this.GoalTypeDropdown.Size            = new System.Drawing.Size(63, 20);
            this.GoalTypeDropdown.DropDownClosed += new EventHandler(GoalTypeDropdown_Closed);

            this.SortByExp = true;

            this.Refresh();
        }