Esempio n. 1
0
        private void FormRegion_Load(object sender, EventArgs e)
        {
            ScreenDictionary.Clear();
            comboBoxScreenTemplate.Items.Clear();
            comboBoxTags.DataSource = null;

            int component = 1;

            foreach (System.Windows.Forms.Screen screen in System.Windows.Forms.Screen.AllScreens)
            {
                ScreenDictionary.Add(component, screen);
                component++;
            }

            // *** Screen Template ***
            comboBoxScreenTemplate.Items.Add(string.Empty);

            for (int i = 1; i <= ScreenDictionary.Count; i++)
            {
                System.Windows.Forms.Screen screen = ScreenDictionary[i];
                comboBoxScreenTemplate.Items.Add("Screen " + i + " (" + screen.Bounds.Width + " x " + screen.Bounds.Height + ")");
            }

            comboBoxScreenTemplate.SelectedIndex = 0;
            // ***********************

            // *** Macro Tags ***
            comboBoxTags.DisplayMember = "Description";
            comboBoxTags.ValueMember   = "Name";
            comboBoxTags.DataSource    = MacroTagCollection.GetList();
            // ******************

            comboBoxFormat.Items.Clear();

            foreach (ImageFormat imageFormat in ImageFormatCollection)
            {
                comboBoxFormat.Items.Add(imageFormat.Name);
            }

            if (RegionObject != null)
            {
                Text = "Change Region";

                textBoxName.Text                   = RegionObject.Name;
                textBoxFolder.Text                 = FileSystem.CorrectDirectoryPath(RegionObject.Folder);
                textBoxMacro.Text                  = RegionObject.Macro;
                comboBoxFormat.SelectedItem        = RegionObject.Format.Name;
                numericUpDownJpegQuality.Value     = RegionObject.JpegQuality;
                numericUpDownResolutionRatio.Value = RegionObject.ResolutionRatio;
                checkBoxMouse.Checked              = RegionObject.Mouse;
                numericUpDownX.Value               = RegionObject.X;
                numericUpDownY.Value               = RegionObject.Y;
                numericUpDownWidth.Value           = RegionObject.Width;
                numericUpDownHeight.Value          = RegionObject.Height;
            }
            else
            {
                Text = "Add New Region";

                textBoxName.Text                   = "Region " + (RegionCollection.Count + 1);
                textBoxFolder.Text                 = FileSystem.ScreenshotsFolder;
                textBoxMacro.Text                  = MacroParser.DefaultMacro;
                comboBoxFormat.SelectedItem        = ScreenCapture.DefaultImageFormat;
                numericUpDownJpegQuality.Value     = 100;
                numericUpDownResolutionRatio.Value = 100;
                checkBoxMouse.Checked              = true;
                numericUpDownX.Value               = 0;
                numericUpDownY.Value               = 0;
                numericUpDownWidth.Value           = 800;
                numericUpDownHeight.Value          = 600;
            }

            timerPreview.Enabled = true;
        }
Esempio n. 2
0
        private void FormScreen_Load(object sender, EventArgs e)
        {
            comboBoxFormat.Items.Clear();
            comboBoxScreenComponent.Items.Clear();
            comboBoxTags.DataSource = null;

            pictureBoxPreview.Image = null;

            // *** Macro Tags ***
            comboBoxTags.DisplayMember = "Description";
            comboBoxTags.ValueMember   = "Name";
            comboBoxTags.DataSource    = MacroTagCollection.GetList();
            // ******************

            foreach (ImageFormat imageFormat in ImageFormatCollection)
            {
                comboBoxFormat.Items.Add(imageFormat.Name);
            }

            comboBoxScreenComponent.Items.Add("Active Window");

            for (int i = 1; i <= ScreenDictionary.Count; i++)
            {
                System.Windows.Forms.Screen screen = ScreenDictionary[i];
                comboBoxScreenComponent.Items.Add("Screen " + i + " (" + screen.Bounds.Width + " x " + screen.Bounds.Height + ")");
            }

            if (ScreenObject != null)
            {
                Text = "Change Screen";

                textBoxName.Text   = ScreenObject.Name;
                textBoxFolder.Text = FileSystem.CorrectDirectoryPath(ScreenObject.Folder);
                textBoxMacro.Text  = ScreenObject.Macro;

                if (ScreenObject.Component < comboBoxScreenComponent.Items.Count)
                {
                    SetControls(enabled: true);
                    comboBoxScreenComponent.SelectedIndex = ScreenObject.Component;
                }
                else
                {
                    SetControls(enabled: false);
                }

                comboBoxFormat.SelectedItem        = ScreenObject.Format.Name;
                numericUpDownJpegQuality.Value     = ScreenObject.JpegQuality;
                numericUpDownResolutionRatio.Value = ScreenObject.ResolutionRatio;
                checkBoxMouse.Checked = ScreenObject.Mouse;
            }
            else
            {
                Text = "Add New Screen";

                textBoxName.Text   = "Screen " + (ScreenCollection.Count + 1);
                textBoxFolder.Text = FileSystem.ScreenshotsFolder;
                textBoxMacro.Text  = MacroParser.DefaultMacro;
                comboBoxScreenComponent.SelectedIndex = 0;
                comboBoxFormat.SelectedItem           = ScreenCapture.DefaultImageFormat;
                numericUpDownJpegQuality.Value        = 100;
                numericUpDownResolutionRatio.Value    = 100;
                checkBoxMouse.Checked = true;
            }

            timerScreenPreview.Enabled = true;
        }