コード例 #1
0
        /// <summary>
        /// Creates the <see cref="CamView"/> main toolbar items that are only available while
        /// the <see cref="GameViewCamViewState"/> is active.
        /// </summary>
        private void AddToolbarItems()
        {
            this.textBoxRenderWidth                    = new ToolStripTextBoxAdv("textBoxRenderWidth");
            this.textBoxRenderWidth.BackColor          = Color.FromArgb(196, 196, 196);
            this.textBoxRenderWidth.AutoSize           = false;
            this.textBoxRenderWidth.Width              = 35;
            this.textBoxRenderWidth.MaxLength          = 4;
            this.textBoxRenderWidth.AcceptsOnlyNumbers = true;
            this.textBoxRenderWidth.EditingFinished   += this.textBoxRenderWidth_EditingFinished;
            this.textBoxRenderWidth.ProceedRequested  += this.textBoxRenderWidth_ProceedRequested;

            this.textBoxRenderHeight                    = new ToolStripTextBoxAdv("textBoxRenderHeight");
            this.textBoxRenderHeight.BackColor          = Color.FromArgb(196, 196, 196);
            this.textBoxRenderHeight.AutoSize           = false;
            this.textBoxRenderHeight.Width              = 35;
            this.textBoxRenderHeight.MaxLength          = 4;
            this.textBoxRenderHeight.AcceptsOnlyNumbers = true;
            this.textBoxRenderHeight.EditingFinished   += this.textBoxRenderHeight_EditingFinished;
            this.textBoxRenderHeight.ProceedRequested  += this.textBoxRenderHeight_ProceedRequested;

            this.dropdownResolution = new ToolStripDropDownButton(CamViewResCache.IconMonitor);
            this.dropdownResolution.DropDownOpening += this.dropdownResolution_DropDownOpening;

            this.toolbarItems.Add(new ToolStripLabel("Window Size "));
            this.toolbarItems.Add(this.textBoxRenderWidth);
            this.toolbarItems.Add(new ToolStripLabel("x"));
            this.toolbarItems.Add(this.textBoxRenderHeight);
            this.toolbarItems.Add(this.dropdownResolution);

            this.resolutionMenuView       = new MenuStripMenuView(this.dropdownResolution.DropDownItems);
            this.resolutionMenuView.Model = this.resolutionMenuModel;

            this.View.ToolbarCamera.SuspendLayout();
            for (int i = this.toolbarItems.Count - 1; i >= 0; i--)
            {
                ToolStripItem item = this.toolbarItems[i];
                item.Alignment = ToolStripItemAlignment.Right;
                this.View.ToolbarCamera.Items.Add(item);
            }
            this.View.ToolbarCamera.ResumeLayout();

            this.UpdateTargetRenderSizeUI();
        }
コード例 #2
0
        /// <summary>
        /// Disposes any <see cref="CamView"/> main toolbar items that have been created
        /// during <see cref="AddToolbarItems"/>.
        /// </summary>
        private void RemoveToolbarItems()
        {
            this.View.ToolbarCamera.SuspendLayout();
            foreach (ToolStripItem item in this.toolbarItems)
            {
                this.View.ToolbarCamera.Items.Remove(item);
            }
            this.View.ToolbarCamera.ResumeLayout();

            this.textBoxRenderWidth.EditingFinished   -= this.textBoxRenderWidth_EditingFinished;
            this.textBoxRenderWidth.ProceedRequested  -= this.textBoxRenderWidth_ProceedRequested;
            this.textBoxRenderHeight.EditingFinished  -= this.textBoxRenderHeight_EditingFinished;
            this.textBoxRenderHeight.ProceedRequested -= this.textBoxRenderHeight_ProceedRequested;
            this.dropdownResolution.DropDownOpening   -= this.dropdownResolution_DropDownOpening;

            this.resolutionMenuView.Model = null;
            this.resolutionMenuView       = null;
            this.resolutionMenuModel.ClearItems();

            this.toolbarItems.Clear();
            this.textBoxRenderWidth  = null;
            this.textBoxRenderHeight = null;
        }