⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 program_10_5.cpp

📁 本程序为visual c++课件讲义
💻 CPP
字号:
// Display a bitmap image of the authors in the
// center of a window
#include <bitmap>
#include <cassert>
using namespace std;

SimpleWindow PhotoWindow("The Lecturer", 10., 12., Position(5., 3.));

// ApiMain(): display a bitmap photo
int ApiMain() {
	PhotoWindow.Open();
	assert(PhotoWindow.GetStatus() == WindowOpen);

	Position WindowCenter = PhotoWindow.GetCenter();

	// Create a bitmap
	BitMap Photo(PhotoWindow);

	// Load the image
	Photo.Load("me.bmp");
	assert(Photo.GetStatus() == BitMapOkay);

	//Compute photo position so it's center in the window
	// (photo's upper-left corner)
	Position PhotoPosition = WindowCenter + Position(-.5 * Photo.GetWidth(),
	                                  -.5 * Photo.GetHeight());
	Photo.SetPosition(PhotoPosition);
	Photo.Draw();

	return 0;
}

// ApiEnd(): shutdown the window
int ApiEnd() {
	PhotoWindow.Close();
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -