protected override void OnLayout(LayoutEventArgs levent)
        {
            int vMargin = UI.ScaleHeight(4);
            int hMargin = UI.ScaleWidth(4);

            this.header.Location = new Point(0, 0);
            this.header.Width    = ClientSize.Width;
            this.header.Height   = string.IsNullOrEmpty(DisplayName) ? 0 :
                                   this.header.GetPreferredSize(new Size(this.header.Width, 0)).Height;

            this.resetButton.Width    = UI.ScaleWidth(20);
            this.resetButton.Location = new Point(
                ClientSize.Width - this.resetButton.Width,
                this.header.Bottom + vMargin);

            int nudWidth = UI.ScaleWidth(70);

            this.numericUpDown.PerformLayout();
            this.numericUpDown.Width    = nudWidth;
            this.numericUpDown.Location = new Point(
                (this.resetButton.Visible ? (this.resetButton.Left - hMargin) : ClientSize.Width) - this.numericUpDown.Width,
                this.header.Bottom + vMargin);

            this.resetButton.Height = this.numericUpDown.Height;

            this.slider.Location = new Point(0, this.header.Bottom + vMargin);
            this.slider.Size     = new Size(
                this.numericUpDown.Left - hMargin,
                PropertyControlUtil.GetGoodSliderHeight(this.slider));

            this.descriptionText.Location = new Point(
                0,
                (string.IsNullOrEmpty(this.Description) ? 0 : vMargin) + Utility.Max(this.resetButton.Bottom, this.slider.Bottom, this.numericUpDown.Bottom));

            this.descriptionText.Width  = ClientSize.Width;
            this.descriptionText.Height = string.IsNullOrEmpty(this.descriptionText.Text) ? 0 :
                                          this.descriptionText.GetPreferredSize(new Size(this.descriptionText.Width, 1)).Height;

            ClientSize = new Size(ClientSize.Width, this.descriptionText.Bottom);

            base.OnLayout(levent);
        }
Exemple #2
0
        protected override void OnLayout(LayoutEventArgs levent)
        {
            int vMargin = UI.ScaleHeight(4);
            int hMargin = UI.ScaleWidth(4);

            this.header.Location = new Point(0, 0);
            this.header.Width    = ClientSize.Width;
            this.header.Height   = string.IsNullOrEmpty(DisplayName) ? 0 : this.header.GetPreferredSize(new Size(this.header.Width, 0)).Height;

            int nudWidth = UI.ScaleWidth(70);

            // X slider, nud, reset button
            int xTop = this.header.Bottom + vMargin;

            this.resetButtonX.Width    = UI.ScaleWidth(20);
            this.resetButtonX.Location = new Point(
                ClientSize.Width - this.resetButtonX.Width,
                xTop);

            this.numericUpDownX.PerformLayout();
            this.numericUpDownX.Width    = nudWidth;
            this.numericUpDownX.Location = new Point(
                (this.resetButtonX.Visible ? (this.resetButtonX.Left - hMargin) : ClientSize.Width) - this.numericUpDownX.Width,
                xTop);

            this.resetButtonX.Height = this.numericUpDownX.Height;

            this.sliderX.Location = new Point(0, xTop);
            this.sliderX.Size     = new Size(
                this.numericUpDownX.Left - hMargin,
                PropertyControlUtil.GetGoodSliderHeight(this.sliderX));

            // Y slider, nud, reset button
            int yTop = vMargin + Utility.Max(this.resetButtonX.Bottom, this.numericUpDownX.Bottom, this.sliderX.Bottom);

            this.resetButtonY.Width    = UI.ScaleWidth(20);
            this.resetButtonY.Location = new Point(
                ClientSize.Width - this.resetButtonY.Width,
                yTop);

            this.numericUpDownY.PerformLayout();
            this.numericUpDownY.Width    = nudWidth;
            this.numericUpDownY.Location = new Point(
                (this.resetButtonY.Visible ? (this.resetButtonY.Left - hMargin) : ClientSize.Width) - this.numericUpDownY.Width,
                yTop);

            this.resetButtonY.Height = this.numericUpDownY.Height;

            this.sliderY.Location = new Point(0, yTop);
            this.sliderY.Size     = new Size(
                this.numericUpDownY.Left - hMargin,
                PropertyControlUtil.GetGoodSliderHeight(this.sliderY));

            // Description
            this.descriptionText.Location = new Point(0, Utility.Max(this.resetButtonY.Bottom, this.sliderY.Bottom, this.numericUpDownY.Bottom));
            this.descriptionText.Width    = ClientSize.Width;
            this.descriptionText.Height   = string.IsNullOrEmpty(this.descriptionText.Text) ? 0 :
                                            this.descriptionText.GetPreferredSize(new Size(this.descriptionText.Width, 1)).Height;

            ClientSize = new Size(ClientSize.Width, this.descriptionText.Bottom);

            base.OnLayout(levent);
        }