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
  • 相关阅读:
    Mandala Coloring Book Game ver 1.2
    Racing Game Starter Kit 1.1.0a
    Unity3D射击项目源码
    U3D第一人称解谜游戏完整项目工程源码
    uMMORPG Remastered v2.25
    U3D网球完整项目源码 v1.1
    Unity3D果汁店模拟经营完整项目工程源码
    3D坦克大战游戏项目源码
    周民强实变函数论第3版勘误14个
    竞赛2021年浙江省高等数学(微积分)竞赛数学类与工科类试题2页pdf
  • 原文地址:https://www.cnblogs.com/zhaobijin/p/5807801.html
Copyright © 2011-2022 走看看