#include<bits/stdc++.h>//devc++专用(VC请删除此语句)
#include <windows.h>
#include <iostream>
#include <stdio.h>
#include <Windows.h>
#include <conio.h>
#include <string.h>
#include <ctime>
#include <stdlib.h>
#include <vector>
#include <unistd.h>
#include <tchar.h>
#include <fstream>
#include <sys/time.h>
using namespace std;
#define wcscpy_s wcscpy//为Devc++找想
void _SetFont(int size,int font=2,int thickness=FW_NORMAL) {//设置字体
CONSOLE_FONT_INFOEX cfi;
cfi.cbSize = sizeof cfi;
cfi.nFont = 0;
cfi.dwFontSize.X = 0;
cfi.dwFontSize.Y = size;
cfi.FontFamily = FF_DONTCARE;
cfi.FontWeight = thickness;
if(font==2)wcscpy_s(cfi.FaceName, L"Raster");
if(font==1)wcscpy_s(cfi.FaceName, L"Lucida Console");
if(font==0)wcscpy_s(cfi.FaceName, L"Consolas");
SetCurrentConsoleFontEx(GetStdHandle(STD_OUTPUT_HANDLE), FALSE, &cfi);
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_FONT_INFO consoleCurrentFont;
GetCurrentConsoleFont(handle, FALSE, &consoleCurrentFont);
}
C++控制台:一个改变字体的小函数
于 2022-09-16 19:28:45 首次发布