如何將座標~show在image圖上 |
|
rabbit78585
一般會員 發表:11 回覆:22 積分:6 註冊:2006-08-22 發送簡訊給我 |
|
RaynorPao
版主 發表:139 回覆:3622 積分:7025 註冊:2002-08-12 發送簡訊給我 |
請參考以下的程式碼自行修改!
__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { DoubleBuffered=true; // 若 Image1 放在 Form1 上面,請加入這一行 // Panel1->DoubleBuffered=true; // 若 Image1 放在 Panel1 上面,請加入這一行 } void __fastcall TForm1::Button1Click(TObject *Sender) { int X=100, Y=100; Image1->Canvas->Brush->Color=clRed; Image1->Canvas->Brush->Style=bsSolid; Image1->Canvas->FillRect(Rect(X-1, Y-1, X 1, Y 1)); Image1->Canvas->Brush->Style=bsClear; Image1->Canvas->TextOut(X 2, Y-2, "(" IntToStr(X) "," IntToStr(Y) ")"); }
------
-- 若您已經得到滿意的答覆,請適時結案!! -- -- 欲知前世因,今生受者是;欲知來世果,今生做者是 -- -- 一切有為法,如夢幻泡影,如露亦如電,應作如是觀 -- |
rabbit78585
一般會員 發表:11 回覆:22 積分:6 註冊:2006-08-22 發送簡訊給我 |
謝謝
===================引 用 文 章=================== 請參考以下的程式碼自行修改! __fastcall TForm1::TForm1(TComponent* Owner) ?? : TForm(Owner) { ?? DoubleBuffered=true; // 若 Image1 放在 Form1 上面,請加入這一行 ?? // Panel1->DoubleBuffered=true; // 若 Image1 放在 Panel1 上面,請加入這一行 } void __fastcall TForm1::Button1Click(TObject *Sender) { ?? int X=100, Y=100; ?? Image1->Canvas->Brush->Color=clRed; ?? Image1->Canvas->Brush->Style=bsSolid; ?? Image1->Canvas->FillRect(Rect(X-1, Y-1, X 1, Y 1)); ?? Image1->Canvas->Brush->Style=bsClear; ?? Image1->Canvas->TextOut(X 2, Y-2, "(" IntToStr(X) "," IntToStr(Y) ")"); } |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |