Ejemplo n.º 1
0
        private void ComboBoxGameSelection_DrawItem(object sender, DrawItemEventArgs e)
        {
            e.DrawBackground();
            e.DrawFocusRectangle();

            if (e.Index >= 0)
            {
                FixerHost item = (FixerHost)this.comboBoxGameSelection.Items[e.Index];
                if (item.GameIcon != null)
                {
                    Bitmap icon = item.GameIcon;
                    e.Graphics.DrawImage(icon, e.Bounds.X, e.Bounds.Y, 15, 15);
                    using (SolidBrush solidBrush = new SolidBrush(e.ForeColor))
                    {
                        e.Graphics.DrawString(item.GameName, e.Font, solidBrush, new Point(e.Bounds.X + 16, e.Bounds.Y + 1));
                    }
                }
                else
                {
                    using (SolidBrush solidBrush = new SolidBrush(e.ForeColor))
                    {
                        e.Graphics.DrawString(item.GameName, e.Font, solidBrush, new Point(e.Bounds.X + 16, e.Bounds.Y + 1));
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public WidescreenFixerApp()
        {
            this.InitializeComponent();

            // Initialize the detect displays library.
            DetectedDisplays.Initialize();

            // Default Window State
            this.WindowState = FormWindowState.Normal;

            // Check if the application even cares
            if (Properties.Settings.Default.RememberWindowPosition)
            {
                // Are the bounds okay?
                if (Properties.Settings.Default.WindowGeometry != Rectangle.Empty && IsVisibleOnAnyScreen(Properties.Settings.Default.WindowGeometry))
                {
                    // Set bounds
                    this.StartPosition = FormStartPosition.Manual;
                    this.DesktopBounds = Properties.Settings.Default.WindowGeometry;

                    // Use saved state value
                    this.WindowState = Properties.Settings.Default.WindowState;
                }
                else
                {
                    // Reset upper-left corner
                    this.StartPosition = FormStartPosition.WindowsDefaultLocation;

                    // Restore saved size
                    if (Properties.Settings.Default.WindowGeometry != Rectangle.Empty)
                    {
                        try
                        {
                            this.Size = Properties.Settings.Default.WindowGeometry.Size;
                        }
                        catch
                        {
                            // MAKE SURE THIS IS UPDATED IF THE MAIN WINDOW FORM IS EVER RESIZED!
                            this.Size = new Size(334, 263);

                            throw;
                        }
                    }
                }
            }

            // Update the Game Selection
            this.UpdateGameSelection();
            this.fixerHost = this.comboBoxGameSelection.SelectedItem as FixerHost;

            this.comboBoxGameSelection.DrawItem += new DrawItemEventHandler(this.ComboBoxGameSelection_DrawItem);

            this.Load                   += new EventHandler(this.MainForm_Load);
            this.FormClosed             += new FormClosedEventHandler(this.MainForm_FormClosed);
            this.Resize                 += new EventHandler(this.MainForm_Resize);
            this.notifyIcon.DoubleClick += new EventHandler(this.NotifyIcon_DoubleClick);
            this.timerValues.Tick       += new EventHandler(this.TimerValues_Tick);
            this.comboBoxGameSelection.SelectedIndexChanged += new EventHandler(this.ComboBoxGameSelection_SelectedIndexChanged);
            this.textBoxHotkey.KeyDown += new KeyEventHandler(this.TextBoxHotkey_KeyDown);
        }
Ejemplo n.º 3
0
        private void ComboBoxGameSelection_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.fixerHost != null)
            {
                this.fixerHost.Disable();
                this.fixerHost.Finish();
            }

            this.labelGameRunningValue.Text = "No";
            this.labelFixEnabledValue.Text  = "No";
            this.labelValue1.Text           = string.Empty;
            this.labelValue2.Text           = string.Empty;
            this.labelValue3.Text           = string.Empty;
            this.labelValue4.Text           = string.Empty;
            this.labelValue5.Text           = string.Empty;

            if (this.comboBoxGameSelection.SelectedItem != null && this.comboBoxGameSelection.SelectedIndex >= 0)
            {
                this.fixerHost = this.comboBoxGameSelection.SelectedItem as FixerHost;
                this.fixSetup  = false;
            }

            // Sets the title for the first custom value slot.
            if (!string.IsNullOrEmpty(this.fixerHost.ValueTitle1))
            {
                this.labelTitleValue1.Text = this.fixerHost.ValueTitle1 + ":";
            }
            else
            {
                this.labelTitleValue1.Text = string.Empty;
            }

            // Sets the title for the second custom value slot.
            if (!string.IsNullOrEmpty(this.fixerHost.ValueTitle2))
            {
                this.labelTitleValue2.Text = this.fixerHost.ValueTitle2 + ":";
            }
            else
            {
                this.labelTitleValue2.Text = string.Empty;
            }

            // Sets the title for the third custom value slot.
            if (!string.IsNullOrEmpty(this.fixerHost.ValueTitle3))
            {
                this.labelTitleValue3.Text = this.fixerHost.ValueTitle3 + ":";
            }
            else
            {
                this.labelTitleValue3.Text = string.Empty;
            }

            // Sets the title for the fourth custom value slot.
            if (!string.IsNullOrEmpty(this.fixerHost.ValueTitle4))
            {
                this.labelTitleValue4.Text = this.fixerHost.ValueTitle4 + ":";
            }
            else
            {
                this.labelTitleValue4.Text = string.Empty;
            }

            // Sets the title for the fifth custom value slot.
            if (!string.IsNullOrEmpty(this.fixerHost.ValueTitle5))
            {
                this.labelTitleValue5.Text = this.fixerHost.ValueTitle5 + ":";
            }
            else
            {
                this.labelTitleValue5.Text = string.Empty;
            }
        }