示例#1
0
        private ImageViewer(Image img)
        {
            InitializeComponent();
            ShareXResources.ApplyTheme(this);

            LoadImage(img);
        }
示例#2
0
        private ImageViewer(Image image)
        {
            screenshot = image;

            InitializeComponent();
            ShareXResources.ApplyTheme(this);
        }
示例#3
0
        public ClipboardViewerForm()
        {
            InitializeComponent();
            ShareXResources.ApplyTheme(this);

            RefreshClipboardContentList();
        }
示例#4
0
        public OutputBox(string text, string title)
        {
            InitializeComponent();
            ShareXResources.ApplyTheme(this);

            Text         = "ShareX - " + title;
            txtText.Text = text;
        }
示例#5
0
        public OutputBox(string text, string title, bool scrollToEnd = false)
        {
            InitializeComponent();
            ShareXResources.ApplyTheme(this);

            Text             = "ShareX - " + title;
            txtText.Text     = text;
            this.scrollToEnd = scrollToEnd;
        }
示例#6
0
        public PrintTextForm(string text, PrintSettings settings)
        {
            InitializeComponent();
            ShareXResources.ApplyTheme(this);

            printHelper          = new PrintHelper(text);
            printHelper.Settings = printSettings = settings;
            LoadSettings();
        }
示例#7
0
        private ImageViewer(string[] images, int currentImageIndex = 0)
        {
            InitializeComponent();
            ShareXResources.ApplyTheme(this);

            Images            = images;
            CurrentImageIndex = currentImageIndex;
            FilterImageFiles();
            LoadCurrentImage();
        }
示例#8
0
文件: PrintForm.cs 项目: ywscr/ShareX
        public PrintForm(Image img, PrintSettings settings, bool previewOnly = false)
        {
            InitializeComponent();
            ShareXResources.ApplyTheme(this);

            printHelper          = new PrintHelper(img);
            printHelper.Settings = printSettings = settings;
            btnPrint.Enabled     = !previewOnly;
            LoadSettings();
        }
示例#9
0
        public GradientPickerForm(GradientInfo gradient)
        {
            Gradient = gradient;

            InitializeComponent();
            ShareXResources.ApplyTheme(this);

            cbGradientType.Items.AddRange(Helpers.GetEnumNamesProper <LinearGradientMode>());
            cbGradientType.SelectedIndex = (int)Gradient.Type;
            UpdateGradientList();
        }
示例#10
0
        public ClipboardContentViewer(bool showCheckBox = false)
        {
            InitializeComponent();
            ShareXResources.ApplyTheme(this);

            if (ShareXResources.ExperimentalCustomTheme)
            {
                lblQuestion.BackColor = ShareXResources.Theme.BorderColor;
            }

            cbDontShowThisWindow.Visible = showCheckBox;
        }
示例#11
0
        private DownloaderForm()
        {
            InitializeComponent();
            ShareXResources.ApplyTheme(this);

            ChangeStatus(Resources.DownloaderForm_DownloaderForm_Waiting_);
            Status                   = DownloaderFormStatus.Waiting;
            AutoStartDownload        = true;
            InstallType              = InstallType.Silent;
            AutoStartInstall         = true;
            RunInstallerInBackground = true;
        }
示例#12
0
        public GradientPickerForm(GradientInfo gradient)
        {
            Gradient = gradient;

            InitializeComponent();
            ShareXResources.ApplyTheme(this);

            cbGradientType.Items.AddRange(Helpers.GetLocalizedEnumDescriptions <LinearGradientMode>());
            cbGradientType.SelectedIndex = (int)Gradient.Type;
            UpdateGradientList(true);
            AddPresets();
        }
示例#13
0
        public ColorPickerForm(Color currentColor, bool isScreenColorPickerMode = false)
        {
            InitializeComponent();
            ShareXResources.ApplyTheme(this);

            IsScreenColorPickerMode = isScreenColorPickerMode;

            PrepareColorPalette();
            SetCurrentColor(currentColor, !IsScreenColorPickerMode);

            btnOK.Visible  = btnCancel.Visible = !IsScreenColorPickerMode;
            mbCopy.Visible = btnClose.Visible = pCursorPosition.Visible = IsScreenColorPickerMode;
        }
示例#14
0
        public HashCheckForm()
        {
            InitializeComponent();
            ShareXResources.ApplyTheme(this);

            UpdateCompareControls();
            cbHashType.Items.AddRange(Helpers.GetEnumDescriptions <HashType>());
            cbHashType.SelectedIndex = (int)HashType.SHA1;

            hashCheck = new HashCheck();
            hashCheck.FileCheckProgressChanged += fileCheck_FileCheckProgressChanged;

            translator = new Translator();
        }
示例#15
0
        public GradientPickerForm(GradientInfo gradient)
        {
            Gradient = gradient;

            InitializeComponent();
            ShareXResources.ApplyTheme(this);

            cbGradientType.Items.AddRange(Helpers.GetEnumNamesProper <LinearGradientMode>());
            cbGradientType.SelectedIndex = (int)Gradient.Type;
            foreach (GradientStop gradientStop in Gradient.Colors)
            {
                AddGradientStop(gradientStop);
            }
            isReady = true;
            UpdatePreview();
        }
示例#16
0
        public UpdateMessageBox(bool activateWindow, UpdateChecker updateChecker)
        {
            ActivateWindow = activateWindow;

            InitializeComponent();
            ShareXResources.ApplyTheme(this);

            if (!ActivateWindow)
            {
                WindowState = FormWindowState.Minimized;
                NativeMethods.FlashWindowEx(this, 10);
            }

            Text = Resources.UpdateMessageBox_UpdateMessageBox_update_is_available;

            StringBuilder sbText = new StringBuilder();

            if (updateChecker.IsPortable)
            {
                sbText.AppendLine(Helpers.SafeStringFormat(Resources.UpdateMessageBox_UpdateMessageBox_Portable, Application.ProductName));
            }
            else
            {
                sbText.AppendLine(Helpers.SafeStringFormat(Resources.UpdateMessageBox_UpdateMessageBox_, Application.ProductName));
            }

            sbText.AppendLine();
            sbText.Append(Resources.UpdateMessageBox_UpdateMessageBox_CurrentVersion);
            sbText.Append(": ");
            sbText.Append(updateChecker.CurrentVersion);
            if (updateChecker.IsBeta)
            {
                sbText.Append(" Beta");
            }
            sbText.AppendLine();
            sbText.Append(Resources.UpdateMessageBox_UpdateMessageBox_LatestVersion);
            sbText.Append(": ");
            sbText.Append(updateChecker.LatestVersion);
            if (updateChecker is GitHubUpdateChecker githubUpdateChecker && githubUpdateChecker.IsPreRelease)
            {
                sbText.Append(" (Pre-release)");
            }

            lblText.Text = sbText.ToString();
        }
示例#17
0
        public ColorPickerForm(Color currentColor, bool isScreenColorPickerMode = false, bool checkClipboard = true)
        {
            InitializeComponent();
            ShareXResources.ApplyTheme(this);
            clipboardStatusHider = new ControlHider(btnClipboardStatus, 2000);

            IsScreenColorPickerMode = isScreenColorPickerMode;

            PrepareColorPalette();
            SetCurrentColor(currentColor, !IsScreenColorPickerMode);

            if (checkClipboard)
            {
                CheckClipboard();
            }

            btnOK.Visible  = btnCancel.Visible = !IsScreenColorPickerMode;
            mbCopy.Visible = btnClose.Visible = pCursorPosition.Visible = IsScreenColorPickerMode;
        }
示例#18
0
        public MonitorTestForm()
        {
            InitializeComponent();
            ShareXResources.ApplyTheme(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;
        }
示例#19
0
文件: DebugForm.cs 项目: ywscr/ShareX
        private DebugForm(Logger logger)
        {
            Logger = logger;

            InitializeComponent();

            rtbDebug.Text           = Logger.ToString();
            rtbDebug.SelectionStart = rtbDebug.TextLength;
            rtbDebug.ScrollToCaret();
            rtbDebug.AddContextMenu();

            ShareXResources.ApplyTheme(this);

            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;
        }
示例#20
0
        public ErrorForm(string errorTitle, string errorMessage, string logPath, string bugReportPath, bool unhandledException = true)
        {
            InitializeComponent();
            ShareXResources.ApplyTheme(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;
        }
示例#21
0
        public InputBox(string title = null, string inputText = null, string okText = null, string cancelText = null)
        {
            InitializeComponent();
            ShareXResources.ApplyTheme(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;
            }
        }
示例#22
0
        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.ApplyTheme(this);

            if (ShareXResources.ExperimentalCustomTheme)
            {
                panel.BackColor = ShareXResources.Theme.BorderColor;
            }
        }