public DNSChangerForm() { InitializeComponent(); ShareXResources.ApplyThemeToForm(this); AddDNS(Resources.DNSChangerForm_DNSChangerForm_Manual); AddDNS("Google Public DNS", "8.8.8.8", "8.8.4.4"); // https://developers.google.com/speed/public-dns/ AddDNS("OpenDNS", "208.67.222.222", "208.67.220.220"); // https://www.opendns.com AddDNS("Cloudflare", "1.1.1.1", "1.0.0.1"); // https://1.1.1.1 AddDNS("Level 3 Communications", "4.2.2.1", "4.2.2.2"); // http://www.level3.com AddDNS("Comodo Secure DNS", "8.26.56.26", "8.20.247.20"); // https://www.comodo.com/secure-dns/ AddDNS("DNS Advantage", "156.154.70.1", "156.154.71.1"); // https://www.security.neustar/dns-services/free-recursive-dns-service AddDNS("Yandex DNS", "77.88.8.2", "77.88.8.88"); // https://dns.yandex.com AddDNS("Quad9", "9.9.9.9"); // https://quad9.net foreach (AdapterInfo adapter in AdapterInfo.GetEnabledAdapters()) { cbAdapters.Items.Add(adapter); } if (cbAdapters.Items.Count > 0) { cbAdapters.SelectedIndex = 0; } }
public OutputBox(string text, string title) { InitializeComponent(); ShareXResources.ApplyThemeToForm(this); Text = "ShareX - " + title; txtText.Text = text; }
public PrintTextForm(string text, PrintSettings settings) { InitializeComponent(); ShareXResources.ApplyThemeToForm(this); printHelper = new PrintHelper(text); printHelper.Settings = printSettings = settings; LoadSettings(); }
public PrintForm(Image img, PrintSettings settings, bool previewOnly = false) { InitializeComponent(); ShareXResources.ApplyThemeToForm(this); printHelper = new PrintHelper(img); printHelper.Settings = printSettings = settings; btnPrint.Enabled = !previewOnly; LoadSettings(); }
public ClipboardContentViewer(bool showCheckBox = false) { InitializeComponent(); ShareXResources.ApplyThemeToForm(this); if (ShareXResources.UseDarkTheme) { lblQuestion.BackColor = ShareXResources.DarkBorderColor; } cbDontShowThisWindow.Visible = showCheckBox; }
public ColorPickerForm(Color currentColor, bool isScreenColorPickerMode = false) { InitializeComponent(); ShareXResources.ApplyThemeToForm(this); IsScreenColorPickerMode = isScreenColorPickerMode; PrepareColorPalette(); SetCurrentColor(currentColor, !IsScreenColorPickerMode); btnOK.Visible = btnCancel.Visible = !IsScreenColorPickerMode; mbCopy.Visible = btnClose.Visible = pCursorPosition.Visible = IsScreenColorPickerMode; }
public HashCheckForm() { InitializeComponent(); ShareXResources.ApplyThemeToForm(this); cbHashType.Items.AddRange(Helpers.GetEnumDescriptions <HashType>()); cbHashType.SelectedIndex = (int)HashType.SHA1; hashCheck = new HashCheck(); hashCheck.FileCheckProgressChanged += fileCheck_FileCheckProgressChanged; hashCheck.FileCheckCompleted += fileCheck_FileCheckCompleted; translator = new Translator(); }
public GradientPickerForm(GradientInfo gradient) { Gradient = gradient; InitializeComponent(); ShareXResources.ApplyThemeToForm(this); cbGradientType.Items.AddRange(Helpers.GetEnumNamesProper <LinearGradientMode>()); cbGradientType.SelectedIndex = (int)Gradient.Type; foreach (GradientStop gradientStop in Gradient.Colors) { AddGradientStop(gradientStop); } isReady = true; UpdatePreview(); }
public MonitorTestForm() { InitializeComponent(); ShareXResources.ApplyThemeToForm(this); Rectangle screenBounds = CaptureHelpers.GetScreenBounds(); Location = screenBounds.Location; Size = screenBounds.Size; rbBlackWhite.Checked = true; tbBlackWhite.Value = 128; tbRed.Value = 255; cbGradient.Items.AddRange(Helpers.GetLocalizedEnumDescriptions <LinearGradientMode>()); cbGradient.SelectedIndex = 1; btnGradientColor1.Color = Color.DarkGray; btnGradientColor2.Color = Color.Black; cbShapes.SelectedIndex = 0; tbShapeSize.Value = 5; }
private DebugForm(Logger logger) { Logger = logger; InitializeComponent(); ShareXResources.ApplyThemeToForm(this); rtbDebug.Text = Logger.ToString(); rtbDebug.SelectionStart = rtbDebug.TextLength; rtbDebug.ScrollToCaret(); rtbDebug.AddContextMenu(); string startupPath = AppDomain.CurrentDomain.BaseDirectory; llRunningFrom.Text = startupPath; llRunningFrom.LinkClicked += (sender, e) => Helpers.OpenFolder(startupPath); Logger.MessageAdded += logger_MessageAdded; Activated += (sender, e) => btnUploadLog.Visible = HasUploadRequested; FormClosing += (sender, e) => Logger.MessageAdded -= logger_MessageAdded; }
public ErrorForm(string errorTitle, string errorMessage, string logPath, string bugReportPath, bool unhandledException = true) { InitializeComponent(); ShareXResources.ApplyThemeToForm(this); IsUnhandledException = unhandledException; LogPath = logPath; BugReportPath = bugReportPath; if (IsUnhandledException) { DebugHelper.WriteException(errorMessage, "Unhandled exception"); } lblErrorMessage.Text = errorTitle; txtException.Text = errorMessage; txtException.SelectionStart = txtException.TextLength; btnSendBugReport.Visible = !string.IsNullOrEmpty(BugReportPath); btnOpenLogFile.Visible = !string.IsNullOrEmpty(LogPath) && File.Exists(LogPath); btnContinue.Visible = IsUnhandledException; btnClose.Visible = IsUnhandledException; btnOK.Visible = !IsUnhandledException; }
public InputBox(string title = null, string inputText = null, string okText = null, string cancelText = null) { InitializeComponent(); ShareXResources.ApplyThemeToForm(this); InputText = inputText; if (!string.IsNullOrEmpty(title)) { Text = title; } if (!string.IsNullOrEmpty(InputText)) { txtInputText.Text = InputText; } if (!string.IsNullOrEmpty(okText)) { btnOK.Text = okText; } if (!string.IsNullOrEmpty(cancelText)) { btnCancel.Text = cancelText; } }
public MyMessageBox(string text, string caption, MessageBoxButtons buttons = MessageBoxButtons.OK, string checkBoxText = null, bool isChecked = false) { Width = 180; Height = 100; Text = caption; BackColor = SystemColors.Window; FormBorderStyle = FormBorderStyle.FixedDialog; ShowInTaskbar = false; TopMost = true; StartPosition = FormStartPosition.CenterScreen; MinimizeBox = false; MaximizeBox = false; Shown += MyMessageBox_Shown; Label labelText = new Label(); labelText.Margin = new Padding(0); labelText.Font = SystemFonts.MessageBoxFont; labelText.TextAlign = ContentAlignment.MiddleLeft; labelText.AutoSize = true; labelText.MinimumSize = new Size(125, 0); labelText.MaximumSize = new Size(400, 400); labelText.Location = new Point(0, 0); labelText.Text = text; Button button1 = new Button(); button1.Margin = new Padding(0, ButtonPadding, ButtonPadding, ButtonPadding); button1.BackColor = Color.Transparent; button1.Size = new Size(80, 26); button1.UseVisualStyleBackColor = false; button1.Text = "button1"; button1.TabIndex = 0; button1.Click += (sender, e) => { DialogResult = button1Result; Close(); }; Button button2 = new Button(); button2.Margin = new Padding(0, ButtonPadding, ButtonPadding, ButtonPadding); button2.BackColor = Color.Transparent; button2.Size = new Size(80, 26); button2.UseVisualStyleBackColor = false; button2.Text = "button2"; button2.TabIndex = 1; button2.Click += (sender, e) => { DialogResult = button2Result; Close(); }; switch (buttons) { default: case MessageBoxButtons.OK: button1.Text = Resources.MyMessageBox_MyMessageBox_OK; button1Result = DialogResult.OK; button2.Visible = false; break; case MessageBoxButtons.OKCancel: button1.Text = Resources.MyMessageBox_MyMessageBox_OK; button1Result = DialogResult.OK; button2.Text = Resources.MyMessageBox_MyMessageBox_Cancel; button2Result = DialogResult.Cancel; break; case MessageBoxButtons.YesNo: button1.Text = Resources.MyMessageBox_MyMessageBox_Yes; button1Result = DialogResult.Yes; button2.Text = Resources.MyMessageBox_MyMessageBox_No; button2Result = DialogResult.No; break; } FlowLayoutPanel panel = new FlowLayoutPanel(); panel.BackColor = Color.FromArgb(240, 240, 240); panel.FlowDirection = FlowDirection.RightToLeft; FlowLayoutPanel labelPanel = new FlowLayoutPanel(); labelPanel.FlowDirection = FlowDirection.TopDown; labelPanel.AutoSize = true; labelPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink; labelPanel.Location = new Point(LabelHorizontalPadding, LabelVerticalPadding); labelPanel.Controls.Add(labelText); if (checkBoxText != null) { IsChecked = isChecked; CheckBox checkBox = new CheckBox(); checkBox.Font = SystemFonts.MessageBoxFont; checkBox.Margin = new Padding(2, LabelVerticalPadding, 0, 0); checkBox.AutoSize = true; checkBox.Text = checkBoxText; checkBox.CheckedChanged += (sender, e) => IsChecked = checkBox.Checked; labelPanel.Controls.Add(checkBox); } panel.Controls.Add(button2); panel.Controls.Add(button1); Controls.Add(labelPanel); Controls.Add(panel); panel.Location = new Point(0, labelPanel.Bottom + LabelVerticalPadding); panel.Size = new Size(labelPanel.Width + (LabelHorizontalPadding * 2), button1.Height + (ButtonPadding * 2)); ClientSize = new Size(panel.Width, labelPanel.Height + (LabelVerticalPadding * 2) + panel.Height); ShareXResources.ApplyThemeToForm(this); if (ShareXResources.UseDarkTheme) { panel.BackColor = ShareXResources.DarkBorderColor; } }