代码改变世界

画一个矩形的边界框

2012-04-03 15:32 by youxin, 524 阅读, 0 推荐, 收藏,
摘要:定义一个包含5个点(10个值)的数组,来画一个矩形的边界框,注意最后一个点与第一个点相同。现在,只需要使用MoveToEx移到第一个点,并对后面的点使用LineTo: int i; POINT apt[5] = {100, 100, 200, 100, 200, 200, 100, 200, 100, 100} ; MoveToEx(hDC,apt[0].x,apt[0].y,NULL); for(i=1;i<5;i++) { LineTo(hDC,apt[i].x,apt[i].y); }当您... 阅读全文

LineTo画网格

2012-04-03 14:55 by youxin, 473 阅读, 0 推荐, 收藏,
摘要:The following code draws a grid in the client area of a window, spacing the lines 50pixels apart starting from theupper left corner. The variable hwnd is assumed to be a handle to the window, hdc is a handle to the devicecontext, and x and y are integers:下面的程序代码从窗口的左上角开始,在显示区域中画一个网格,线与线之间相隔50个图素,其中h 阅读全文

'GetDc' : undeclared identifier

2012-04-02 01:47 by youxin, 374 阅读, 0 推荐, 收藏,
摘要:在下面一段取得系统字体的宽度和高度时错误了: case WM_CREATE: static int cxChar, cyChar; HDC hdc; hdc=GetDC(hwnd); TEXTMETRIC tm; GetTextMetrics(hdc,&tm); cxChar=tm.tmAveCharWidth; cyChar=tm.tmHeight+tm.tmExternalLeading; //tmExterna... 阅读全文

设置VS visual studio

2012-04-01 14:16 by youxin, 4653 阅读, 0 推荐, 收藏,
摘要:如果你不喜欢白底黑字的颜色配置,可以更改vs2010所有的颜色(不仅仅是文本编辑器的背景颜色)。 在VS2010的菜单中的:工具 》扩展管理器 》联机库,在其中找到 Visual studio coloer theme editor 然后安装该库,这款扩展提供对Visual Studio 2010整 阅读全文

C++抽象类的纯虚函数

2012-03-31 22:25 by youxin, 7463 阅读, 0 推荐, 收藏,
摘要:1,定义: 纯虚函数是在基类中声明的虚函数,它在基类中没有定义,但要求任何派生类都要定义自己的实现方法。在基类中实现纯虚函数的方法是在函数原型后加"=0" ,同 java中抽象方法类似virtualvoidfuntion1()=0二、引入原因:1、为了方便使用多态特性,我们常常需要在基类中定义虚拟函数。2、在很多情况下,基类本身生成对象是不合情理的。例如,动物作为一个基类可以派生出老虎、孔雀等子类,但动物本身生成对象明显不合常理。 为了解决上述问题,引入了纯虚函数的概念,将函数定义为纯虚函数(方法:virtualReturnTypeFunction()=0;),则编译器要求 阅读全文

fatal error C1083: Cannot open precompiled header file: 'Debug/2_1.pch': No such file or directory

2012-03-31 18:34 by youxin, 744 阅读, 0 推荐, 收藏,
摘要:fatal error C1083: Cannot open precompiled header file: 'Debug/2_1.pch': No such file or directory看下面的一段代码:#include<stdafx.h>#include<windows.h>#include<resource.h> int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine,... 阅读全文

fatal error C1083: Cannot open include file: 'resource.h': No such file or directory

2012-03-31 18:00 by youxin, 3745 阅读, 0 推荐, 收藏,
摘要:发生错误:fatal error C1083: Cannot open include file: 'resource.h': No such file or directoryvc6.0在创建window应用程序时,提供了三种选择,1,一个空工程 ---No files will be created or added to the project.2.一个简单的win32应用程序 --Pre Compiled Header: Stdafx.h and Stdafx.cpp.3,一个典型的win32应用程序 --Pre Compiled Heade... 阅读全文

转:c++ virtual function

2012-03-30 15:12 by youxin, 761 阅读, 0 推荐, 收藏,
摘要:C++ virtual function is a member function of a class, whose functionality can be over-ridden in its derived classes. The whole function body can be replaced with a new set of implementation in the derived class. The concept of c++ virtual functions is different fromC++ Function overloading.C++ Virt. 阅读全文

C++virtual 虚函数详解

2012-03-30 15:05 by youxin, 569 阅读, 0 推荐, 收藏,
摘要:首先看一下程序,猜猜运行结果是什么?#include<iostream>using namespace std;class Animal{public: Animal(int height,int weight) { cout<<"Animal construct"<<endl; } ~Animal() { cout<<"Animal destruct"<<endl; } void eat() { cout<<"Animal's eat"<<e 阅读全文

在线编译器介绍

2012-03-30 12:12 by youxin, 581 阅读, 0 推荐, 收藏,
摘要:最出名在线C/C++编译网站:http://www.dinkumware.com/exam/default.aspx支持多种语言的在线编辑器,个人觉得蛮好;http://codepad.org/网上有许多在线C++编译器。你可以利用它们对你的代码针对各种C++编译器进行兼容性测试,而不需要购买和安装这些编译器。在这里给大家推荐几款,可以根据需要自行选择使用:1.http://www.dinkumware.com/exam/default.aspx推荐星级:★★★★是否需注册:否优点:网页界面简洁,多种类库支持,对编译后信息统计准确,推荐使用。缺点:支持语言种类较少。2、http://codep 阅读全文
上一页 1 ··· 244 245 246 247 248 249 250 251 252 ··· 269 下一页