用videocap控件作照片采集,想在视频窗口出现一矩形截图框,可拖动,截取框内的图像,怎么实现?
解决方案 »
- 关于自定义控件添加TBitmap变量的问题
- 一程序调用多窗口的问题
- 请问如何将我编的软件菜单加入到word中,同时用servers控件对word文档进行编辑。
- 怎么D7的 quickrep 没有那个QRchart了?我记得D6里的有啊?怎么搞的,倒退啊?
- 无聊,散分
- ★★TSQLConnection如何用代码动态设置数据库密码?
- 大虾们,如果把线程的优先级提高为实时,是不是能独占CPU时间啊
- 如何去改变StringGrid中的某一个cell 的背景颜色,(28分)
- 哪里有MP3和RM播放的组件?(要可以编译进可执行文件脱离DELPHI运行的)
- Sql server中,判断一个字符在一个字符串的位置的函数是什么?
- DELPHI中引用计算列出错??
- 一个主程序调用外部的一个程序,外部程序的窗口需要像MDI的子窗体一样显示在主窗体上,这个应该怎么实现?
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls,ShellAPI, AppEvnts;
const LWidth = 4;
TrayIconID = 335;
type
TfmSimple = class(TForm)
ApplicationEvents1: TApplicationEvents;
procedure FormResize(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure ApplicationEvents1Deactivate(Sender: TObject);
private
procedure WmNCHitTest(var Msg : TWMNCHitTest); message WM_NCHITTEST;
procedure WindowMove(var Msg: TMsg);message WM_MOVE;
end;var
fmSimple: TfmSimple;
bTemp: Boolean = False;
Nid: TNotifyIconData;
implementationuses MainF;{$R *.DFM}procedure TfmSimple.WmNCHitTest(var Msg: TWMNCHitTest);
const v=4; //border width
var
p:TPoint;
begin
Inherited;
if NOT fmMain.panOperation.Enabled then Exit; p:=Point(Msg.XPos,Msg.YPos);
p:=ScreenToClient(p); if PtInRect(Rect(0,0,v,v),p) then
Msg.Result:=HTTOPLEFT else if PtInRect(Rect(Width-v,Height-v,Width,Height),p) then
Msg.Result:=HTBOTTOMRIGHT else if PtInRect(Rect(Width-v,0,Width,v),p) then
Msg.Result:=HTTOPRIGHT else if PtInRect(Rect(0,Height-v,v,Height),p) then
Msg.Result:=HTBOTTOMLEFT else if PtInRect(Rect(v,0,Width-v,v),p) then
Msg.Result:=HTTOP else if PtInRect(Rect(0,v,v,Height-v),p) then
Msg.Result:=HTLEFT else if PtInRect(Rect(Width-v,v,Width,Height-v),p) then
Msg.Result:=HTRIGHT else if PtInRect(Rect(v,Height-v,Width-v,Height),p) then
Msg.Result:=HTBOTTOM; if PtInRect(Rect(LWidth,0,Width - LWidth,LWidth),p) then
Msg.Result := HTCAPTION;end;procedure TfmSimple.FormResize(Sender: TObject);
begin
BeginPath(Canvas.handle);
SetBkMode(Canvas.Handle,TRANSPARENT );
canvas.Polygon([Point(0,0),Point(Width,0),
Point(Width,Height),Point(0,Height),
Point(0,0)]);
Canvas.MoveTo(LWidth,LWidth);
Canvas.LineTo(Width - LWidth,LWidth);
Canvas.LineTo(Width -LWidth,Height -LWidth);
Canvas.LineTo(LWidth,Height -LWidth);
Canvas.LineTo(LWidth,LWidth); EndPath(canvas.handle); SetWindowRgn(Handle,PathToRegion(canvas.Handle), true );
end;procedure TfmSimple.FormCreate(Sender: TObject);
begin
//限定窗口形关为一方框
Canvas.Pen.Width := 1;
BeginPath(canvas.handle);
SetBkMode(Canvas.Handle,TRANSPARENT );
canvas.Polygon([Point(0,0),Point(Width,0),
Point(Width,Height),Point(0,Height),
Point(0,0)]);
Canvas.MoveTo(LWidth,LWidth);
Canvas.LineTo(Width - LWidth,LWidth);
Canvas.LineTo(Width -LWidth,Height -LWidth);
Canvas.LineTo(LWidth,Height -LWidth);
Canvas.LineTo(LWidth,LWidth);
EndPath(canvas.handle); SetWindowRgn(Handle,PathToRegion(canvas.Handle), true );
end;procedure TfmSimple.WindowMove(var Msg: TMsg);
begin
inherited;
BeginPath(Canvas.handle);
SetBkMode(Canvas.Handle,TRANSPARENT );
canvas.Polygon([Point(0,0),Point(Width,0),
Point(Width,Height),Point(0,Height),
Point(0,0)]);
Canvas.MoveTo(LWidth,LWidth);
Canvas.LineTo(Width - LWidth,LWidth);
Canvas.LineTo(Width -LWidth,Height -LWidth);
Canvas.LineTo(LWidth,Height -LWidth);
Canvas.LineTo(LWidth,LWidth);
EndPath(canvas.handle);
SetWindowRgn(Handle,PathToRegion(canvas.Handle), true );
end;
end.