private StackPanel CreateConnectToHostPanel(RadioButtonGroup optionsRadioGroup)
        {
            var root = new StackPanel(FlowDirection.LeftToRight)
            {
                Anchor = AnchorStyles.Left | AnchorStyles.Right
            };

            var radio = new UntabbableRadioButton {
                Margin   = Padding.Empty,
                Padding  = new Padding(0, 2, 5, 0),
                AutoSize = true
            };

            optionsRadioGroup.Add(radio);
            root.Add(radio);

            var body = new StackPanel(FlowDirection.TopDown)
            {
                Anchor = AnchorStyles.Left | AnchorStyles.Right
            };

            root.Add(body, true);

            var bodyLabel = new ResetLabel {
                Text   = "Connect to Host:",
                Anchor = AnchorStyles.Left,
                Font   = new Font(FontFamily.GenericSansSerif, 8.75f, FontStyle.Bold, GraphicsUnit.Point)
            };

            body.Add(bodyLabel);

            var inputTextBox = new TextBox {
                Margin = new Padding(0, 0, 0, 2),
                Anchor = AnchorStyles.Left | AnchorStyles.Right
            };

            body.Add(inputTextBox);

            Label usageLabel;

            body.Add(CreateLabeledLabelPanel("Usage:", SystemColors.GrayText, out usageLabel));
            usageLabel.Text = "<hostname>:<port>";

            Label errorLabel;
            var   errorlabelPanel = CreateLabeledLabelPanel("Error:", Color.FromArgb(192, 0, 0), out errorLabel);

            errorLabel.Text = "asdf<hostname>:<port>\r\nHello\r\nDSFJOI";
            errorlabelPanel.Hide();
            body.Add(errorlabelPanel);

            ProxySelection(body, radio);

            return(root);
        }
        private void InitializeComponents()
        {
            FormBorderStyle = FormBorderStyle.FixedDialog;
            MaximizeBox     = false;
            MinimizeBox     = false;
            Margin          = Padding = Padding.Empty;

            var root = new StackPanel(FlowDirection.TopDown)
            {
                Anchor = AnchorStyles.Left | AnchorStyles.Top
            };

            Controls.Add(root);

            var headerWrapper = new StackPanel(FlowDirection.TopDown)
            {
                Anchor    = AnchorStyles.Left | AnchorStyles.Right,
                BackColor = Color.White
            };

            root.Add(headerWrapper);

            var header = new StackPanel(FlowDirection.LeftToRight)
            {
                Padding = new Padding(20, 15, 20, 15)
            };

            headerWrapper.Add(header);

            header.Add(new PictureBox {
                Image   = Image.FromFile("Resources/Dargon6464.png"),
                Size    = new Size(64, 64),
                Margin  = Padding.Empty,
                Padding = Padding.Empty
            });
            header.Add(new ResetLabel(true)
            {
                Text   = "New Connection",
                Font   = new Font(FontFamily.GenericSansSerif, 15.75f, FontStyle.Regular, GraphicsUnit.Point),
                Anchor = AnchorStyles.Left,
                Margin = new Padding(10, 12, 3, 0)
            });

            var optionPanelsContainer = new StackPanel(FlowDirection.TopDown)
            {
                Margin = new Padding(15, 15, 15, 15),
                Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom
            };

            root.Add(optionPanelsContainer);

            var optionsRadioGroup = new RadioButtonGroup();

            var connectToHostPanel = CreateConnectToHostPanel(optionsRadioGroup);

            connectToHostPanel.Margin = new Padding(0, 0, 0, 3);
            optionPanelsContainer.Add(connectToHostPanel);

            var connectByDiscoveryPanel = CreateConnectByDiscoveryPanel(optionsRadioGroup);

            connectByDiscoveryPanel.Margin = new Padding(0, 0, 0, 3);
//         optionPanelsContainer.Add(connectByDiscoveryPanel);

            Button connectButton, cancelButton;
            var    connectCancelPanel = CreateConnectCancelPanel(out connectButton, out cancelButton);

            optionPanelsContainer.Add(connectCancelPanel);
            ProxyFormKeyEvents(connectToHostPanel, connectButton, cancelButton);
            ProxyFormKeyEvents(connectByDiscoveryPanel, connectButton, cancelButton);
            ProxyFormKeyEvents(connectButton, connectButton, cancelButton);
            ProxyFormKeyEvents(cancelButton, connectButton, cancelButton);
            connectButton.Click += (s, e) => {
                Console.WriteLine("Connect");
            };
            cancelButton.Click += (s, e) => {
                Console.WriteLine("Cancel");
            };

            Shown += HandleResize;

            // Force initial width to ensure golden aspect ratio
            ClientSize = root.Size;
            int desiredWidth = (int)(Height * 1.61803398875);
            int actualWidth  = Width;

            headerWrapper.MinimumSize = new Size(root.ClientSize.Width + (desiredWidth - actualWidth), 0);
            ClientSize = root.Size;
        }
      private StackPanel CreateConnectToHostPanel(RadioButtonGroup optionsRadioGroup) {
         var root = new StackPanel(FlowDirection.LeftToRight) {
            Anchor = AnchorStyles.Left | AnchorStyles.Right
         };

         var radio = new UntabbableRadioButton {
            Margin = Padding.Empty,
            Padding = new Padding(0, 2, 5, 0),
            AutoSize = true
         };
         optionsRadioGroup.Add(radio);
         root.Add(radio);

         var body = new StackPanel(FlowDirection.TopDown) {
            Anchor = AnchorStyles.Left | AnchorStyles.Right
         };
         root.Add(body, true);

         var bodyLabel = new ResetLabel {
            Text = "Connect to Host:",
            Anchor = AnchorStyles.Left,
            Font = new Font(FontFamily.GenericSansSerif, 8.75f, FontStyle.Bold, GraphicsUnit.Point)
         };
         body.Add(bodyLabel);

         var inputTextBox = new TextBox {
            Margin = new Padding(0, 0, 0, 2),
            Anchor = AnchorStyles.Left | AnchorStyles.Right
         };
         body.Add(inputTextBox);

         Label usageLabel;
         body.Add(CreateLabeledLabelPanel("Usage:", SystemColors.GrayText, out usageLabel));
         usageLabel.Text = "<hostname>:<port>";

         Label errorLabel;
         var errorlabelPanel = CreateLabeledLabelPanel("Error:", Color.FromArgb(192, 0, 0), out errorLabel);
         errorLabel.Text = "asdf<hostname>:<port>\r\nHello\r\nDSFJOI";
         errorlabelPanel.Hide();
         body.Add(errorlabelPanel);

         ProxySelection(body, radio);

         return root;
      }
      private void InitializeComponents() {
         FormBorderStyle = FormBorderStyle.FixedDialog;
         MaximizeBox = false;
         MinimizeBox = false;
         Margin = Padding = Padding.Empty;
         
         var root = new StackPanel(FlowDirection.TopDown) {
            Anchor = AnchorStyles.Left | AnchorStyles.Top
         };
         Controls.Add(root);

         var headerWrapper = new StackPanel(FlowDirection.TopDown) {
            Anchor = AnchorStyles.Left | AnchorStyles.Right,
            BackColor = Color.White
         };
         root.Add(headerWrapper);

         var header = new StackPanel(FlowDirection.LeftToRight) {
            Padding = new Padding(20, 15, 20, 15)
         };
         headerWrapper.Add(header);

         header.Add(new PictureBox {
            Image = Image.FromFile("Resources/Dargon6464.png"),
            Size = new Size(64, 64),
            Margin = Padding.Empty,
            Padding = Padding.Empty
         });
         header.Add(new ResetLabel(true) {
            Text = "New Connection",
            Font = new Font(FontFamily.GenericSansSerif, 15.75f, FontStyle.Regular, GraphicsUnit.Point),
            Anchor = AnchorStyles.Left,
            Margin = new Padding(10, 12, 3, 0)
         });

         var optionPanelsContainer = new StackPanel(FlowDirection.TopDown) {
            Margin = new Padding(15, 15, 15, 15),
            Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom
         };
         root.Add(optionPanelsContainer);

         var optionsRadioGroup = new RadioButtonGroup();

         var connectToHostPanel = CreateConnectToHostPanel(optionsRadioGroup);
         connectToHostPanel.Margin = new Padding(0, 0, 0, 3);
         optionPanelsContainer.Add(connectToHostPanel);

         var connectByDiscoveryPanel = CreateConnectByDiscoveryPanel(optionsRadioGroup);
         connectByDiscoveryPanel.Margin = new Padding(0, 0, 0, 3);
//         optionPanelsContainer.Add(connectByDiscoveryPanel);

         Button connectButton, cancelButton;
         var connectCancelPanel = CreateConnectCancelPanel(out connectButton, out cancelButton);
         optionPanelsContainer.Add(connectCancelPanel);
         ProxyFormKeyEvents(connectToHostPanel, connectButton, cancelButton);
         ProxyFormKeyEvents(connectByDiscoveryPanel, connectButton, cancelButton);
         ProxyFormKeyEvents(connectButton, connectButton, cancelButton);
         ProxyFormKeyEvents(cancelButton, connectButton, cancelButton);
         connectButton.Click += (s, e) => {
            Console.WriteLine("Connect");
         };
         cancelButton.Click += (s, e) => {
            Console.WriteLine("Cancel");
         };

         Shown += HandleResize;

         // Force initial width to ensure golden aspect ratio
         ClientSize = root.Size;
         int desiredWidth = (int)(Height * 1.61803398875);
         int actualWidth = Width;
         headerWrapper.MinimumSize = new Size(root.ClientSize.Width + (desiredWidth - actualWidth), 0);
         ClientSize = root.Size;
      }