📄 neowin.cpp
字号:
void __fastcall TNeoForm::BottomLeftImageMouseMove(TObject *Sender,
TShiftState Shift, int X, int Y)
{
TPoint MousePos;
TRect WinRect;
if (!FSizeable) return;
if (WindowState == wsMaximized) return;
if (FBorderMouseDown)
{
GetCursorPos(&MousePos);
WinRect = this->BoundsRect;
WinRect.Left = MousePos.x - FBorderMouseX;
WinRect.Bottom = MousePos.y + (BottomLeftImage->Height - FBorderMouseY);
this->BoundsRect = WinRect;
}
}
//---------------------------------------------------------------------------
void __fastcall TNeoForm::BottomCenterImageMouseDown(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
FBorderMouseDown = true;
FBorderMouseX = X;
FBorderMouseY = Y;
}
//---------------------------------------------------------------------------
void __fastcall TNeoForm::BottomCenterImageMouseUp(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
FBorderMouseDown = false;
}
//---------------------------------------------------------------------------
void __fastcall TNeoForm::BottomCenterImageMouseMove(TObject *Sender,
TShiftState Shift, int X, int Y)
{
TPoint MousePos;
TRect WinRect;
if (!FSizeable) return;
if (WindowState == wsMaximized) return;
if (FBorderMouseDown)
{
GetCursorPos(&MousePos);
WinRect = this->BoundsRect;
WinRect.Bottom = MousePos.y + (BottomCenterImage->Height - FBorderMouseY);
this->BoundsRect = WinRect;
}
}
//---------------------------------------------------------------------------
void __fastcall TNeoForm::BottomRightImageMouseDown(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
FBorderMouseDown = true;
FBorderMouseX = X;
FBorderMouseY = Y;
}
//---------------------------------------------------------------------------
void __fastcall TNeoForm::BottomRightImageMouseUp(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
FBorderMouseDown = false;
}
//---------------------------------------------------------------------------
void __fastcall TNeoForm::BottomRightImageMouseMove(TObject *Sender,
TShiftState Shift, int X, int Y)
{
TPoint MousePos;
TRect WinRect;
if (!FSizeable) return;
if (WindowState == wsMaximized) return;
if (FBorderMouseDown)
{
GetCursorPos(&MousePos);
WinRect = this->BoundsRect;
WinRect.Right= MousePos.x + (BottomRightImage->Width - FBorderMouseX);
WinRect.Bottom = MousePos.y + (BottomRightImage->Height - FBorderMouseY);
this->BoundsRect = WinRect;
}
}
//---------------------------------------------------------------------------
void __fastcall TNeoForm::LeftImageMouseDown(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
FBorderMouseDown = true;
FBorderMouseX = X;
FBorderMouseY = Y;
}
//---------------------------------------------------------------------------
void __fastcall TNeoForm::LeftImageMouseUp(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
FBorderMouseDown = false;
}
//---------------------------------------------------------------------------
void __fastcall TNeoForm::LeftImageMouseMove(TObject *Sender,
TShiftState Shift, int X, int Y)
{
TPoint MousePos;
TRect WinRect;
if (!FSizeable) return;
if (WindowState == wsMaximized) return;
if (FBorderMouseDown)
{
GetCursorPos(&MousePos);
WinRect = this->BoundsRect;
WinRect.Left= MousePos.x - FBorderMouseX;
this->BoundsRect = WinRect;
}
}
//---------------------------------------------------------------------------
void __fastcall TNeoForm::TopImageMouseDown(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
FBorderMouseDown = true;
FBorderMouseX = X;
FBorderMouseY = Y;
}
//---------------------------------------------------------------------------
void __fastcall TNeoForm::TopImageMouseUp(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
FBorderMouseDown = false;
}
//---------------------------------------------------------------------------
void __fastcall TNeoForm::TopImageMouseMove(TObject *Sender,
TShiftState Shift, int X, int Y)
{
TPoint MousePos;
TRect WinRect;
if (!FSizeable) return;
if (WindowState == wsMaximized) return;
if (FBorderMouseDown)
{
GetCursorPos(&MousePos);
WinRect = this->BoundsRect;
WinRect.Top= MousePos.y - FBorderMouseY;
this->BoundsRect = WinRect;
}
}
//---------------------------------------------------------------------------
void __fastcall TNeoForm::CaptionLabelMouseDown(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
FCaptionMouseDown = true;
FCaptionMouseX = CaptionLabel->Left + X;
FCaptionMouseY = CaptionLabel->Top + Y;
}
//---------------------------------------------------------------------------
void __fastcall TNeoForm::CaptionLabelMouseUp(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
FCaptionMouseDown = false;
}
//---------------------------------------------------------------------------
void __fastcall TNeoForm::CaptionLabelMouseMove(TObject *Sender,
TShiftState Shift, int X, int Y)
{
TPoint MousePos;
TRect WinRect;
if (FCaptionMouseDown && WindowState != wsMaximized)
{
GetCursorPos(&MousePos);
Top = MousePos.y - FCaptionMouseY;
Left = MousePos.x - FCaptionMouseX;
}
}
//---------------------------------------------------------------------------
void __fastcall TNeoForm::MinImageClick(TObject *Sender)
{
if (Application->MainForm == this)
Application->Minimize();
else
WindowState = wsMinimized;
}
//---------------------------------------------------------------------------
void __fastcall TNeoForm::MaxImageClick(TObject *Sender)
{
WindowState = wsMaximized;
}
//---------------------------------------------------------------------------
void __fastcall TNeoForm::CloseImageClick(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TNeoForm::RestoreImageClick(TObject *Sender)
{
WindowState = wsNormal;
}
//---------------------------------------------------------------------------
void __fastcall TNeoForm::CaptionLabelDblClick(TObject *Sender)
{
if (BorderIcons.Contains(biMaximize))
WindowState = ((WindowState == wsMaximized)? wsNormal : wsMaximized);
}
//---------------------------------------------------------------------------
void __fastcall TNeoForm::MenuButtonClick(TObject *Sender)
{
TSpeedButton *sb;
TPopupMenu *pm;
TPoint Pos;
sb = (TSpeedButton*)Sender;
pm = FNeoMenu[sb->Tag];
if (FLastPopedMenuIndex == sb->Tag)
{
FLastPopedMenuIndex = -1;
sb->Down = false;
return;
}
FPopedMenuIndex = sb->Tag;
FLastPopedMenuIndex = sb->Tag;
Pos = sb->ClientToScreen(TPoint(0, 0));
Pos.y = Pos.y + sb->Height + 2;
MenuTimer->Enabled = true;
sb->Down = true;
pm->Popup(Pos.x, Pos.y);
FPopedMenuIndex = -1;
GetCursorPos(&Pos);
Pos = sb->ScreenToClient(Pos);
if (Pos.x >= 0 && Pos.y >=0 && Pos.x < sb->Width && Pos.y < sb->Height);
else
{
sb->Enabled = false;
sb->Enabled = true;
sb->Down = false;
sb->Refresh();
FLastPopedMenuIndex = -1;
}
}
//---------------------------------------------------------------------------
void __fastcall TNeoForm::MenuTimerTimer(TObject *Sender)
{
static int f = 1;
TSpeedButton *sb;
TPoint P, Pos;
int i;
GetCursorPos(&P);
for (i = 0; i < MaxNeoMenuButton - 1; i ++)
{
sb = GetNeoMenuButton(i);
if (sb->Visible == false) continue;
Pos = sb->ScreenToClient(P);
if (Pos.x >= 0 && Pos.y >=0 && Pos.x < sb->Width && Pos.y < sb->Height)
{
if (FPopedMenuIndex == i) continue;
if (f == 1)
{
if (FPopedMenuIndex == -1)
{
MenuTimer->Enabled = false;
return;
}
PostMessage(FNeoMenu[i]->WindowHandle, WM_KEYDOWN, VK_ESCAPE, 0);
PostMessage(FNeoMenu[i]->WindowHandle, WM_KEYDOWN, VK_ESCAPE, 0);
MenuTimer->Enabled = false;
MenuTimer->Enabled = true;
f = 2;
}
else if (f == 2)
{
f = 1;
sb->Click();
}
break;
}
}
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -