Example #1
0
        private void NewOverlay(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(fileTextBox.Text))
            {
                MessageBox.Show("You need to specify an image file.", "Invalid Data", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            if (!topLeftRadioButton.Checked &&
                !topRadioButton.Checked &&
                !topRightRadioButton.Checked &&
                !leftRadioButton.Checked &&
                !centerRadioButton.Checked &&
                !rightRadioButton.Checked &&
                !bottomLeftRadioButton.Checked &&
                !bottomRadioButton.Checked &&
                !bottomRightRadioButton.Checked)
            {
                MessageBox.Show("You need to specify a screen position.", "Invalid Data", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            ImageOverlay overlay = new ImageOverlay();

            overlay.FullPath            = fileTextBox.Text;
            overlay.FileName            = Path.GetFileName(overlay.FullPath);
            overlay.VerticalAlignment   = _verticalAlignment;
            overlay.HorizontalAlignment = _horizontalAlignment;
            overlay.Margin = (int)marginNumericUpDown.Value;
            _overlays.Add(overlay);

            ClearFields();
        }
Example #2
0
        private void MoveOverlayDown(object sender, EventArgs e)
        {
            ImageOverlay overlay = overlaysListBox.SelectedItem as ImageOverlay;
            int          index   = _overlays.IndexOf(overlay);

            _overlays.Remove(overlay);
            _overlays.Insert(index + 1, overlay);
            overlaysListBox.SelectedItem = overlay;
        }
Example #3
0
        public object Clone()
        {
            ImageOverlay clone = new ImageOverlay();
            clone.FullPath = FullPath.Clone() as string;
            clone.FileName = FileName.Clone() as string;
            clone.HorizontalAlignment = HorizontalAlignment;
            clone.VerticalAlignment = VerticalAlignment;
            clone.Margin = Margin;

            return clone;
        }
Example #4
0
        public object Clone()
        {
            ImageOverlay clone = new ImageOverlay();

            clone.FullPath            = FullPath.Clone() as string;
            clone.FileName            = FileName.Clone() as string;
            clone.HorizontalAlignment = HorizontalAlignment;
            clone.VerticalAlignment   = VerticalAlignment;
            clone.Margin = Margin;

            return(clone);
        }
Example #5
0
        private void UpdateOverlay(object sender, EventArgs e)
        {
            ImageOverlay overlay = overlaysListBox.SelectedItem as ImageOverlay;

            overlay.FullPath            = fileTextBox.Text;
            overlay.FileName            = Path.GetFileName(overlay.FullPath);
            overlay.VerticalAlignment   = _verticalAlignment;
            overlay.HorizontalAlignment = _horizontalAlignment;
            overlay.Margin = (int)marginNumericUpDown.Value;
            _overlays.ResetItem(_overlays.IndexOf(overlay));

            ClearFields();
        }
Example #6
0
        private void OverlaySelected(object sender, EventArgs e)
        {
            ImageOverlay overlay = overlaysListBox.SelectedItem as ImageOverlay;

            if (overlay != null)
            {
                fileTextBox.Text          = overlay.FullPath;
                marginNumericUpDown.Value = overlay.Margin;
                moveDownButton.Enabled    = _overlays[_overlays.Count - 1] != overlay;
                moveUpButton.Enabled      = _overlays[0] != overlay;

                // Yeah it's ugly, but it works
                switch (overlay.VerticalAlignment)
                {
                case VerticalAlignment.Bottom:
                    switch (overlay.HorizontalAlignment)
                    {
                    case HorizontalAlignment.Center:
                        bottomRadioButton.Checked = true;
                        break;

                    case HorizontalAlignment.Left:
                        bottomLeftRadioButton.Checked = true;
                        break;

                    case HorizontalAlignment.Right:
                        bottomRightRadioButton.Checked = true;
                        break;
                    }
                    break;

                case VerticalAlignment.Center:
                    switch (overlay.HorizontalAlignment)
                    {
                    case HorizontalAlignment.Center:
                        centerRadioButton.Checked = true;
                        break;

                    case HorizontalAlignment.Left:
                        leftRadioButton.Checked = true;
                        break;

                    case HorizontalAlignment.Right:
                        rightRadioButton.Checked = true;
                        break;
                    }
                    break;

                case VerticalAlignment.Top:
                    switch (overlay.HorizontalAlignment)
                    {
                    case HorizontalAlignment.Center:
                        topRadioButton.Checked = true;
                        break;

                    case HorizontalAlignment.Left:
                        topLeftRadioButton.Checked = true;
                        break;

                    case HorizontalAlignment.Right:
                        topRightRadioButton.Checked = true;
                        break;
                    }
                    break;
                }
            }

            deleteButton.Enabled = true;
            updateButton.Enabled = true;
        }
Example #7
0
        private void NewOverlay(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(fileTextBox.Text))
            {
                MessageBox.Show("You need to specify an image file.", "Invalid Data", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            if (!topLeftRadioButton.Checked &&
                !topRadioButton.Checked &&
                !topRightRadioButton.Checked &&
                !leftRadioButton.Checked &&
                !centerRadioButton.Checked &&
                !rightRadioButton.Checked &&
                !bottomLeftRadioButton.Checked &&
                !bottomRadioButton.Checked &&
                !bottomRightRadioButton.Checked)
            {
                MessageBox.Show("You need to specify a screen position.", "Invalid Data", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            ImageOverlay overlay = new ImageOverlay();

            overlay.FullPath = fileTextBox.Text;
            overlay.FileName = Path.GetFileName(overlay.FullPath);
            overlay.VerticalAlignment = _verticalAlignment;
            overlay.HorizontalAlignment = _horizontalAlignment;
            overlay.Margin = (int)marginNumericUpDown.Value;
            _overlays.Add(overlay);

            ClearFields();
        }