全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:892
推到 Plurk!
推到 Facebook!

請問如何顯示圖片的尺寸呢?

答題得分者是:supman
shning
一般會員


發表:7
回覆:0
積分:1
註冊:2004-04-06

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-07-10 00:57:20 IP:210.66.xxx.xxx 未訂閱
這是我參考書上還有版上一些文章所寫的 請問如何加入一個程式 將圖片的尺寸顯示呢???     //---------------------------------------------------------------------------    #include  #pragma hdrstop #include "jpeg.hpp" #include "Unit1.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "IdBaseComponent" #pragma link "IdComponent" #pragma link "IdTCPClient" #pragma link "IdTCPConnection" #pragma resource "*.dfm" TForm1 *Form1; Graphics::TBitmap *Bmp = new Graphics::TBitmap(); bool AUTO_Send=false; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action) { IdTCPClient1->Disconnect(); } //--------------------------------------------------------------------------- void __fastcall TForm1::Button1Click(TObject *Sender) { IdTCPClient1->Host=Edit1->Text; IdTCPClient1->Port=StrToInt(Edit2->Text); try{ IdTCPClient1->Connect(); }catch(...){ ShowMessage("連線有問題"); return;} ShowMessage("連線成功"); } //--------------------------------------------------------------------------- void __fastcall TForm1::Button2Click(TObject *Sender) { Timer1->Enabled=false; double TakeTime= double( Now()); if(IdTCPClient1->Connected()) { StatusBar1->Panels->Items[0]->Text="Connect"; TFileStream *fs=new TFileStream("C:\\RoachTest.jpg", fmCreate); TMemoryStream *ms=new TMemoryStream(); try { IdTCPClient1->WriteLn("SendMeFile"); IdTCPClient1->ReadStream(fs, -1, false); StatusBar1->Panels->Items[0]->Text="Read Stream"; } __finally { delete fs; delete ms; } TakeTime= double( Now()) - TakeTime ; AnsiString strTime=FloatToStr(TakeTime*24*60*60*1000); if( strTime.Length() >= 6 ) strTime=strTime.SubString(1,5); StatusBar1->Panels->Items[0]->Text=strTime+"ms"; try{ Image1->Picture->LoadFromFile("C:\\RoachTest.jpg"); }catch(...){return;} if(AUTO_Send==true) Timer1->Enabled=true; } else ShowMessage("無法連線"); } //--------------------------------------------------------------------------- void __fastcall TForm1::IdTCPClient1Status(TObject *ASender, const TIdStatus AStatus, const AnsiString AStatusText) { StatusBar1->Panels->Items[0]->Text=AStatusText; } //--------------------------------------------------------------------------- void __fastcall TForm1::Timer1Timer(TObject *Sender) { Button2Click(0); } //--------------------------------------------------------------------------- 類似上圖紅線那樣
supman
尊榮會員


發表:29
回覆:770
積分:924
註冊:2002-04-22

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-07-10 04:54:26 IP:219.68.xxx.xxx 未訂閱
您好: 請參考以下方式: void __fastcall TForm1::Button2Click(TObject *Sender) { Graphics::TBitmap *Bmp = new Graphics::TBitmap(); Bmp->LoadFromFile("c:\\michelle-pic-01.bmp"); Label1->Caption=IntToStr(Bmp->Width);//寬 Label2->Caption=IntToStr(Bmp->Height);//高 Bmp->Free(); }
系統時間:2024-05-05 18:09:50
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!