Ejemplo n.º 1
0
        private void CalcContentRectangle()
        {
            int w = Width / 8;

            int textHeight = 0;
            if (!string.IsNullOrEmpty(_message))
                using (Gdi g = new Gdi(this))
                {
                    SetFont(g);
                    Size textSize = g.GetDrawTextSize(_message, w * 6 - _margin * 2, Win32.DT.CENTER | Win32.DT.WORDBREAK);
                    textHeight = textSize.Height;
                }

            int h = textHeight + _margin * 3 + button1.Height;
            if (h > Height / 8 * 6)
                h = Height / 8 * 6;

            int contentWidth = w * 6;
            int contentHeight = h;
            int vPos = (Height - contentHeight) / 2;
            int hPos = w;

            _contentRectangle = new Rectangle(hPos, vPos, contentWidth, contentHeight);
            _textRectangle = new Rectangle(_contentRectangle.X + _margin, _contentRectangle.Y + _margin,
                                           _contentRectangle.Width - _margin * 2,
                                           _contentRectangle.Height - _margin * 3 - button1.Height);

            if (button3.Visible)
            {

            }
            else if (button2.Visible)
            {
                int workWidth = _contentRectangle.Width - _margin * 3;
                int left = (workWidth / 2 - button1.Width) / 2;
                left = _margin + left;
                button1.Location = new Point(left + _contentRectangle.Left,
                                             _textRectangle.Y + _textRectangle.Height + _margin);
                left = left + workWidth / 2 + _margin;
                button2.Location = new Point(left + _contentRectangle.Left,
                                             _textRectangle.Y + _textRectangle.Height + _margin);
            }
            else
            {
                button1.Location = new Point((ClientRectangle.Width - button1.Width) / 2,
                                             _textRectangle.Y + _textRectangle.Height + _margin);
            }

            _imgLT.Location = new Point(_contentRectangle.X, _contentRectangle.Y);
            _imgTT.Location = new Point(_imgLT.Right + 1, _contentRectangle.Y);
            _imgTT.Width = _contentRectangle.Width - _imgLT.Width - _imgRT.Width;
            _imgRT.Location = new Point(_imgTT.Right + 1, _contentRectangle.Y);

            _imgLL.Location = new Point(_contentRectangle.X, _imgLT.Bottom + 1);
            _imgLL.Height = _contentRectangle.Height - _imgLT.Height - _imgLB.Height;
            _imgRR.Location = new Point(_imgRT.Location.X + _imgRT.Size.Width - _imgRR.Size.Width, _imgRT.Bottom + 1);
            _imgRR.Height = _contentRectangle.Height - _imgRT.Height - _imgRB.Height;

            _imgLB.Location = new Point(_contentRectangle.X, _imgLL.Bottom + 1);
            _imgBB.Location = new Point(_imgLB.Right + 1, _imgLB.Top + 1);
            _imgBB.Width = _contentRectangle.Width - _imgLB.Width - _imgRB.Width;
            _imgRB.Location = new Point(_imgBB.Right + 1, _imgLB.Top);

            _backgroundRectangle = new Rectangle(_imgLL.Right + 1, _imgLL.Top, _imgRR.Left - _imgLL.Right - 1,
                                                 _imgLL.Height + 1);
        }
Ejemplo n.º 2
0
        private void CalcContentRectangle()
        {
            int w = Width / 8;

            int textHeight = 0;
            if (!string.IsNullOrEmpty(_message))
                using (Gdi g = new Gdi(this))
                {
                    SetFont(g);
                    Size textSize = g.GetDrawTextSize(_message, w * 6 - _margin * 2, Win32.DT.WORDBREAK);
                    textHeight = textSize.Height;
                }

            int h = textBoxStatus.Height + /*buttonOk.Height*/30 * 3 + _margin * 10;
            if (h > Height / 8 * 6)
                h = Height / 8 * 6;

            int contentWidth = w * 6;
            int contentHeight = h;
            int vPos = (Height - contentHeight) / 2;
            int hPos = w;

            _contentRectangle = new Rectangle(hPos, vPos, contentWidth, contentHeight);
            /*
            _textRectangle = new Rectangle(_contentRectangle.X + _margin, _contentRectangle.Y + _margin,
                                           _contentRectangle.Width - _margin * 2,
                                           _contentRectangle.Height - _margin * 3 - buttonOk.Height);
            */

            int workWidth = _contentRectangle.Width - _margin * 3;
            int left = hPos + _margin;

            textBoxStatus.Location = new Point(left + _contentRectangle.Left,
                                         _contentRectangle.Y + _margin * 3);

            textBoxStatus.Size = new Size(workWidth - _margin * 4, 30);

            buttonOk.Location = new Point(left + _contentRectangle.Left,
                                         textBoxStatus.Location.Y + textBoxStatus.Height + _margin);

            buttonOk.Size = new Size(workWidth - _margin * 4, 30);

            buttonReset.Location = new Point(left + _contentRectangle.Left,
                                         buttonOk.Location.Y + buttonOk.Height + _margin);

            buttonReset.Size = new Size(workWidth - _margin * 4, 30);

            buttonCancel.Location = new Point(left + _contentRectangle.Left,
                                         buttonReset.Location.Y + buttonReset.Height + _margin);

            buttonCancel.Size = new Size(workWidth - _margin * 4, 30);

            //Границы и фон
            _imgLT.Location = new Point(_contentRectangle.X, _contentRectangle.Y);
            _imgTT.Location = new Point(_imgLT.Right + 1, _contentRectangle.Y);
            _imgTT.Width = _contentRectangle.Width - _imgLT.Width - _imgRT.Width;
            _imgRT.Location = new Point(_imgTT.Right + 1, _contentRectangle.Y);

            _imgLL.Location = new Point(_contentRectangle.X, _imgLT.Bottom + 1);
            _imgLL.Height = _contentRectangle.Height - _imgLT.Height - _imgLB.Height;
            _imgRR.Location = new Point(_imgRT.Location.X + _imgRT.Size.Width - _imgRR.Size.Width, _imgRT.Bottom + 1);
            _imgRR.Height = _contentRectangle.Height - _imgRT.Height - _imgRB.Height;

            _imgLB.Location = new Point(_contentRectangle.X, _imgLL.Bottom + 1);
            _imgBB.Location = new Point(_imgLB.Right + 1, _imgLB.Top);
            _imgBB.Width = _contentRectangle.Width - _imgLB.Width - _imgRB.Width;
            _imgRB.Location = new Point(_imgBB.Right + 1, _imgLB.Top);

            _backgroundRectangle = new Rectangle(_imgLL.Right + 1, _imgLL.Top, _imgRR.Left - _imgLL.Right - 1,
                                                 _imgLL.Height);
        }
Ejemplo n.º 3
0
        private void CalcContentRectangle()
        {
            int buttonHeight = UISettings.CalcPix(24);
            int buttonWidth = UISettings.CalcPix(75);

            int w = Width / 10;

            int textHeight = 0;

            if (!string.IsNullOrEmpty(_message))
            {
                using (Gdi g = new Gdi(this))
                {
                    SetFont(g);

                    Size textSize = g.GetDrawTextSize(_message, w * 9 - _margin * 2, Win32.DT.WORDBREAK);

                    textHeight = textSize.Height;
                }
            }

            int h = _margin + textHeight + _margin + (buttonHeight * 3 + _margin / 2 * 2) + _margin;

            if (_shortview)
            {
                h -= (buttonHeight + _margin / 2);
            }

            if (h > Height / 10 * 6)
            {
                h = Height / 10 * 6;
            }

            int contentWidth = w * 9;
            int contentHeight = h;

            int vPos = (Height - contentHeight) / 2;
            int hPos = w / 2;

            _contentRectangle = new Rectangle(hPos, vPos, contentWidth, contentHeight);

            _textRectangle = new Rectangle(_contentRectangle.X + _margin,
                                            _contentRectangle.Y + _margin,
                                            _contentRectangle.Width - _margin * 2,
                                            _contentRectangle.Height - _margin - _margin - (buttonHeight * 3 + _margin / 2 * 2) - _margin);

            if (_shortview)
            {
                _textRectangle.Height += (buttonHeight + _margin / 2);
            }

            int buttonXPos = _contentRectangle.Left + (_contentRectangle.Width - buttonWidth) / 2;
            int buttonYPos = _contentRectangle.Y + _margin + _textRectangle.Height + _margin;

            _textRectangle.Height -= _margin;

            buttonUpdate.Location = new Point(buttonXPos, buttonYPos);
            buttonUpdate.Size = new Size(buttonWidth, buttonHeight);

            if (!_shortview)
            {
                buttonYPos += buttonHeight + _margin / 2;

                buttonSkip.Location = new Point(buttonXPos, buttonYPos);
                buttonSkip.Size = new Size(buttonWidth, buttonHeight);

                buttonSkip.Visible = true;
            }
            else
            {
                buttonSkip.Location = new Point(buttonXPos, buttonYPos);
                buttonSkip.Size = new Size(1, 1);

                buttonSkip.Visible = false;
            }

            buttonYPos += buttonHeight + _margin / 2;

            buttonCancel.Location = new Point(buttonXPos, buttonYPos);
            buttonCancel.Size = new Size(buttonWidth, buttonHeight);

            if (_shortview)
            {
                buttonCancel.Text = Resources.UpdateInfoDialogControl_Buttons_Exit;
            }
            else
            {
                buttonCancel.Text = Resources.UpdateInfoDialogControl_Buttons_Cancel;
            }

            //Границы и фон
            _imgLT.Location = new Point(_contentRectangle.X, _contentRectangle.Y);
            _imgTT.Location = new Point(_imgLT.Right + 1, _contentRectangle.Y);
            _imgTT.Width = _contentRectangle.Width - _imgLT.Width - _imgRT.Width;
            _imgRT.Location = new Point(_imgTT.Right + 1, _contentRectangle.Y);

            _imgLL.Location = new Point(_contentRectangle.X, _imgLT.Bottom + 1);
            _imgLL.Height = _contentRectangle.Height - _imgLT.Height - _imgLB.Height;
            _imgRR.Location = new Point(_imgRT.Location.X + _imgRT.Size.Width - _imgRR.Size.Width, _imgRT.Bottom + 1);
            _imgRR.Height = _contentRectangle.Height - _imgRT.Height - _imgRB.Height;

            _imgLB.Location = new Point(_contentRectangle.X, _imgLL.Bottom + 1);
            _imgBB.Location = new Point(_imgLB.Right + 1, _imgLB.Top + 1);
            _imgBB.Width = _contentRectangle.Width - _imgLB.Width - _imgRB.Width;
            _imgRB.Location = new Point(_imgBB.Right + 1, _imgLB.Top);

            _backgroundRectangle = new Rectangle(_imgLL.Right + 1, _imgLL.Top, _imgRR.Left - _imgLL.Right - 1, _imgLL.Height + 1);
        }