1.toolStripStatusLabel居右: StatusStrip→LayoutStyle→HorizontalStackWithOverflow this.toolStripStatusLabel1.Alignment = ToolStripItemAlignment.Right; 2.实体类: class prices { public prices(int par_level,double par_price) { Level = par_level; Price = par_price; } public int Level { get; set; } public double Price { get; set; } } 3.保留两位小数: this.ttime_kryptonLabel.Text = total_time.ToString("0.00")+"小时"; 4.Linq查询: vvar price = from p in pris where p.Level == level select p.Price; 5.TextBox中启用Tab: 设置属性AcceptsTab为True 6.设置Tooltip: //设置提示信息 ToolTip tip = new ToolTip(); tip.AutoPopDelay = 5000; tip.InitialDelay = 1000; tip.ReshowDelay = 500; tip.ShowAlways = true; tip.SetToolTip(this.organize_button, "将单页面Excel整合成一个Excel"); tip.SetToolTip(this.Math_button, "与前期捕获的数据对比,叠加没有捕获到的数据"); 7.处理前台界面假死: for (int i = 0; i < 10000; i++) { label1.Text = i.ToString(); Application.DoEvents(); } 8.内存释放: #region 内存回收 [DllImport("kernel32.dll", EntryPoint = "SetProcessWorkingSetSize")] public static extern int SetProcessWorkingSetSize(IntPtr process, int minSize, int maxSize); /// <summary> /// 释放内存 /// </summary> public static void ClearMemory() { GC.Collect(); GC.WaitForPendingFinalizers(); if (Environment.OSVersion.Platform == PlatformID.Win32NT) { SetProcessWorkingSetSize(System.Diagnostics.Process.GetCurrentProcess().Handle, -1, -1); } } #endregion DotNetBar: 1.Office窗体:继承: DevComponents.DotNetBar.OfficeForm 在构造函数中加入:this.EnableGlass = false; 2.Bar控件: 设置属性MenuBar为True