일반 폼에서 만들어본.. 화면.. 검정색 부분은 바탕화면임(즉 투명부분...)
영역 지정화면 테스트겸해서 만들어본것...
추후 알림 메시지 박스로 사용하면 될듯함...
---------------------------------------------------------------
#ifndef FormMainH
#define FormMainH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include <Buttons.hpp>
#include <ImgList.hpp>
#include "XiPanel.hpp"
#include "LMDPNGImage.hpp"
//---------------------------------------------------------------------------
class TfrmMain : public TForm
{
__published: // IDE-managed Components
TImageList *ImageListMain;
TShape *shpTitle;
TLabel *lblTitle;
TShape *shpBG;
TImage *imgExit;
TShape *Shape1;
TLabel *Label1;
void __fastcall shpTitleMouseMove(TObject *Sender, TShiftState Shift, int X,
int Y);
void __fastcall shpTitleMouseDown(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y);
void __fastcall shpTitleMouseUp(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y);
void __fastcall imgExitClick(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TfrmMain(TComponent* Owner);
BOOL bDragState;
int nMouseDownX, nMouseDownY;
};
#define TITLE_WIDTH 400
#define MAIN_WIDTH 640
#define TITLE_HEIGHT 20
#define MAIN_HEIGHT 440
#define SYSTEM_WIDTH 300
#define SYSTEM_HEIGHT 20
#define LEFT_MARGIN 5
//---------------------------------------------------------------------------
extern PACKAGE TfrmMain *frmMain;
//---------------------------------------------------------------------------
#endif
.cpp
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "FormMain.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "XiPanel"
#pragma link "LMDPNGImage"
#pragma resource "*.dfm"
TfrmMain *frmMain;
//---------------------------------------------------------------------------
__fastcall TfrmMain::TfrmMain(TComponent* Owner)
: TForm(Owner)
{
////////////////////////////////////////////////////////////////////////////
HWND hRegionMain, hRegionTitle, hRegionSystem ;
hRegionTitle = CreateRectRgn(0, 0, TITLE_WIDTH, TITLE_HEIGHT); // 영역 지정
hRegionMain = CreateRectRgn(0, TITLE_HEIGHT, MAIN_WIDTH, TITLE_HEIGHT + MAIN_HEIGHT);
hRegionSystem = CreateRectRgn(MAIN_WIDTH - SYSTEM_WIDTH,
TITLE_HEIGHT + MAIN_HEIGHT,
MAIN_WIDTH,
TITLE_HEIGHT + MAIN_HEIGHT + SYSTEM_HEIGHT);
CombineRgn(hRegionMain, hRegionTitle, hRegionMain, RGN_OR); // 영역병합
CombineRgn(hRegionSystem, hRegionMain, hRegionSystem, RGN_OR); // 영역병합
SetWindowRgn(Handle, hRegionSystem, True); // 영역 등록
Brush->Style = bsClear; // 브러쉬 스타일 정의..
//Pen->Style = psSolid;
////////////////////////////////////////////////////////////////////////////
//btnTitle->Glyph = ImageListMain->
// this->Color = clBlack;
// ImageListMain->GetBitmap(0, imgExit->Picture->Bitmap);
// imgExit->Picture->LoadFromFile(".\\Shutdown.png");
}
//---------------------------------------------------------------------------
void __fastcall TfrmMain::shpTitleMouseMove(TObject *Sender, TShiftState Shift,
int X, int Y)
{
if(bDragState)
{
this->Left = this->Left + X - nMouseDownX;
this->Top = this->Top + Y - nMouseDownY;
}
}
//---------------------------------------------------------------------------
void __fastcall TfrmMain::shpTitleMouseDown(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y)
{
nMouseDownX = X;
nMouseDownY = Y;
bDragState = true;
}
//---------------------------------------------------------------------------
void __fastcall TfrmMain::shpTitleMouseUp(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y)
{
bDragState = false;
}
//---------------------------------------------------------------------------
void __fastcall TfrmMain::imgExitClick(TObject *Sender)
{
PostQuitMessage(-1);
}
//---------------------------------------------------------------------------