📄 program.cs
字号:
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Reflection;
using System.Reflection.Emit;
using System.Threading;
namespace AddressList
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Assembly assem = Assembly.GetExecutingAssembly();
// Create an object from the assembly, passing in the correct number
// and type of arguments for the constructor.
//Object o = assem.CreateInstance("Example", false,
// BindingFlags.ExactBinding,
// null, new Object[] { 2 }, null, null);
// Make a late-bound call to an instance method of the object.
//MethodInfo m = assem.GetType("Example").GetMethod("SampleMethod");
//Object ret = m.Invoke(o, new Object[] { 42 });
//fmLogin login = new fmLogin();
//取得类型
Type objType = assem.GetType("AddressList.Forms.fmLogin", true, true);
//Type objType = Type.GetType("AddressList.fmLogin");
//定义构造函数信息
ConstructorInfo objCtor = objType.GetConstructor(Type.EmptyTypes);//Type.EmptyTypes
//调用构造函数,并把返回结果强转为Form
Form login = (Form)objCtor.Invoke(null);
if (login != null)
{
login.ShowDialog();
if (login.DialogResult == DialogResult.Yes)
Application.Run(new Forms.fmAddressData());
}
else
Application.Exit();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -