using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Drawing.Drawing2D; using System.Linq; using System.Net.Http; using System.Reflection.Emit; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace CSS_Solution.Forms { partial class MainForm : Form { public MainForm() { InitializeComponent(); switch_panels = new List<(Panel, PictureBox)> { (HomePanel,HomePicture),(SetTaskPanel, SetTaskPicture), (RunTaskPanel, RunTaskPicture) ,(SettingsPanel,SettingsPicture)}; change_form(function_forms[0]); } //private void MainForm_Load(object sender, EventArgs e) //{ // AllocConsole(); //} //[DllImport("kernel32.dll", SetLastError = true)] //[return: MarshalAs(UnmanagedType.Bool)] //static extern bool AllocConsole(); private List
function_forms = new List { new Welcome_Form(), new Change_Task_Form(), new Task_Run_Form(), new Settings_Form() }; private List<(Panel, PictureBox)> switch_panels; private void change_form(Form form) { FunctionPanel.Controls.Clear(); form.TopLevel = false; form.Dock = DockStyle.Fill; FunctionPanel.Controls.Add(form); form.Show(); } private void SwitchPanels_Click(object sender, EventArgs e) { for (int i = 0; i < switch_panels.Count; i++) { var (panel, picture) = switch_panels[i]; if (panel == sender || picture == sender) { change_form(function_forms[i]); break; } } } private void SwitchPanels_MouseEnter(object sender, EventArgs e) { } } }