?? main.pas
字號:
Procedure TFrmCCTMain.TV_Fav2DblClick(Sender: TObject);
Var
S: String;
Begin
S := TV_Fav2.SelectedItem.PathName;
If DirectoryExists(S) Then Exit;
ShellExecute(Handle, 'open', PChar(S), Nil, Nil, SW_NORMAL);
End;
Procedure TFrmCCTMain.TimerTimer(Sender: TObject);
Const
FMoveLength = 50;
FGoLeft = True;
FGoTop = True;
fGoRight = True;
FGoBottom = True;
Type
TMoveActionEnum = (ToTop, ToLeft, ToBottom, ToRight);
Var
MoveAction: TMoveActionEnum;
Procedure UpForm;
Begin //移入后事件
Try
If (GetKeyState(VK_LBUTTON) And $8000) = 1 Then Exit; //鼠標(biāo)按下
If MoveAction = ToTop Then
Begin
If ((FrmCCTMain.Top) <= (FMoveLength + 1 - FrmCCTMain.Height)) Then
Begin
FrmCCTMain.Top := 3 - FrmCCTMain.Height;
Exit;
FrmCCTMain.Top := FrmCCTMain.Top - FMoveLength;
End;
If MoveAction = ToLeft Then
Begin
If ((FrmCCTMain.Left) <= (FMoveLength + 1 - FrmCCTMain.Width)) Then
Begin
FrmCCTMain.Left := 3 - FrmCCTMain.Width;
Exit;
End Else If ((FrmCCTMain.Left) < (1 - FrmCCTMain.Width)) Then Exit;
FrmCCTMain.Left := FrmCCTMain.Left - FMoveLength;
End;
If MoveAction = ToRight Then
Begin
If ((FrmCCTMain.Left) > (Screen.Width - FMoveLength)) Then
Begin
FrmCCTMain.Left := Screen.Width - 3;
Exit;
End;
FrmCCTMain.Left := FrmCCTMain.Left + FMoveLength;
End;
If MoveAction = ToBottom Then
Begin
If ((FrmCCTMain.Top) > (Screen.Height - FMoveLength)) Then
Begin
FrmCCTMain.Top := Screen.Height - 3;
Exit;
End;
FrmCCTMain.Top := FrmCCTMain.Top + FMoveLength;
End;
Except
End;
End;
Procedure DownForm;
Begin //移出后
Try
If (GetKeyState(VK_LBUTTON) And $8000) = 1 Then Exit; //鼠標(biāo)按下
If MoveAction = ToTop Then
Begin
If ((FrmCCTMain.Top) >= (-FMoveLength - 1)) Then
Begin
FrmCCTMain.Top := -1;
Exit;
End;
FrmCCTMain.Top := FrmCCTMain.Top + FMoveLength;
End;
If MoveAction = ToLeft Then
Begin
If ((FrmCCTMain.Left) >= (-FMoveLength - 1)) Then
Begin
FrmCCTMain.Left := -1;
Exit;
End;
FrmCCTMain.Left := FrmCCTMain.Left + FMoveLength;
End;
If MoveAction = ToRight Then
Begin
If ((FrmCCTMain.Left) <= (Screen.Width - FrmCCTMain.Width + FMoveLength + 1)) Then
Begin
FrmCCTMain.Left := Screen.Width - FrmCCTMain.Width + 1;
Exit;
End;
FrmCCTMain.Left := FrmCCTMain.Left - FMoveLength;
End;
If MoveAction = ToBottom Then
Begin
If ((FrmCCTMain.Top) <= (Screen.Height - FrmCCTMain.Height + FMoveLength + 1)) Then
Begin
FrmCCTMain.Top := Screen.Height - FrmCCTMain.Height + 1;
Exit;
End;
FrmCCTMain.Top := FrmCCTMain.Top - FMoveLength;
End;
Except
End;
End;
Var
P: TPoint;
Begin
Timer.Enabled := False;
GetCursorPos(P); //獲取當(dāng)前鼠標(biāo)位置
If ((FrmCCTMain.Left) < (P.X)) And
((P.X) < (FrmCCTMain.Left + FrmCCTMain.Width)) And
((FrmCCTMain.Top - 1) < (P.Y)) And
((P.Y) < (FrmCCTMain.Top + FrmCCTMain.Height + 1)) Then //復(fù)雜的判斷過程,判斷鼠標(biāo)是否位于窗體區(qū)域內(nèi)
Begin
If FrmCCTMain.Left <= 0 Then
Begin
MoveAction := ToLeft;
If FGoLeft = True Then DownForm;
End;
If FrmCCTMain.Top <= 0 Then
Begin
MoveAction := ToTop;
If FGoTop = True Then DownForm;
End;
If ((FrmCCTMain.Left + FrmCCTMain.Width) > (Screen.Width + 1)) Then
Begin
MoveAction := ToRight;
If fGoRight = True Then DownForm;
End;
If ((FrmCCTMain.Top + FrmCCTMain.Height) > (Screen.Height + 1)) Then
Begin
MoveAction := ToBottom;
If FGoBottom = True Then DownForm;
End;
End Else
Begin
If FrmCCTMain.Left <= 1 Then
Begin
MoveAction := ToLeft;
If FGoLeft = True Then UpForm;
End;
If FrmCCTMain.Top <= 1 Then
Begin
MoveAction := ToTop;
If FGoTop = True Then UpForm;
End;
If ((FrmCCTMain.Left + FrmCCTMain.Width) >= (Screen.Width - 1)) Then
Begin
MoveAction := ToRight;
If fGoRight = True Then UpForm;
End;
If ((FrmCCTMain.Top + FrmCCTMain.Height) >= (Screen.Height - 1)) Then
Begin
MoveAction := ToBottom;
If FGoBottom = True Then UpForm;
End;
End;
Timer.Enabled := True;
End;
Procedure TFrmCCTMain.FormPaint(Sender: TObject);
Begin
Canvas.Brush.Style := bsClear;
//上部
Canvas.Draw(0, 0, Bmp[1]);
Canvas.CopyRect(Rect(14, 0, ClientWidth - 14, 24), Bmp[2].Canvas, Bmp[2].Canvas.ClipRect);
Canvas.Draw(ClientWidth - 14, 0, Bmp[3]);
//底部
Canvas.Draw(0, ClientHeight - 62, Bmp[4]);
Canvas.CopyRect(Rect(15, ClientHeight - 62, ClientWidth - 15, ClientHeight), Bmp[5].Canvas, Bmp[5].Canvas.ClipRect);
Canvas.Draw(ClientWidth - 15, ClientHeight - 62, Bmp[6]);
//中間
// Canvas.CopyRect(Rect(0, 24, 11, ClientHeight - 62), Bmp[7].Canvas, Bmp[7].Canvas.ClipRect);
// Canvas.CopyRect(Rect(11, 24, ClientWidth - 8, ClientHeight - 62), Bmp[8].Canvas, Bmp[8].Canvas.ClipRect);
// Canvas.CopyRect(Rect(ClientWidth - 8, 24, ClientWidth, ClientHeight - 62), Bmp[9].Canvas, Bmp[9].Canvas.ClipRect);
Canvas.CopyRect(Rect(0, 24, 11, ClientHeight - 30), Bmp[7].Canvas, Bmp[7].Canvas.ClipRect);
Canvas.CopyRect(Rect(11, 24, ClientWidth - 8, ClientHeight - 30), Bmp[8].Canvas, Bmp[8].Canvas.ClipRect);
Canvas.CopyRect(Rect(ClientWidth - 8, 24, ClientWidth, ClientHeight - 30), Bmp[9].Canvas, Bmp[9].Canvas.ClipRect);
DrawPanelBtn(FavPanel1, Bmp[13], Fav[0]);
DrawPanelBtn(FavPanel2, Bmp[13], Fav[1]);
End;
Procedure TFrmCCTMain.FormResize(Sender: TObject);
Begin
lpRect := ClientRect;
Refresh;
DrawRgn(self, ClientWidth + 1, ClientHeight + 1, 15);
Panel.Top := 25;
Panel.Width := ClientWidth - 5 - CmdTab1.Width;
//Panel.Height := ClientHeight - 86;//舊
Panel.Height := ClientHeight - 56;
Panel.Refresh;
//DrawRgn(FavPanel1, FavPanel1.Width + 1, FavPanel1.Height + 1, 5);
//DrawRgn(FavPanel2, FavPanel2.Width + 1, FavPanel2.Height + 1, 5);
//FormPaint(FrmCCTMain);
CmdClose.Top := 5;
CmdClose.Left := ClientWidth - CmdClose.Width - 5;
CmdMax.Top := 5;
CmdMax.Left := CmdClose.Left - CmdMax.Width - 1;
LbTitle.Left := 5;
LbTitle.Top := 2;
LbTitle.Width := ClientWidth - 2;
LbTitle.Height := 20;
LbTitle.Refresh;
End;
Procedure TFrmCCTMain.LbTitleMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
Begin
If Button <> mbLeft Then Exit;
ReleaseCapture;
SendMessage(self.Handle, $112, $F010 + 2, 0);
End;
Procedure TFrmCCTMain.CmdCloseClick(Sender: TObject);
Begin
Close;
End;
Procedure TFrmCCTMain.LeftTabClick(Sender: TObject);
Var
i: Integer;
Begin
For i := 0 To ControlCount - 1 Do
If Controls[i] Is TRzBmpButton Then TRzBmpButton(Controls[i]).Enabled := True;
With TRzBmpButton(Sender) Do
Begin
Enabled := False;
Note.PageIndex := Tag;
BringToFront;
End;
FormResize(FrmCCTMain);
End;
Procedure TFrmCCTMain.CmdMaxClick(Sender: TObject);
Var
P: TPoint;
Begin
GetCursorPos(P);
MainPopupMenu.Popup(P.X, P.Y);
End;
Procedure TFrmCCTMain.FavPanel1MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
Begin
DrawPanelBtn(FavPanel1, Bmp[14], Fav[0]);
End;
Procedure TFrmCCTMain.FavPanel1MouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
Begin
DrawPanelBtn(FavPanel1, Bmp[13], Fav[0]);
End;
Procedure TFrmCCTMain.FavPanel1MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
Begin
DrawPanelBtn(FavPanel1, Bmp[15], Fav[0]);
End;
Procedure TFrmCCTMain.FavPanel1MouseLeave(Sender: TObject);
Begin
DrawPanelBtn(FavPanel1, Bmp[13], Fav[0]);
End;
Procedure TFrmCCTMain.FavPanel2MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
Begin
DrawPanelBtn(FavPanel2, Bmp[15], Fav[1]);
End;
Procedure TFrmCCTMain.FavPanel2MouseLeave(Sender: TObject);
Begin
DrawPanelBtn(FavPanel2, Bmp[13], Fav[1]);
End;
Procedure TFrmCCTMain.FavPanel2MouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
Begin
DrawPanelBtn(FavPanel2, Bmp[13], Fav[1]);
End;
Procedure TFrmCCTMain.FavPanel2MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
Begin
DrawPanelBtn(FavPanel2, Bmp[14], Fav[1]);
End;
Procedure TFrmCCTMain.FavPanel1Click(Sender: TObject);
Begin
If TV_Fav1.Visible Then Exit;
TV_Fav2.Align := alNone;
TV_Fav2.Visible := False;
FavPanel2.Align := alBottom;
FavPanel2.Refresh;
TV_Fav1.Align := alClient;
TV_Fav1.Visible := True;
DrawPanelBtn(FavPanel2, Bmp[13], Fav[1]);
PlaySound('Folder', HInstance, SND_RESOURCE Or SND_ASYNC);
End;
Procedure TFrmCCTMain.FavPanel2Click(Sender: TObject);
Begin
If TV_Fav2.Visible Then Exit;
TV_Fav1.Align := alNone;
TV_Fav1.Visible := False;
FavPanel2.Align := alTop;
FavPanel2.Refresh;
TV_Fav2.Align := alClient;
TV_Fav2.Visible := True;
DrawPanelBtn(FavPanel2, Bmp[13], Fav[1]);
PlaySound('Folder', HInstance, SND_RESOURCE Or SND_ASYNC);
End;
Procedure TFrmCCTMain.FormShow(Sender: TObject);
Begin
FormResize(FrmCCTMain);
End;
End.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -