Esempio n. 1
0
        public NGCheckBox()
        {
            InitializeComponent();
            ThemeManager.getInstance().ThemeChanged += OnCreateControl;
            var display = new DisplayProperties();

            _checkboxSize   = new Size(display.ScaleWidth(11), display.ScaleHeight(11));
            _checkboxYCoord = (display.ScaleHeight(Height) - _checkboxSize.Height) / 2 - display.ScaleHeight(5);
            _textXCoord     = _checkboxSize.Width + display.ScaleWidth(2);
        }
Esempio n. 2
0
        // Constructor
        public NGRadioButton()
        {
            var display = new DisplayProperties();

            _circleSmall = new Rectangle(display.ScaleWidth(4), display.ScaleHeight(4), display.ScaleWidth(6),
                                         display.ScaleHeight(6));
            _circle = new Rectangle(display.ScaleWidth(1), display.ScaleHeight(1), display.ScaleWidth(12),
                                    display.ScaleHeight(12));
            _textXCoord = display.ScaleWidth(16);
            ThemeManager.getInstance().ThemeChanged += OnCreateControl;
        }
Esempio n. 3
0
        public override void Resize(object sender, EventArgs e)
        {
            try
            {
                if (InterfaceControl.Size == Size.Empty)
                {
                    return;
                }

                if (_isPuttyNg)
                {
                    // PuTTYNG 0.70.0.1 and later doesn't have any window borders
                    NativeMethods.MoveWindow(PuttyHandle, 0, 0, InterfaceControl.Width, InterfaceControl.Height, true);
                }
                else
                {
                    var scaledFrameBorderHeight = _display.ScaleHeight(SystemInformation.FrameBorderSize.Height);
                    var scaledFrameBorderWidth  = _display.ScaleWidth(SystemInformation.FrameBorderSize.Width);

                    NativeMethods.MoveWindow(PuttyHandle, -scaledFrameBorderWidth,
                                             -(SystemInformation.CaptionHeight + scaledFrameBorderHeight),
                                             InterfaceControl.Width + scaledFrameBorderWidth * 2,
                                             InterfaceControl.Height + SystemInformation.CaptionHeight +
                                             scaledFrameBorderHeight * 2,
                                             true);
                }
            }
            catch (Exception ex)
            {
                Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg,
                                                    Language.strPuttyResizeFailed + Environment.NewLine + ex.Message,
                                                    true);
            }
        }
        public void ScaleWidthReturnsValueScaledByWidthScalingFactor()
        {
            var graphics = Substitute.For <IGraphicsProvider>();

            graphics.GetResolutionScalingFactor().Returns(new SizeF(4, 2));
            var sut = new DisplayProperties(graphics);

            var initialValue = 10;
            var scaledValue  = sut.ScaleWidth(initialValue);

            Assert.That(scaledValue, Is.EqualTo(sut.ResolutionScalingFactor.Width * initialValue));
        }
Esempio n. 5
0
 public ErrorAndInfoWindow(DockContent panel)
 {
     WindowType = WindowType.ErrorsAndInfos;
     DockPnl    = panel;
     _display   = new DisplayProperties();
     InitializeComponent();
     lblMsgDate.Width = _display.ScaleWidth(lblMsgDate.Width);
     _themeManager    = ThemeManager.getInstance();
     ApplyTheme();
     _themeManager.ThemeChanged += ApplyTheme;
     LayoutVertical();
     FillImageList();
     ApplyLanguage();
 }
Esempio n. 6
0
        private void LayoutVertical()
        {
            try
            {
                pnlErrorMsg.Location = new Point(0, Height - _display.ScaleHeight(200));
                pnlErrorMsg.Size     = new Size(Width, Height - pnlErrorMsg.Top);
                pnlErrorMsg.Anchor   = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
                txtMsgText.Size      = new Size(
                    pnlErrorMsg.Width - pbError.Width - _display.ScaleWidth(8),
                    pnlErrorMsg.Height - _display.ScaleHeight(20));
                lvErrorCollector.Location = new Point(0, 0);
                lvErrorCollector.Size     = new Size(Width, Height - pnlErrorMsg.Height - _display.ScaleHeight(5));
                lvErrorCollector.Anchor   =
                    AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;

                _layout = ControlLayout.Vertical;
            }
            catch (Exception ex)
            {
                Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg,
                                                    "LayoutVertical (UI.Window.ErrorsAndInfos) failed" +
                                                    Environment.NewLine + ex.Message, true);
            }
        }
Esempio n. 7
0
        //--------------------------------------------------------------------------------

        //--------------------------------------------------------------------------------

        #region ShowTaskDialogBox

        //--------------------------------------------------------------------------------
        public static DialogResult ShowTaskDialogBox(IWin32Window owner,
                                                     string title,
                                                     string mainInstruction,
                                                     string content,
                                                     string expandedInfo,
                                                     string footer,
                                                     string verificationText,
                                                     string radioButtons,
                                                     string commandButtons,
                                                     ETaskDialogButtons buttons,
                                                     ESysIcons mainIcon,
                                                     ESysIcons footerIcon,
                                                     int defaultIndex)

        {
            DialogResult result;

            OnTaskDialogShown?.Invoke(null, EventArgs.Empty);

            using (var td = new frmTaskDialog())
            {
                var display = new DisplayProperties();
                td.Title              = title;
                td.MainInstruction    = mainInstruction;
                td.Content            = content;
                td.ExpandedInfo       = expandedInfo;
                td.Footer             = footer;
                td.RadioButtons       = radioButtons;
                td.CommandButtons     = commandButtons;
                td.Buttons            = buttons;
                td.MainIcon           = mainIcon;
                td.FooterIcon         = footerIcon;
                td.VerificationText   = verificationText;
                td.Width              = display.ScaleWidth(EmulatedFormWidth);
                td.DefaultButtonIndex = defaultIndex;
                td.BuildForm();
                result = td.ShowDialog(owner);

                RadioButtonResult   = td.RadioButtonIndex;
                CommandButtonResult = td.CommandButtonClickedIndex;
                VerificationChecked = td.VerificationCheckBoxChecked;
            }

            OnTaskDialogClosed?.Invoke(null, EventArgs.Empty);
            return(result);
        }