📄 ellipsewin.~cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "EllipseWin.h"
#include "MainWin.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
Tellipsewindow *ellipsewindow;
//---------------------------------------------------------------------------
__fastcall Tellipsewindow::Tellipsewindow(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void Tellipsewindow::SetEllipseWin(HWND Window)
{
HRGN EllipseWin;
if(!SetWindowRgn(Window,0,false))
ShowMessage("窗体初始化失败!");
EllipseWin=CreateEllipticRgn(0,0,Width,Height);
if(EllipseWin==0)
ShowMessage("创建椭圆窗口失败!");
else
if(!SetWindowRgn(Window,EllipseWin,true))
ShowMessage("设置窗体失败!");
}
void __fastcall Tellipsewindow::FormShow(TObject *Sender)
{
if(showflag)
SetCircleWin(Handle);
else
SetEllipseWin(Handle);
}
//---------------------------------------------------------------------------
void __fastcall Tellipsewindow::FormResize(TObject *Sender)
{
if(showflag)
SetCircleWin(Handle);
else
SetEllipseWin(Handle);
Invalidate();
}
//---------------------------------------------------------------------------
void __fastcall Tellipsewindow::FormClose(TObject *Sender,
TCloseAction &Action)
{
SetWindowRgn(Handle,0,false);
}
//---------------------------------------------------------------------------
void __fastcall Tellipsewindow::FormClick(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void Tellipsewindow::SetCircleWin(HWND Window)
{
HRGN EllipseWin;
if(!SetWindowRgn(Window,0,false))
ShowMessage("窗体初始化失败!");
EllipseWin=CreateEllipticRgn(0,0,Height,Height);
if(EllipseWin==0)
ShowMessage("创建圆形窗口失败!");
else
if(!SetWindowRgn(Window,EllipseWin,true))
ShowMessage("设置窗体失败!");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -