下面是如何最大化console和改变其显示的字体颜色的代码,顺便包含了计时代码(帮助做性能分析):

    class Program
{
[DllImport("kernel32.dll", ExactSpelling = true)]
private static extern IntPtr GetConsoleWindow();
private static IntPtr ThisConsole = GetConsoleWindow(); [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); private const int HIDE = ;
private const int MAXIMIZE = ;
private const int MINIMIZE = ;
private const int RESTORE = ; private const int OldestPhaseNo = ; static void Main(string[] args)
{
// Set maximum console windows size
Console.SetWindowSize(Console.LargestWindowWidth, Console.LargestWindowHeight);
ShowWindow(ThisConsole, MAXIMIZE); // Start the time watch
Stopwatch watch = new Stopwatch();
watch.Start(); // Stop the time wattch
Dictionary<string, string> ssqRecords = GetSsQiuRecords().Result;
watch.Stop(); // Change/Set the console's foregound clodr as green
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(watch.Elapsed.TotalSeconds); // Restart the time calculation to 0
watch.Restart();
SaveLotteryDataToLocalConfig(ssqRecords);
watch.Stop(); Console.WriteLine(watch.Elapsed.TotalSeconds);
// Revert back to the default color
Console.ForegroundColor = ConsoleColor.Gray; // Set the display buffer for console window
Console.SetBufferSize(, );
}
}

How to customize the console applicaton的更多相关文章

  1. Spring Boot ConfigurationProperties validate

    使用@Query可以在自定义的查询方法上使用@Query来指定该方法要执行的查询语句,比如:@Query("select o from UserModel o where o.uuid=?1 ...

  2. Spring Boot Reference Guide

    Spring Boot Reference Guide Authors Phillip Webb, Dave Syer, Josh Long, Stéphane Nicoll, Rob Winch,  ...

  3. bin&sbin 命令作用

    最近需要了解sbin与bin的功能,需要整理一下.一下全部为Ubuntu14里面默认安装的.在这里收集一下,转载请注明出处! bin bash shell bunzip2 .bz2文件的解压缩程序. ...

  4. groovyConsole — the Groovy Swing console

    1. Groovy : Groovy Console The Groovy Swing Console allows a user to enter and run Groovy scripts. T ...

  5. JBPM WEB CONSOLE安装实录

    http://www.blogjava.net/paulwong/archive/2009/03/13/259551.html JBPM WEB CONSOLE是一个B/S端的,能管理JBPM的流程和 ...

  6. C# 控制台程序(Console Application )启动后隐藏

    背景 前段时间给项目编写了数据适配器,读取其他系统的数据后推送到MQ上,我们的系统通过订阅MQ的方式来获取.由于其他系统支持C#编程,且为了一时方便,选择了C#的控制台程序. 最近用户在使用中,总是不 ...

  7. Configuring Your EMS Server or EMS Console Server on Windows/Linux

    EMS Configuration Files RAD Studio provides the scripts to render the web-browser console, the EMS s ...

  8. console.log & front-end jobs

    console.log & front-end jobs bind & function let log = console.log; let obj = {}; log(obj); ...

  9. console的高级使用

    1.console.table()用来表格化展示数据. var people = { zqz: { name: 'zhaoqize', age: 'guess?' }, wdx: { name: 'w ...

随机推荐

  1. POJ 3207 Ikki's Story IV - Panda's Trick(2-sat问题)

    POJ 3207 Ikki's Story IV - Panda's Trick(2-sat问题) Description liympanda, one of Ikki's friend, likes ...

  2. java 关键字final

    一.最终的意思,可以修饰类,方法,变量.特点: A:它修饰的类,不能被继承. B:它修饰的方法,不能被重写. C:它修饰的变量,是一个常量.二.面试相关: 1.局部变量基本类型 值不能发生改变 例如: ...

  3. 计算总和及平均值u

    代码如下: package ClassDemo; import java.util.Scanner; public class ScannerTest { public static void mai ...

  4. 【转载】 ISO14229系列之一:简介

    转载链接:http://www.cnblogs.com/autogeek/p/4458591.html 前言 由于工作中经常用到ISO-14229,因此决定对该协议做个总体介绍和总结,既是对自己学习的 ...

  5. Codeforces_776B: Sherlock and his girlfriend(素数筛)

    题目链接 题意:对2~n+1染色,一个数不能与其素因子同色. 故而只需两种颜色即可,素数染1,合数染2便可满足条件 #include<bits/stdc++.h> using namesp ...

  6. Linux基础(三)

    一.正文处理命令及tar命令 1.文件合并 cat a.txt b.txt > c.txt 2.打包 归档命令tar可以把多个文件打包成一个文件 如tar cvf test.tar a.txt ...

  7. Work 1(导游类)(2017.06.27)

  8. 前端性能优化--图片懒加载(lazyload image)

    话说前头: 上次写了一篇webpack的学习心得,webpack能做到提升前端的性能,其模块打包最终生成一个或少量的文件能够减少对服务端的请求.除此之外,本次的图片懒加载(当然不仅限于图片,还可以有视 ...

  9. mysql内部级联删除

    1,创建user表 属性:id,name 2,创建userInfo表 属性:id,age 在userInfo表中创建外键id,如下图: 在user表中插入两个用户信息 (1,'1'),(2,'2') ...

  10. 回味Python2.7——笔记1

    一.基本知识 1.一个值可以同时赋给几个变量: >>> x = y = z = 0 # Zero x, y and z >>> x 0 >>> y ...