コード例 #1
0
        public frmNumberTracks(int First, int Range)
            : base(Localization.Get(UI_Key.Number_Tracks_Title), ButtonCreateType.OKAndCancel)
        {
            range = Range;

            this.ClientSize     = new System.Drawing.Size(350, 100);
            lblHeading          = new QLabel(Localization.Get(UI_Key.Number_Tracks_Heading));
            lblHeading.Location = new System.Drawing.Point(MARGIN, MARGIN);
            this.Controls.Add(lblHeading);
            lblHeading.SetWidth(this.ClientRectangle.Width - MARGIN - MARGIN);

            int ypos = lblHeading.Bottom + SPACING;

            spnFirst               = new QSpin(false, false, Localization.Get(UI_Key.Number_Tracks_First), String.Empty, 1, 200, 1, 1, this.BackColor);
            spnFirst.Value         = First;
            spnFirst.Location      = new System.Drawing.Point(MARGIN + MARGIN, ypos);
            spnFirst.ValueChanged += valueChanged;
            this.Controls.Add(spnFirst);

            ypos = spnFirst.Bottom + SPACING;

            lblLast          = new QLabel(Localization.Get(UI_Key.Number_Tracks_Last, (First + range - 1).ToString()));
            lblLast.Location = new System.Drawing.Point(MARGIN + MARGIN, ypos);
            lblLast.SetWidth(this.ClientRectangle.Width - MARGIN - MARGIN - MARGIN);
            this.Controls.Add(lblLast);

            ypos = lblLast.Bottom + SPACING;

            PlaceButtons(this.ClientRectangle.Right, ypos);

            this.ClientSize = new System.Drawing.Size(this.ClientSize.Width, btnOK.Bottom + MARGIN);

            spnFirst.Focus();
        }
コード例 #2
0
        public frmGamepadHelp() : base(Localization.Get(UI_Key.Gamepad_Help_Title), ButtonCreateType.OKOnly)
        {
            GamepadEnabled = false;

            gamePadImage = Styles.BitmapGamePad;

            this.ClientSize = new Size(gamePadImage.Width + 30, 1000);

            lblInstructions = new QLabel(Localization.Get(UI_Key.Gamepad_Help_Instructions));
            this.Controls.Add(lblInstructions);
            lblInstructions.Location = new Point(MARGIN, MARGIN);
            lblInstructions.SetWidth(this.ClientSize.Width - MARGIN - MARGIN);

            btnOK.Text = Localization.Get(UI_Key.Gamepad_Help_Exit);

            this.ClientSize = new Size(this.ClientSize.Width, lblInstructions.Bottom + gamePadImage.Height + MARGIN + MARGIN + btnOK.Height + 5);

            PlaceButtons(this.ClientRectangle.Width, this.ClientRectangle.Height - btnOK.Height - MARGIN);

            btnOK.BackColor = Color.Black;

            setupPadLocations();

            showMessage(Localization.Get(UI_Key.Gamepad_Help_Press_Button));
        }
コード例 #3
0
ファイル: QMessageBox.cs プロジェクト: usmanatron/quuxplayer
        protected QMessageBox(string Text, string Title, QMessageBoxButtons Buttons, QMessageBoxIcon Icon, QMessageBoxButton DefaultButton) : base(Title, (Buttons == QMessageBoxButtons.OK) ? ButtonCreateType.OKOnly : ButtonCreateType.OKAndCancel)
        {
            this.SPACING = 8;

            this.ClientSize = new Size(400, 300);

            icon = Icon;

            int textWidth = TextRenderer.MeasureText(Text, Styles.Font).Width;
            int iconWidth = (icon == QMessageBoxIcon.None) ? 0 : getIcon().Width + 5;

            int width;

            int baseWidth = textWidth + iconWidth;

            if (baseWidth < 300)
                width = Math.Max(150, baseWidth + 50);
            else if (baseWidth > 400)
                width = 400 + SPACING + iconWidth;
            else
                width = 350;

            lblMain = new QLabel(Text);
            this.Controls.Add(lblMain);
            lblMain.Location = new Point(SPACING + iconWidth, SPACING);
            lblMain.SetWidth(width - lblMain.Left - 2 * SPACING);

            iconTop = Math.Max(lblMain.Top, lblMain.Top + lblMain.Height / 2 - getIcon().Height);

            qmbButtons = Buttons;

            switch (qmbButtons)
            {
                case QMessageBoxButtons.OK:
                    btn1 = btnOK;
                    break;
                case QMessageBoxButtons.OKCancel:
                    btn1 = btnCancel;
                    btn2 = btnOK;
                    break;
                case QMessageBoxButtons.YesNo:
                    btn1 = btnCancel;
                    btn1.Text = Localization.NO;
                    btn2 = btnOK;
                    btn2.Text = Localization.YES;
                    break;
            }
            PlaceButtons(width, lblMain.Bottom + SPACING);
            this.ClientSize = new Size(width, btn1.Bottom + SPACING);

            Lib.DoEvents();
            Lib.Beep();

            defaultButton = DefaultButton;

            Clock.DoOnMainThread(doFocus);
        }
コード例 #4
0
        public frmLock(QLock Lock) : base(Localization.Get(UI_Key.Lock_Title), ButtonCreateType.OKAndCancel)
        {
            this.ClientSize = new Size(400, 300);

            lblInstructions          = new QLabel(Localization.Get(UI_Key.Lock_Instructions, Application.ProductName));
            lblInstructions.Location = new Point(SPACING, SPACING);
            lblInstructions.SetWidth(this.ClientRectangle.Width - 2 * SPACING);
            this.Controls.Add(lblInstructions);

            chkMain                 = new QCheckBox(Localization.Get(UI_Key.Lock_Checkbox), this.BackColor);
            chkMain.Checked         = Lock != null && Lock.Locked;
            chkMain.Location        = new Point(2 * SPACING, lblInstructions.Bottom + SPACING);
            chkMain.CheckedChanged += new EventHandler(chkMainCheckedChanged);
            this.Controls.Add(chkMain);

            chkCode                 = new QCheckBox(Localization.Get(UI_Key.Lock_Code), this.BackColor);
            chkCode.Checked         = (Lock != null) && (Lock.Code.Length > 0);
            chkCode.Location        = new Point(3 * SPACING, chkMain.Bottom + SPACING);
            chkCode.CheckedChanged += (s, e) => { txtCode.Enabled = chkCode.Checked; };
            this.Controls.Add(chkCode);

            txtCode           = new QTextBox();
            txtCode.Text      = (Lock != null) ? Lock.Code : String.Empty;
            txtCode.MaxLength = QLock.MAX_CODE_LENGTH;
            txtCode.Location  = new Point(chkCode.Right + SPACING, chkCode.Top + chkCode.Height / 2 - txtCode.Height / 2 + 2);
            txtCode.Enabled   = chkCode.Checked;
            this.Controls.Add(txtCode);

            chkGamepadLock          = new QCheckBox(Localization.Get(UI_Key.Lock_Gamepad), this.BackColor);
            chkGamepadLock.Checked  = (Lock != null) && Lock.GamepadLock;
            chkGamepadLock.Location = new Point(3 * SPACING, chkCode.Bottom + SPACING);
            this.Controls.Add(chkGamepadLock);

            //btnCancel.Location = new Point(this.ClientRectangle.Width - btnCancel.Width - SPACING, chkGamepadLock.Bottom + SPACING);

            //btnOK.Location = new Point(btnCancel.Left - btnOK.Width - SPACING, btnCancel.Top);

            PlaceButtons(this.ClientRectangle.Width, chkGamepadLock.Bottom + SPACING);

            this.ClientSize = new Size(this.ClientRectangle.Width, btnOK.Bottom + SPACING);

            this.chkMainCheckedChanged(this, EventArgs.Empty);

            int tabIndex = 0;

            chkMain.TabIndex        = tabIndex++;
            chkCode.TabIndex        = tabIndex++;
            txtCode.TabIndex        = tabIndex++;
            chkGamepadLock.TabIndex = tabIndex++;
            btnOK.TabIndex          = tabIndex++;
            btnCancel.TabIndex      = tabIndex++;
        }
コード例 #5
0
        public frmAbout(Controller Controller) : base("About " + Application.ProductName, ButtonCreateType.OKAndCancelReverse)
        {
            this.controller = Controller;

            int ypos = MARGIN + MARGIN;

            this.ClientSize = new Size(450, 300);

            lblTitle = new QLabel(Application.ProductName, Styles.FontLarge);
            lblTitle.SetWidth(this.ClientRectangle.Width - MARGIN - MARGIN);
            lblTitle.Location = new Point(MARGIN, ypos);
            this.Controls.Add(lblTitle);
            ypos = lblTitle.Bottom + SPACING;

            lblVersion = new QLabel(Localization.Get(UI_Key.About_Version, Application.ProductVersion), Styles.FontBold);
            lblVersion.SetWidth(lblTitle.Width);
            lblVersion.Location = new Point(MARGIN, ypos);
            this.Controls.Add(lblVersion);
            ypos = lblVersion.Bottom + SPACING + SPACING + SPACING;

            lblRegInfo          = new QLabel(Notices.ActivationInfo);
            lblRegInfo.Location = new Point(MARGIN, ypos);
            lblRegInfo.SetWidth(lblVersion.Width);
            this.Controls.Add(lblRegInfo);
            ypos = lblRegInfo.Bottom + SPACING;

            lblSmallPrint          = new QLabel(Notices.CopyrightNotice, Styles.FontSmall);
            lblSmallPrint.Location = new Point(MARGIN, ypos);
            lblSmallPrint.SetWidth(this.lblRegInfo.Width);
            this.Controls.Add(lblSmallPrint);
            ypos = lblSmallPrint.Bottom + SPACING;

            btnOK.Text = Localization.Get(UI_Key.About_License_Agreement);

            PlaceButtons(this.ClientRectangle.Width, ypos);

            this.ClientSize = new Size(this.ClientRectangle.Width,
                                       btnOK.Bottom + SPACING);

            btnCancel.Focus();

            alfredIndex = 0;

            backgroundBrush = Style.GetDialogBackgroundBrush(this.ClientRectangle.Height);
        }
コード例 #6
0
        private void setupControls()
        {
            lblInstructions.Location = new Point(SPACING, SPACING);

            lblInstructions.SetWidth(this.ClientRectangle.Width - SPACING - SPACING);

            txtTime.Location = new Point(2 * SPACING, lblInstructions.Bottom + SPACING + SPACING);

            lblAndThen.Location = new Point(2 * SPACING, txtTime.Bottom + SPACING);

            cboAction.Location = new Point(lblAndThen.Right + 5, lblAndThen.Top + lblAndThen.Height / 2 - cboAction.Height / 2);

            txtFadeTime.Location = new Point(4 * SPACING, cboAction.Bottom + SPACING);

            int buttonTop = txtFadeTime.Bottom + 2 * SPACING;

            chkForce.Location = new Point(2 * SPACING,
                                          buttonTop + btnOK.Height / 2 - chkForce.Height / 2);

            int x = 400;

            foreach (Control c in this.Controls)
            {
                x = Math.Max(x, c.Right);
            }

            this.ClientSize = new Size(x + SPACING, buttonTop + btnOK.Height + SPACING);

            PlaceButtons(this.ClientRectangle.Width, buttonTop);

            //btnCancel.Location = new Point(this.ClientRectangle.Width - btnCancel.Width - SPACING,
            //                             buttonTop);

            //btnOK.Location = new Point(btnCancel.Left - btnOK.Width - SPACING,
            //                         buttonTop);
        }
コード例 #7
0
        private void arrangeControls()
        {
            if (initialized)
            {
                lblInstructions.Location = new Point(MARGIN, MARGIN);
                lblInstructions.SetWidth(this.ClientRectangle.Width - MARGIN - MARGIN);

                //btnCancel.Location = new Point(this.ClientRectangle.Width - MARGIN - btnCancel.Width,
                //                           this.ClientRectangle.Height - MARGIN - btnCancel.Height);

                //btnOK.Location = new Point(btnCancel.Left - MARGIN - btnOK.Width, btnCancel.Top);
                //btnRemove.Location = new Point(btnOK.Left - MARGIN - btnRemove.Width, btnCancel.Top);
                //btnAdd.Location = new Point(btnRemove.Left - MARGIN - btnAdd.Width, btnCancel.Top);

                PlaceButtons(this.ClientRectangle.Width,
                             this.ClientRectangle.Height - MARGIN - btnCancel.Height,
                             btnCancel,
                             btnOK,
                             btnRemove,
                             btnAdd);

                lstDirectories.Bounds = new Rectangle(MARGIN, lblInstructions.Bottom + MARGIN, this.ClientRectangle.Width - MARGIN - MARGIN, btnCancel.Top - MARGIN - lblInstructions.Bottom - MARGIN);
            }
        }
コード例 #8
0
ファイル: frmTwitter.cs プロジェクト: usmanatron/quuxplayer
        public frmTwitter() : base(Localization.Get(UI_Key.Twitter_Title), ButtonCreateType.OKAndCancel)
        {
            this.ClientSize = new Size(420, 200);

            lblInstructions          = new QLabel(Localization.Get(UI_Key.Twitter_Instructions, Application.ProductName));
            lblInstructions.Location = new Point(MARGIN, MARGIN);
            lblInstructions.SetWidth(this.ClientRectangle.Width - MARGIN - MARGIN);
            this.Controls.Add(lblInstructions);

            chkEnable                 = new QCheckBox(Localization.Get(UI_Key.Twitter_Enable), this.BackColor);
            chkEnable.Location        = new Point(MARGIN, lblInstructions.Bottom + MARGIN + MARGIN);
            chkEnable.CheckedChanged += new EventHandler(enableCheckChanged);
            this.Controls.Add(chkEnable);

            lblUserName = new QLabel(Localization.Get(UI_Key.Twitter_User_Name));
            lblPassword = new QLabel(Localization.Get(UI_Key.Twitter_Password));

            txtUserName              = new QTextBox();
            txtUserName.Text         = Twitter.UserName;
            txtUserName.MaxLength    = 64;
            txtUserName.TextChanged += new EventHandler(textChanged);

            txtPassword              = new QTextBox();
            txtPassword.Text         = Twitter.Password;
            txtPassword.MaxLength    = 64;
            txtPassword.TextChanged += new EventHandler(textChanged);
            txtPassword.PasswordChar = '*';

            lblUserName.Location = new Point(2 * MARGIN, chkEnable.Bottom + MARGIN + MARGIN + (txtUserName.Height - lblUserName.Height) / 2);
            lblPassword.Location = new Point(2 * MARGIN, lblUserName.Top + MARGIN + txtUserName.Height);

            this.Controls.Add(lblUserName);
            this.Controls.Add(lblPassword);

            int x = Math.Max(lblUserName.Right, lblPassword.Right) + MARGIN;

            txtUserName.Location = new Point(x, lblUserName.Top + (lblUserName.Height - txtUserName.Height) / 2);
            txtPassword.Location = new Point(x, lblPassword.Top + (lblPassword.Height - txtPassword.Height) / 2);

            this.Controls.Add(txtUserName);
            this.Controls.Add(txtPassword);

            lblMode = new QLabel("Post A Tweet With Each:");
            this.Controls.Add(lblMode);
            lblMode.Location = new Point(4 * MARGIN, txtPassword.Bottom + MARGIN);

            cboMode = new QComboBox(false);
            cboMode.Items.Add(Localization.Get(UI_Key.Twitter_Mode_Song));
            cboMode.Items.Add(Localization.Get(UI_Key.Twitter_Mode_Album));

            this.Controls.Add(cboMode);

            cboMode.Location = new Point(lblMode.Right + MARGIN, lblMode.Top + (lblMode.Height - cboMode.Height) / 2);

            switch (Twitter.TwitterMode)
            {
            case Twitter.Mode.Album:
                cboMode.SelectedIndex = cboMode.FindStringExact(Localization.Get(UI_Key.Twitter_Mode_Album));
                break;

            default:
                cboMode.SelectedIndex = cboMode.FindStringExact(Localization.Get(UI_Key.Twitter_Mode_Song));
                break;
            }

            btnTest = new QButton(Localization.Get(UI_Key.Twitter_Test), false, false);
            AddButton(btnTest, test);

            btnViewOnWeb = new QButton(Localization.Get(UI_Key.Twitter_View_On_Web), false, false);
            AddButton(btnViewOnWeb, viewOnWeb);

            PlaceButtons(this.ClientRectangle.Width,
                         cboMode.Bottom + MARGIN + MARGIN,
                         btnCancel,
                         btnOK,
                         btnTest,
                         btnViewOnWeb);

            this.ClientSize = new Size(this.ClientRectangle.Width, btnCancel.Bottom + MARGIN);

            int tabIndex = 0;

            chkEnable.TabIndex   = tabIndex++;
            txtUserName.TabIndex = tabIndex++;
            txtPassword.TabIndex = tabIndex++;

            btnViewOnWeb.TabIndex = tabIndex++;
            btnTest.TabIndex      = tabIndex++;
            btnOK.TabIndex        = tabIndex++;
            btnCancel.TabIndex    = tabIndex++;

            chkEnable.Checked = Twitter.On;
            enableControls();
        }
コード例 #9
0
        public frmFileAssociations() : base(Localization.Get(UI_Key.File_Associations_Title), ButtonCreateType.OKAndCancel)
        {
            this.Size = new System.Drawing.Size(430, this.Size.Height);

            lblInstructions = new QLabel(Localization.Get(UI_Key.File_Associations_Instructions));
            this.Controls.Add(lblInstructions);
            lblInstructions.Location = new System.Drawing.Point(MARGIN, MARGIN);
            lblInstructions.SetWidth(this.Width - MARGIN - MARGIN);

            int x = MARGIN * 3;

            lblAudioFiles = new QLabel("Audio Files", Styles.FontBold);
            this.Controls.Add(lblAudioFiles);
            lblAudioFiles.Location = new System.Drawing.Point(MARGIN, lblInstructions.Bottom + MARGIN + MARGIN);

            chkMP3 = new QCheckBox(Localization.Get(UI_Key.File_Associations_MP3), this.BackColor);
            this.Controls.Add(chkMP3);
            chkMP3.Location = new System.Drawing.Point(x, lblAudioFiles.Bottom + MARGIN);

            chkWMA = new QCheckBox(Localization.Get(UI_Key.File_Associations_WMA), this.BackColor);
            this.Controls.Add(chkWMA);
            chkWMA.Location = new System.Drawing.Point(x, chkMP3.Bottom + MARGIN);

            chkOGG = new QCheckBox(Localization.Get(UI_Key.File_Associations_OGG), this.BackColor);
            this.Controls.Add(chkOGG);
            chkOGG.Location = new System.Drawing.Point(x, chkWMA.Bottom + MARGIN);

            chkFLAC = new QCheckBox(Localization.Get(UI_Key.File_Associations_FLAC), this.BackColor);
            this.Controls.Add(chkFLAC);
            chkFLAC.Location = new System.Drawing.Point(x, chkOGG.Bottom + MARGIN);

            chkM4A = new QCheckBox(Localization.Get(UI_Key.File_Associations_iTunes), this.BackColor);
            this.Controls.Add(chkM4A);
            chkM4A.Location = new System.Drawing.Point(x, chkFLAC.Bottom + MARGIN);

            chkWV = new QCheckBox(Localization.Get(UI_Key.File_Associations_WV), this.BackColor);
            this.Controls.Add(chkWV);
            chkWV.Location = new System.Drawing.Point(x, chkM4A.Bottom + MARGIN);

            chkAPE = new QCheckBox(Localization.Get(UI_Key.File_Associations_APE), this.BackColor);
            this.Controls.Add(chkAPE);
            chkAPE.Location = new System.Drawing.Point(x, chkWV.Bottom + MARGIN);

            lblPlaylistFiles = new QLabel("Playlist Files", Styles.FontBold);
            this.Controls.Add(lblPlaylistFiles);
            lblPlaylistFiles.Location = new System.Drawing.Point(MARGIN, chkAPE.Bottom + MARGIN + MARGIN);

            x = this.Width / 2;

            chkWAV = new QCheckBox(Localization.Get(UI_Key.File_Associations_WAV), this.BackColor);
            this.Controls.Add(chkWAV);
            chkWAV.Location = new System.Drawing.Point(x, chkMP3.Top);

            chkAC3 = new QCheckBox(Localization.Get(UI_Key.File_Associations_AC3), this.BackColor);
            this.Controls.Add(chkAC3);
            chkAC3.Location = new System.Drawing.Point(x, chkWAV.Bottom + MARGIN);

            chkMPC = new QCheckBox(Localization.Get(UI_Key.File_Associations_MPC), this.BackColor);
            this.Controls.Add(chkMPC);
            chkMPC.Location = new System.Drawing.Point(x, chkAC3.Bottom + MARGIN);

            chkALAC = new QCheckBox(Localization.Get(UI_Key.File_Associations_ALAC), this.BackColor);
            this.Controls.Add(chkALAC);
            chkALAC.Location = new System.Drawing.Point(x, chkMPC.Bottom + MARGIN);

            chkAIFF = new QCheckBox(Localization.Get(UI_Key.File_Associations_AIFF), this.BackColor);
            this.Controls.Add(chkAIFF);
            chkAIFF.Location = new System.Drawing.Point(x, chkALAC.Bottom + MARGIN);

            chkPLS = new QCheckBox(Localization.Get(UI_Key.File_Associations_PLS), this.BackColor);
            this.Controls.Add(chkPLS);
            chkPLS.Location = new System.Drawing.Point(chkWV.Left, lblPlaylistFiles.Bottom + MARGIN);

            chkM3U = new QCheckBox("M3U Files", this.BackColor);
            this.Controls.Add(chkM3U);
            chkM3U.Location = new System.Drawing.Point(chkAIFF.Left, chkPLS.Top);

            btnNone = new QButton(Localization.Get(UI_Key.File_Associations_Check_None), false, false);
            AddButton(btnNone, none);

            btnAll = new QButton(Localization.Get(UI_Key.File_Associations_Check_All), false, false);
            AddButton(btnAll, all);

            PlaceButtons(this.ClientRectangle.Width, chkPLS.Bottom + MARGIN, btnCancel, btnOK, btnNone, btnAll);

            this.ClientSize = new System.Drawing.Size(this.ClientRectangle.Width, btnCancel.Bottom + MARGIN);

            int tabIndex = 0;

            chkMP3.TabIndex  = tabIndex++;
            chkWMA.TabIndex  = tabIndex++;
            chkOGG.TabIndex  = tabIndex++;
            chkFLAC.TabIndex = tabIndex++;
            chkM4A.TabIndex  = tabIndex++;
            chkWV.TabIndex   = tabIndex++;
            chkWAV.TabIndex  = tabIndex++;
            chkAC3.TabIndex  = tabIndex++;
            chkMPC.TabIndex  = tabIndex++;
            chkALAC.TabIndex = tabIndex++;
            chkAIFF.TabIndex = tabIndex++;
            chkAPE.TabIndex  = tabIndex++;
            chkPLS.TabIndex  = tabIndex++;
            chkM3U.TabIndex  = tabIndex++;

            btnAll.TabIndex    = tabIndex++;
            btnNone.TabIndex   = tabIndex++;
            btnOK.TabIndex     = tabIndex++;
            btnCancel.TabIndex = tabIndex++;

            updateCheckboxes();
        }
コード例 #10
0
        public QInputBox(IWin32Window Owner,
                         string Text,
                         string Caption,
                         string DefaultValue,
                         string CheckboxText,
                         bool CheckboxVal,
                         int MaxLength,
                         int MinLength) : base(Caption, ButtonCreateType.OKAndCancel)
        {
            this.SPACING = 8;

            this.DialogResult = System.Windows.Forms.DialogResult.Cancel;

            this.ClientSize = new Size(275, 300);

            lblMain = new QLabel(Text);
            lblMain.ShowAccellerator();
            this.Controls.Add(lblMain);
            lblMain.Location = new Point(SPACING, 2 * SPACING);
            lblMain.SetWidth(this.ClientRectangle.Width - SPACING - SPACING);

            txtMain          = new QTextBox();
            txtMain.Text     = DefaultValue;
            txtMain.KeyDown += (s, e) =>
            {
                /* if (e.KeyCode == Keys.Enter)
                 * {
                 *  e.Handled = true;
                 *  ok();
                 * }
                 * else */if (e.KeyCode == Keys.Escape)
                {
                    e.Handled = true;
                    cancel();
                }
            };
            txtMain.MaxLength = MaxLength;
            minLength         = MinLength;
            txtMain.Bounds    = new System.Drawing.Rectangle(SPACING, lblMain.Bottom + 2 * SPACING, this.ClientRectangle.Width - 2 * SPACING, txtMain.Height);
            this.Controls.Add(txtMain);

            if (CheckboxText.Length > 0)
            {
                chkCheckbox          = new QCheckBox(CheckboxText, this.BackColor);
                chkCheckbox.Checked  = CheckboxVal;
                chkCheckbox.Location = new Point(SPACING, txtMain.Bottom + SPACING);
                chkCheckbox.Enabled  = false;
                this.Controls.Add(chkCheckbox);
            }

            PlaceButtons(this.ClientRectangle.Width, ((chkCheckbox != null) ? chkCheckbox.Bottom : txtMain.Bottom) + 2 * SPACING);

            btnOK.Enabled = false;

            this.ClientSize = new Size(this.ClientSize.Width, btnOK.Bottom + SPACING);

            int tabIndex = 0;

            lblMain.TabIndex = tabIndex++;
            txtMain.TabIndex = tabIndex++;

            if (chkCheckbox != null)
            {
                chkCheckbox.TabIndex = tabIndex++;
            }

            btnOK.TabIndex     = tabIndex++;
            btnCancel.TabIndex = tabIndex++;

            txtMain.TextChanged += (s, e) =>
            {
                btnOK.Enabled = txtMain.Text.Length >= minLength;
                if (chkCheckbox != null)
                {
                    chkCheckbox.Enabled = btnOK.Enabled;
                }
            };

            this.ShowDialog(Owner);
        }
コード例 #11
0
        public frmLastFM(bool Enabled, string UserName, string Password) : base(Localization.Get(UI_Key.LastFM_Title), ButtonCreateType.OKAndCancel)
        {
            this.ClientSize = new Size(370, 200);

            lblInstructions          = new QLabel(Localization.Get(UI_Key.LastFM_Instructions, Application.ProductName));
            lblInstructions.Location = new Point(MARGIN, MARGIN);
            lblInstructions.SetWidth(this.ClientRectangle.Width - MARGIN - MARGIN);
            this.Controls.Add(lblInstructions);

            chkEnable                 = new QCheckBox(Localization.Get(UI_Key.LastFM_Enable), this.BackColor);
            chkEnable.Checked         = Enabled;
            chkEnable.Location        = new Point(MARGIN, lblInstructions.Bottom + MARGIN + MARGIN);
            chkEnable.CheckedChanged += new EventHandler(chkEnableChanged);
            this.Controls.Add(chkEnable);

            lblUserName = new QLabel(Localization.Get(UI_Key.LastFM_User_Name));
            lblPassword = new QLabel(Localization.Get(UI_Key.LastFM_Password));

            lblUserName.Enabled = Enabled;
            lblPassword.Enabled = Enabled;

            txtUserName              = new QTextBox();
            txtUserName.Text         = UserName;
            txtUserName.MaxLength    = 64;
            txtUserName.Enabled      = Enabled;
            txtUserName.TextChanged += new EventHandler(textChanged);

            txtPassword              = new QTextBox();
            txtPassword.Text         = Password;
            txtPassword.MaxLength    = 64;
            txtPassword.Enabled      = Enabled;
            txtPassword.TextChanged += new EventHandler(textChanged);
            txtPassword.PasswordChar = '*';

            lblUserName.Location = new Point(2 * MARGIN, chkEnable.Bottom + MARGIN + MARGIN + (txtUserName.Height - lblUserName.Height) / 2);
            lblPassword.Location = new Point(2 * MARGIN, lblUserName.Top + MARGIN + txtUserName.Height);

            this.Controls.Add(lblUserName);
            this.Controls.Add(lblPassword);

            int x = Math.Max(lblUserName.Right, lblPassword.Right) + MARGIN;

            txtUserName.Location = new Point(x, lblUserName.Top + (lblUserName.Height - txtUserName.Height) / 2);
            txtPassword.Location = new Point(x, lblPassword.Top + (lblPassword.Height - txtPassword.Height) / 2);

            this.Controls.Add(txtUserName);
            this.Controls.Add(txtPassword);

            //btnCancel.Location = new Point(this.ClientRectangle.Width - MARGIN - btnCancel.Width, txtPassword.Bottom + MARGIN + MARGIN);

            //btnOK.Location = new Point(btnCancel.Left - btnOK.Width - MARGIN, btnCancel.Top);

            btnGoToAcccount = new QButton(Localization.Get(UI_Key.LastFM_Go_To_Account), false, false);
            AddButton(btnGoToAcccount, gotoAccount);

            //btnGoToAcccount.Location = new Point(btnOK.Left - btnGoToAcccount.Width - MARGIN, btnCancel.Top);

            PlaceButtons(this.ClientRectangle.Width,
                         txtPassword.Bottom + MARGIN + MARGIN,
                         btnCancel,
                         btnOK,
                         btnGoToAcccount);

            this.ClientSize = new Size(this.ClientRectangle.Width, btnCancel.Bottom + MARGIN);

            int tabIndex = 0;

            chkEnable.TabIndex       = tabIndex++;
            txtUserName.TabIndex     = tabIndex++;
            txtPassword.TabIndex     = tabIndex++;
            btnGoToAcccount.TabIndex = tabIndex++;
            btnOK.TabIndex           = tabIndex++;
            btnCancel.TabIndex       = tabIndex++;

            enableControls();
        }