1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace TaskbarGroups.Views
- {
- public partial class BaseControl : UserControl
- {
- public BaseControl()
- {
- InitializeComponent();
- }
- private void InitializeComponent()
- {
- }
- private void BaseControl_Load(object sender, EventArgs e)
- {
- }
- /// <summary>
- /// Control 之间跳转
- /// </summary>
- /// <param name="type"></param>
- /// <returns></returns>
- internal static Form Go(Type type)
- {
- Form currentControl = null;
- foreach (Form controlItem in Program.formList)
- {
- if (controlItem.GetType() == type)
- {
- currentControl = controlItem;
- currentControl.Activate();
- break;
- }
- }
- if (currentControl == null)
- {
- object obj = Activator.CreateInstance(type);
- if (obj is Form)
- {
- currentControl = obj as Form;
- currentControl.Show();
- }
- }
- return currentControl;
- }
- }
- }
|