memo是否可以放上圖? |
答題得分者是:william
|
superlevin
高階會員 發表:181 回覆:313 積分:180 註冊:2003-01-12 發送簡訊給我 |
|
william
版主 發表:66 回覆:2535 積分:3048 註冊:2002-07-11 發送簡訊給我 |
You can get the device context for the memo and draw on it using api during the WM_PAINT message handler for the memo, e.g.
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TMyMemo = class(TMemo) private procedure Paint(var Message: TWMPaint); message WM_PAINT; end; TForm1 = class(TForm) procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); private { Private declarations } Memo: TMyMemo; public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); begin Memo := TMyMemo.Create(self); Memo.Parent := self; Memo.Align := alClient; end; procedure TForm1.FormDestroy(Sender: TObject); begin Memo.Free; end; procedure TMyMemo.Paint(var Message: TWMPaint); var Wnd: HWND; DC: HDC; begin inherited; Wnd := Handle; DC := GetDeviceContext(Wnd); try Arc(DC,0,0,100,100,0,0,100,100); finally ReleaseDC(Wnd,DC); end; end; end. |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |