📄 abnormalwin.~cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "AbnormalWin.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TAbnormalWindow *AbnormalWindow;
//---------------------------------------------------------------------------
__fastcall TAbnormalWindow::TAbnormalWindow(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void TAbnormalWindow::SetAbnormalWin(HWND Window)
{
TPoint *Side;
HRGN WinRect;
int x,y,leftscan,rightscan;
Image1->Picture->LoadFromFile(".\\abnormal.bmp");
Width=Image1->Width;
Height=Image1->Height;
Invalidate();
leftscan=0;
if((Side=(TPoint *)malloc(800*4*(sizeof(POINT))))==NULL)
{
ShowMessage("未获得有效空间!");
exit(0);
}
for(y=0;y<Image1->Height;y++)
{
for(x=0;x<Image1->Width;x++)
if(Image1->Canvas->Pixels[x][y]!=clWhite)
{
Side[leftscan].x=x;
Side[leftscan].y=y;
leftscan++;
break;
}
}
rightscan=leftscan;
for(y=Image1->Height-2;y>0;y--)
{
for(x=Image1->Width-2;x>0;x--)
if(Image1->Canvas->Pixels[x][y]!=clWhite)
{
Side[rightscan].x=x;
Side[rightscan].y=y;
rightscan++;
break;
}
}
WinRect=CreatePolygonRgn(Side,rightscan,ALTERNATE);
if(WinRect==0)
ShowMessage("创建窗体过程失败");
else
if(!SetWindowRgn(Window,WinRect,true))
ShowMessage("设置窗口失败!");
}
void __fastcall TAbnormalWindow::FormShow(TObject *Sender)
{
SetAbnormalWin(Handle);
}
//---------------------------------------------------------------------------
void __fastcall TAbnormalWindow::Image1Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -