📄 video.pas.~4~
字号:
unit Video;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,Bass,BassVideo,ComVariable;
type
TfrmVideo = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormDblClick(Sender: TObject);
private
{ Private declarations }
public
procedure WndProc(var Msg : TMessage); override;
//procedure ActiveSomeStuff;
procedure WhenFormResize;
end;
var
frmVideo: TfrmVideo;
isFullScreen : Boolean;
OldRect : TRect;
OldStyle : Longint;
implementation
{$R *.dfm}
procedure TfrmVideo.WndProc(var Msg: TMessage);
var dc : HDC;
ps : TPaintStruct;
begin
if chan <> 0 then
case Msg.Msg of
WM_MOVE : begin
// apply for Windowed Renderer
BassVideo_WindowMove(chan, Msg.Msg, Msg.WParam, Msg.LParam, 0);
end;
WM_SIZE : begin
WhenFormResize;
end;
WM_PAINT : begin
// this apply for application that use VMR9-Windowless
dc := BeginPaint(Handle, ps);
BASSVideo_Repaint(chan, Handle, DC, 0);
EndPaint(Handle, ps);
end;
end;
inherited;
end;
procedure TfrmVideo.WhenFormResize;
var R : TRect;
begin
R := frmVideo.ClientRect;
R.Left := 0; R.Top := 0;
R.Bottom := R.Bottom;
BassVideo_WindowResize(chan, R, 0);
end;
procedure TfrmVideo.FormCreate(Sender: TObject);
var
R:TRect;
begin
R:=frmVideo.ClientRect;
BassVideo_SetVideoWindow(0, frmVideo.Handle, R, 0);
end;
procedure TfrmVideo.FormDblClick(Sender: TObject);
begin
isFullScreen := not isFullScreen;
if isFullScreen then
begin
OldRect.Left := Left;
OldRect.Top := Top;
OldRect.Right := Width;
OldRect.Bottom := Height;
OldStyle := GetWindowLong(Handle, GWL_STYLE);
SetWindowLong(Handle, GWL_STYLE, integer(WS_POPUPWINDOW or WS_VISIBLE));
Left := 0;
Top := 0;
Height := Screen.Height;
Width := Screen.Width;
end
else
begin
SetWindowLong(Handle, GWL_STYLE, OldStyle);
SetWindowPos(Handle, 0, OldRect.Left , OldRect.Top, OldRect.Right, OldRect.Bottom , 0);
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -