如何使用兩張panel,同時顯示同一個webcam?? |
答題得分者是:taishyang
|
Redstone
一般會員 發表:9 回覆:4 積分:2 註冊:2003-10-13 發送簡訊給我 |
我已經找過相關文章了,其中這篇也有提到相同問題,但似乎無解
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=34539
不知道有沒有大大能解決這個問題?能不能說一下如何解決,謝謝..^^
|
taishyang
站務副站長 發表:377 回覆:5490 積分:4563 註冊:2002-10-08 發送簡訊給我 |
Redstone您好:
試試下面的code
.h class TForm1 : public TForm { __published: // IDE-managed Components TPanel *Panel1; TPanel *Panel2; TTimer *Timer1; void __fastcall FormCreate(TObject *Sender); void __fastcall Timer1Timer(TObject *Sender); private: // User declarations public: // User declarations __fastcall TForm1(TComponent* Owner); }; class TPanelCanvas : public TPanel { public: __property Canvas; }; .cpp TForm1 *Form1; HWND hWndC; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { Timer1->Interval=100; } //--------------------------------------------------------------------------- void __fastcall TForm1::FormCreate(TObject *Sender) { hWndC=capCreateCaptureWindow("USB_CCD", WS_CHILD | WS_VISIBLE,0, 0, 160, 120, Panel1->Handle,1); capDriverConnect (hWndC, 1); //連結部分,視您的情況而定,不一定是1 capPreview(hWndC, true); capPreviewRate(hWndC, 33); capPreviewScale(hWndC,true); } //--------------------------------------------------------------------------- void __fastcall TForm1::Timer1Timer(TObject *Sender) { Panel2->Width=Panel1->Width; Panel2->Height=Panel1->Height; ((TPanelCanvas*)Panel2)->Canvas->CopyRect(Rect(0, 0, Panel2->Width, Panel2->Height), ((TPanelCanvas*)Panel1)->Canvas, Rect(0, 0, Panel1->Width, Panel1->Height)); } //---------------------------------------------------------------------------順心 <>~我也是在學習的階段,回答的不好請您多多見諒與指教~> 發表人 - |
Redstone
一般會員 發表:9 回覆:4 積分:2 註冊:2003-10-13 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |