RedSnow
版主
發表:79 回覆:1322 積分:845 註冊:2003-12-15
發送簡訊給我
|
jim1247 您好: 以下是 BCB6 Help 中對建立元件圖示的步驟與說明,參考一下吧:
Creating a bitmap for a component When you create a new component, you can define your own bitmaps for custom components.
- Choose Tools|Image Editor.
- In the Image Editor dialog box, choose File|New|Component Resource File (.dcr).
- In the untitled1.dcr dialog box, right-click Contents. Choose New|Bitmap.
- In the Bitmaps Properties dialog box, change both the Width and Height to 24 pixels. Make sure VGA (16 colors) is checked. Click OK.
- Bitmap and Bitmap1 appear below Contents. Select Bitmap1, right-click, and choose Rename. Give the bitmap the same name as the class name for your new component, including the T, using all uppercase letters. For example, if your new class name is going to be TMyNewButton, name the bitmap TMYNEWBUTTON. Note: You must name all uppercase letters, no matter how you spell the class name in the New Component dialog box.
- Double-click TMYNEWBUTTON to display a dialog box with an empty bitmap.
- Use the color palette at the bottom of the Image Editor to design your icon.
- Choose File|Save As and give the resource file (.dcr or .res) the same base name as the unit you want the component class declared in. For example, name the resource file MyNewButton.dcr.
- Choose Component|New Component. Follow the instructions for creating a new component using the Component wizard. Make sure that the component source, MyNewButton.cpp, is in the same directory as MyNewButton.dcr. The Component wizard, for a class named TMyNewButton, names the component source, or unit, MyNewButton.cpp with a default placement in the LIB directory. Click the Browse button to find the new location for the generated component unit. Note: If you are using a .res file for the bitmap rather than a .dcr file, then add a reference to the component source to bind the resource. For example, if your .res file is named MyNewButton.res, after ensuring that the .cpp and .res are in the same directory, add the following in MyNewButton.cpp: #pragma resource "*.res"
- Choose Component|Install Component to install your component into a new or existing package. Click OK.
Your new package is built and then installed. The bitmap representing your new component appears on the Component palette page you designated in the Component wizard. 7 天天敲鍵盤 v 時時按滑鼠 8
|