|
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.ComponentModel; |
| 4 | +using System.Data; |
| 5 | +using System.Diagnostics; |
| 6 | +using System.Drawing; |
| 7 | +using System.IO; |
| 8 | +using System.Text; |
| 9 | +using System.Net; |
| 10 | +using System.Threading; |
| 11 | +using System.Windows.Forms; |
| 12 | + |
| 13 | + |
| 14 | +namespace GwBasic.Net |
| 15 | +{ |
| 16 | + |
| 17 | + public partial class Form1 : Form |
| 18 | + { |
| 19 | + private About about = new About(); |
| 20 | + private bool InfoShown; |
| 21 | + public Form1() |
| 22 | + { |
| 23 | + FormBorderStyle = FormBorderStyle.None; |
| 24 | + DoubleBuffered = true; |
| 25 | + InitializeComponent(); |
| 26 | + } |
| 27 | + |
| 28 | + private void Form1_Load(object sender, EventArgs e) |
| 29 | + { |
| 30 | + status.Text = ""; |
| 31 | + } |
| 32 | + #region close |
| 33 | + private void close_MouseMove(object sender, MouseEventArgs e) |
| 34 | + { |
| 35 | + close.Image = Properties.Resources.clsh; |
| 36 | + status.ForeColor = Color.FromArgb(255, 136, 136, 136); |
| 37 | + status.Text = "Close"; |
| 38 | + } |
| 39 | + |
| 40 | + private void close_Click(object sender, EventArgs e) |
| 41 | + { |
| 42 | + Close(); |
| 43 | + } |
| 44 | + |
| 45 | + private void close_MouseLeave(object sender, EventArgs e) |
| 46 | + { |
| 47 | + close.Image = Properties.Resources.CtrlBtn; |
| 48 | + status.ForeColor = Color.FromArgb(255, 136, 136, 136); |
| 49 | + status.Text = ""; |
| 50 | + } |
| 51 | + #endregion close |
| 52 | + |
| 53 | + #region max |
| 54 | + private void max_Click(object sender, EventArgs e) |
| 55 | + { |
| 56 | + if (this.WindowState == FormWindowState.Normal) |
| 57 | + { |
| 58 | + |
| 59 | + this.WindowState = FormWindowState.Maximized; |
| 60 | + this.Refresh(); |
| 61 | + } |
| 62 | + else |
| 63 | + { |
| 64 | + this.WindowState = FormWindowState.Normal; |
| 65 | + this.Refresh(); |
| 66 | + } |
| 67 | + } |
| 68 | + |
| 69 | + private void max_MouseMove(object sender, MouseEventArgs e) |
| 70 | + { |
| 71 | + max.Image = Properties.Resources.minmaxh; |
| 72 | + if (this.WindowState == FormWindowState.Normal) |
| 73 | + { |
| 74 | + status.ForeColor = Color.FromArgb(255, 136, 136, 136); |
| 75 | + status.Text = "Maximize"; |
| 76 | + } |
| 77 | + else |
| 78 | + { |
| 79 | + status.ForeColor = Color.FromArgb(255, 136, 136, 136); |
| 80 | + status.Text = "Restore"; |
| 81 | + } |
| 82 | + } |
| 83 | + |
| 84 | + private void max_MouseLeave(object sender, EventArgs e) |
| 85 | + { |
| 86 | + max.Image = Properties.Resources.CtrlBtn; |
| 87 | + status.ForeColor = Color.FromArgb(255, 136, 136, 136); |
| 88 | + status.Text = ""; |
| 89 | + } |
| 90 | + #endregion max |
| 91 | + |
| 92 | + #region min |
| 93 | + private void min_Click(object sender, EventArgs e) |
| 94 | + { |
| 95 | + this.WindowState = FormWindowState.Minimized; |
| 96 | + } |
| 97 | + |
| 98 | + private void min_MouseMove(object sender, MouseEventArgs e) |
| 99 | + { |
| 100 | + min.Image = Properties.Resources.minmaxh; |
| 101 | + status.ForeColor = Color.FromArgb(255, 136, 136, 136); |
| 102 | + status.Text = "Minimize"; |
| 103 | + } |
| 104 | + |
| 105 | + private void min_MouseLeave(object sender, EventArgs e) |
| 106 | + { |
| 107 | + min.Image = Properties.Resources.CtrlBtn; |
| 108 | + status.ForeColor = Color.FromArgb(255, 136, 136, 136); |
| 109 | + status.Text = ""; |
| 110 | + } |
| 111 | + #endregion min |
| 112 | + |
| 113 | + #region write new |
| 114 | + private void pictureBox3_MouseMove(object sender, MouseEventArgs e) |
| 115 | + { |
| 116 | + pictureBox3.BackgroundImage = Properties.Resources.tile_frame_h; |
| 117 | + status.Text = "Write New Program"; |
| 118 | + } |
| 119 | + |
| 120 | + private void pictureBox3_MouseLeave(object sender, EventArgs e) |
| 121 | + { |
| 122 | + pictureBox3.BackgroundImage = Properties.Resources.tile_frame; |
| 123 | + status.Text = ""; |
| 124 | + } |
| 125 | + private void pictureBox3_Click(object sender, EventArgs e) |
| 126 | + { |
| 127 | + SyntaxEditor syntaxEditor = new SyntaxEditor(); |
| 128 | + syntaxEditor.synBox1.Text= "10 REM Start Writing your GW-Basic Code Here: \n20 "; |
| 129 | + syntaxEditor.Show(); |
| 130 | + this.Hide(); |
| 131 | + } |
| 132 | + #endregion write new |
| 133 | + |
| 134 | + #region open existing |
| 135 | + private void pictureBox4_MouseMove(object sender, MouseEventArgs e) |
| 136 | + { |
| 137 | + pictureBox4.BackgroundImage = Properties.Resources.tile_frame_h; |
| 138 | + status.Text = "Open Existing Program"; |
| 139 | + } |
| 140 | + |
| 141 | + private void pictureBox4_MouseLeave(object sender, EventArgs e) |
| 142 | + { |
| 143 | + pictureBox4.BackgroundImage = Properties.Resources.tile_frame; |
| 144 | + status.Text = ""; |
| 145 | + } |
| 146 | + |
| 147 | + private void pictureBox4_Click(object sender, EventArgs e) |
| 148 | + { |
| 149 | + MessageBox.Show("Documentation not available yet."); |
| 150 | + } |
| 151 | + #endregion open existing |
| 152 | + |
| 153 | + #region Console |
| 154 | + private void pictureBox13_Click(object sender, EventArgs e) |
| 155 | + { |
| 156 | + Process.Start("Console.bat"); |
| 157 | + } |
| 158 | + |
| 159 | + private void pictureBox13_MouseLeave(object sender, EventArgs e) |
| 160 | + { |
| 161 | + pictureBox13.BackgroundImage = Properties.Resources.tile_frame; |
| 162 | + status.Text = ""; |
| 163 | + } |
| 164 | + |
| 165 | + private void pictureBox13_MouseMove(object sender, MouseEventArgs e) |
| 166 | + { |
| 167 | + pictureBox13.BackgroundImage = Properties.Resources.tile_frame_h; |
| 168 | + status.Text = "Open PcBasic Console"; |
| 169 | + } |
| 170 | + |
| 171 | + |
| 172 | + |
| 173 | + |
| 174 | + |
| 175 | + |
| 176 | + |
| 177 | + |
| 178 | + #endregion Console |
| 179 | + |
| 180 | + private void Form1_FormClosed(object sender, FormClosedEventArgs e) |
| 181 | + { |
| 182 | + Application.Exit(); |
| 183 | + } |
| 184 | + |
| 185 | + #region About |
| 186 | + private void ShowAbout() |
| 187 | + { |
| 188 | + var pstate = this.WindowState; |
| 189 | + this.Size = new Size(867, 551); |
| 190 | + var xposition = (Screen.PrimaryScreen.WorkingArea.Width - Size.Width) / 2; |
| 191 | + var yposition = (Screen.PrimaryScreen.WorkingArea.Height - Size.Height) / 2; |
| 192 | + this.Location = new Point(xposition, yposition); |
| 193 | + this.Refresh(); |
| 194 | + |
| 195 | + about.Size = this.Size; |
| 196 | + about.StartPosition = FormStartPosition.CenterScreen; |
| 197 | + about.WindowState = pstate; |
| 198 | + |
| 199 | + about.Show(); |
| 200 | + InfoShown = true; |
| 201 | + } |
| 202 | + |
| 203 | + private void pictureBox9_Click(object sender, EventArgs e) |
| 204 | + { |
| 205 | + ShowAbout(); |
| 206 | + } |
| 207 | + |
| 208 | + private void pictureBox9_MouseMove(object sender, MouseEventArgs e) |
| 209 | + { |
| 210 | + pictureBox9.Image = Properties.Resources.info_h; |
| 211 | + status.Text = "Info"; |
| 212 | + } |
| 213 | + |
| 214 | + private void pictureBox9_MouseLeave(object sender, EventArgs e) |
| 215 | + { |
| 216 | + pictureBox9.Image = Properties.Resources.info; |
| 217 | + status.Text = ""; |
| 218 | + } |
| 219 | + |
| 220 | + private void Form1_Activated(object sender, EventArgs e) |
| 221 | + { |
| 222 | + if (InfoShown) |
| 223 | + { |
| 224 | + about.Activate(); |
| 225 | + } |
| 226 | + } |
| 227 | + #endregion About |
| 228 | + |
| 229 | + private void miniTimer_LinkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) |
| 230 | + { |
| 231 | + System.Diagnostics.Process.Start(miniTimer_LinkLabel2.Text); |
| 232 | + } |
| 233 | + } |
| 234 | +} |
0 commit comments