做视频播放器时遇到的问题,大家帮忙解决一下吧~谢谢了
教材上说把以下代码插入到main.h中:
private:// User declarations
Graphics::TBitmap *bmpTitleAct;
Graphics::TBitmap *bmpTitleInact;
Graphics::TBitmap *bmpSysAct;
Graphics::TBitmap *bmpSysInact;
Graphics::TBitmap *bmpClose;
Graphics::TBitmap *bmpMinimize;
Graphics::TBitmap *bmpZoom;
Graphics::TBitmap *bmp_Inact; //标题栏
Graphics::TBitmap *bmpFormBK;
Graphics::TBitmap *bmpControlBarBK; //背景
Graphics::TBitmap *bmpControlPre;
Graphics::TBitmap *bmpControlPlay;
Graphics::TBitmap *bmpControlPause;
Graphics::TBitmap *bmpControlStop;
Graphics::TBitmap *bmpControlNext;
Graphics::TBitmap *bmpControlOpen; //控制按钮
Graphics::TBitmap *bmpTime0;
Graphics::TBitmap *bmpTime1;
Graphics::TBitmap *bmpTime2;
Graphics::TBitmap *bmpTime3;
Graphics::TBitmap *bmpTime4;
Graphics::TBitmap *bmpTime5;
Graphics::TBitmap *bmpTime6;
Graphics::TBitmap *bmpTime7;
Graphics::TBitmap *bmpTime8;
Graphics::TBitmap *bmpTime9;
Graphics::TBitmap *bmpTimeDot; //时间显示用到的数字图片
void __fastcall LoadBitmaps(); //从资源文件中读取图片
void __fastcall FreeBitmaps(); //程序结束时,释放资源
void __fastcall TFormMain::LoadBitmaps()
{
HBITMAP h;
// 窗体激活时的标题栏背景
bmpTitleAct = new Graphics::TBitmap();
h = LoadBitmap(HInstance,"TITLE_ACTIVE");
bmpTitleAct->Handle = h;
//窗体不处于激活状态时的标题栏背景
bmpTitleInact = new Graphics::TBitmap();
h = LoadBitmap(HInstance,"TITLE_INACTIVE");
bmpTitleInact->Handle = h;
// Active System Button
bmpSysAct = new Graphics::TBitmap();
h = LoadBitmap(HInstance,"SYSTEM_ACITVE");
bmpSysAct->Handle = h;
// Inactive System Button
bmpSysInact = new Graphics::TBitmap();
h = LoadBitmap(HInstance,"SYSTEM_INACTIVE");
bmpSysInact->Handle = h;
// 关闭按钮
bmpClose = new Graphics::TBitmap();
h = LoadBitmap(HInstance,"CLOSE_ACTIVE");
bmpClose->Handle = h;
// 最小化按钮
bmpMinimize = new Graphics::TBitmap();
h = LoadBitmap(HInstance,"MINIMIZE_ACTIVE");
bmpMinimize->Handle = h;
// 卷起按钮
bmpZoom = new Graphics::TBitmap();
h = LoadBitmap(HInstance,"ZOOM_ACTIVE");
bmpZoom->Handle = h;
// Inactive Button
bmp_Inact = new Graphics::TBitmap();
h = LoadBitmap(HInstance,"_INACTIVE");
bmp_Inact->Handle = h;
// 窗体背景
bmpFormBK = new Graphics::TBitmap();
h = LoadBitmap(HInstance,"FORM_BACKGROUND");
bmpFormBK->Handle = h;
// 控制栏背景
bmpControlBarBK = new Graphics::TBitmap();
h = LoadBitmap(HInstance,"CONTROLBAR_BACKGROUND");
bmpControlBarBK->Handle = h;
//绘制控制栏按钮 Btn Pre
bmpControlPre = new Graphics::TBitmap();
h = LoadBitmap(HInstance,"CONTROLBAR_PRE");
bmpControlPre->Handle = h;
//Button Play
bmpControlPlay = new Graphics::TBitmap();
h = LoadBitmap(HInstance,"CONTROLBAR_PLAY");
bmpControlPlay->Handle = h;
//Button Pause
bmpControlPause = new Graphics::TBitmap();
h = LoadBitmap(HInstance,"CONTROLBAR_PAUSE");
bmpControlPause->Handle = h;
//Button Stop
bmpControlStop = new Graphics::TBitmap();
h = LoadBitmap(HInstance,"CONTROLBAR_STOP");
bmpControlStop->Handle = h;
//Button Next
bmpControlNext = new Graphics::TBitmap();
h = LoadBitmap(HInstance,"CONTROLBAR_NEXT");
bmpControlNext->Handle = h;
//Button Open
bmpControlOpen = new Graphics::TBitmap();
h = LoadBitmap(HInstance,"CONTROLBAR_OPEN");
bmpControlOpen->Handle = h;
//LED数字位图 num 0
bmpTime0 = new Graphics::TBitmap();
h = LoadBitmap(HInstance,"TIME_0");
bmpTime0->Handle = h;
// num 1
bmpTime1 = new Graphics::TBitmap();
h = LoadBitmap(HInstance,"TIME_1");
bmpTime1->Handle = h;
// num 2
bmpTime2 = new Graphics::TBitmap();
h = LoadBitmap(HInstance,"TIME_2");
bmpTime2->Handle = h;
// num 1
bmpTime3 = new Graphics::TBitmap();
h = LoadBitmap(HInstance,"TIME_3");
bmpTime3->Handle = h;
// num 4
bmpTime4 = new Graphics::TBitmap();
h = LoadBitmap(HInstance,"TIME_4");
bmpTime4->Handle = h;
// num 5
bmpTime5 = new Graphics::TBitmap();
h = LoadBitmap(HInstance,"TIME_5");
bmpTime5->Handle = h;
// num 6
bmpTime6 = new Graphics::TBitmap();
h = LoadBitmap(HInstance,"TIME_6");
bmpTime6->Handle = h;
// num 7
bmpTime7 = new Graphics::TBitmap();
h = LoadBitmap(HInstance,"TIME_7");
bmpTime7->Handle = h;
// num 8
bmpTime8 = new Graphics::TBitmap();
h = LoadBitmap(HInstance,"TIME_8");
bmpTime8->Handle = h;
// num 9
bmpTime9 = new Graphics::TBitmap();
h = LoadBitmap(HInstance,"TIME_9");
bmpTime9->Handle = h;
// Dot
bmpTimeDot = new Graphics::TBitmap();
h = LoadBitmap(HInstance,"TIME_DOT");
bmpTimeDot->Handle = h;
}
void __fastcall TFormMain::FreeBitmaps()
{
delete bmpTitleAct;
delete bmpTitleInact;
delete bmpSysAct;
delete bmpSysInact;
delete bmpClose;
delete bmpMinimize;
delete bmpZoom;
delete bmp_Inact;
delete bmpFormBK;
delete bmpControlBarBK;
delete bmpControlPre;
delete bmpControlPlay;
delete bmpControlPause;
delete bmpControlStop;
delete bmpControlNext;
delete bmpControlOpen;
delete bmpTime0;
delete bmpTime1;
delete bmpTime2;
delete bmpTime3;
delete bmpTime4;
delete bmpTime5;
delete bmpTime6;
delete bmpTime7;
delete bmpTime8;
delete bmpTime9;
delete bmpTimeDot;
}
// ----------------------------
资源的释放放在窗体关闭时,所以窗体销毁事件的响应代码如下:
//---------------------------------------
void __fastcall TFormMain::FormDestroy(TObject *Sender)
{
FreeBitmaps();
}
结果出现图片上的错误!
头文件原内容如下:
//---------------------------------------
#ifndef FormMainH
#define FormMainH
//---------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include <Dialogs.hpp>
#include <MPlayer.hpp>
//---------------------------------------
class TForm1 : public TForm
{
__published:// IDE-managed Components
TShape *ShapeClient;
TImage *ImageTitle;
TImage *ImageSystem;
TImage *ImageMinimize;
TImage *ImageZoom;
TImage *ImageClose;
TImage *ImageTime1;
TImage *ImageTime2;
TImage *ImageTime3;
TImage *ImageTime4;
TImage *ImageTime5;
TImage *ImageTrack;
TImage *ImageControlBar;
TImage *ImagePre;
TImage *ImagePlay;
TImage *ImagePause;
TImage *ImageStop;
TImage *ImageNext;
TImage *ImageOpen;
TLabel *LabelTitle;
TLabel *LabelFileName;
TMediaPlayer *MediaPlayer1;
TTimer *Timer1;
TOpenDialog *OpenDialog1;
//---------------------------------------
public:// User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------
#endif
大家帮帮看看怎么解决?解决了另加高分!
[解决办法]
不知道楼主想问的是什么问题
------解决方案--------------------
图片看不到