📄 142.txt
字号:
资源档(.RES)的应用
资源档有什麽用处呢?最重要的有两个地方
1.国际发行:我们将Application中所有的文字从Resource用读取,那麽,只要更动
Resource档的内容,就可以用不同语言的方式来显示。
2.管理资源:例如说,我们的AP中用了数百张的图片或声音,不用Resource档的话,
在发行出去的AP中,就必需有数百个图形、声音档,那似乎不太好,使
用Resource档,便可以将这些图形、声音放进一个.Res档。
使用RC.exe来Compiler我们所定义的Resource档, RC.EXE在vb5.0光碟中的\TOOLS\RESOURCE
Resources 可分成两大部份:
- String resources (text strings such as "Hello World").
- Binary resources (icons, bitmaps, cursors, sounds, video等)
String Resources
语法:
STRINGTABLE [load-option] [mem-option]
BEGIN
stringID string
.
.
.
END
叁数说明 :
- load-option 可以是以下两种 Option Description
------ -----------
PRELOAD Resource is loaded immediately.
LOADONCALL (Default) Resource is loaded when called.
- mem-option 可以是以下三种
Option Description
------ -----------
FIXED Resource remains at a fixed memory location.
MOVEABLE Resource can be moved if necessary in order to compact memory.
DISCARDABLE Resource can be discarded if no longer needed.
- stringID 自行定义的integer,用来定义字串 resource.
- string 我们定义的字串,字串前後要用双引号(")将之包围起来,字串长度不可
超过255 bytes,而且字串要在同一行
BINARY RESOURCES
语法:
nameID keyword [load-option] [mem-option] filename
叁数:
- nameID 定义一个於以下keyword类别中,一个唯一的名称或数字,即,有三个BITMAP
类别的Resource,其nameID可以分别为1,2,3不重覆,而另有三个ICON的资源
,其nameID亦可分别为1,2,3,不会和BITMAP的1,2,3相冲突。注:ICON类别
的nameID不可以为0,0保留给 Visual Basic icon。nameID亦可以为字串
- keyword 定义资源类别 Option Description
------ -----------
BITMAP Defines a bitmap (.BMP)
CURSOR Defines a cursor (.CUR)
ICON Defines an icon (.ICO)
SOUND Defines a wave file (.WAV)
VIDEO Defines a video file (.AVI)
- load-option
Option Description
------ -----------
PRELOAD Resource is loaded immediately.
LOADONCALL (Default) Resource is loaded when called.
- mem-option
Opt
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -