zoukankan      html  css  js  c++  java
  • Winform常用代码1

    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
  • 相关阅读:
    vs2019编译错误:Exception Processing Message 0xc0000005 Parameters...
    error LNK2001
    Debug Assertion Failed
    对路径“………………”的访问被拒绝
    c语言打开文件为什么总是以二进制方式打开
    关于typedef的用法总结
    xml学习第一天
    关于VS2017编译成功系统找不到指定文件.exe的问题
    引入的外部js文件在html文件在浏览器中乱码显示
    结对作业(四则运算)
  • 原文地址:https://www.cnblogs.com/zhaobijin/p/5807801.html
Copyright © 2011-2022 走看看