MFC资源文件(.rc文件)的管理

resource.h就是.rc文件的头文件
.rc文件里的常量全在resource.h定义

.rc文件包含了整个工程的所有资源信息,包括对话框、位图、菜单、图标、工具栏以及字符串等资源;他们

的大小,风格,字体等属性信息,都包含在其中;
一般情况下不用你去写和修改
vc会帮你写和改
但是如果你想用以前的.rc中的资源比如你以前做的对话框
你只需复制粘贴就行了
就象下面这段

IDD_JK_DIALOG DIALOGEX 0, 0, 320, 200
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "jk"
FONT 9, "宋体"
BEGIN
<wbr><wbr><wbr>PUSHBUTTON <wbr><wbr><wbr><wbr><wbr>"学号",IDC_BUTTON1,25,75,62,22<br><wbr><wbr><wbr>PUSHBUTTON <wbr><wbr><wbr><wbr><wbr>"姓名",IDC_BUTTON2,179,75,64,24<br><wbr><wbr><wbr>EDITTEXT <wbr><wbr><wbr><wbr><wbr><wbr><wbr>IDC_EDIT1,105,75,57,24,ES_AUTOHSCROLL<br><wbr><wbr><wbr>EDITTEXT <wbr><wbr><wbr><wbr><wbr><wbr><wbr>IDC_EDIT2,261,75,46,24,ES_AUTOHSCROLL<br> END<br> 你可以复制到你新的工程里去。<br> 方法是用记事本打开.rc文件然后粘贴进去<br> 但是vc可能会提示IDD_JK_DIALOG IDC_BUTTON1,IDC_BUTTON2,IDC_EDIT1,IDC_EDIT2没有定义<br> 这时你只需要用记事本打开resource.h<br> 在里面加<br> #define IDD_JK_DIALOG <wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>102<br> #define IDC_BUTTON1 <wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>1000<br> #define IDC_BUTTON2 <wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>1001<br> #define IDC_EDIT1 <wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>1002<br> #define IDC_EDIT2 <wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>1003<br> 如果你需要做一个有很多控件的对话框<br> 但是以前做过一个一样的对话框<br> 这时你就可以使用这种方法</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>

你可能感兴趣的:(mfc)