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

Image列印問題

缺席
alanwu
一般會員


發表:4
回覆:7
積分:7
註冊:2007-04-19

發送簡訊給我
#1 引用回覆 回覆 發表時間:2008-01-24 14:36:00 IP:61.230.xxx.xxx 訂閱

[code cpp]
//先設定整理Image1圖像
Image1->Picture = NULL;
Image1->Align = alNone;
Image1->Stretch = false;
//儲存捕捉影像的暫時圖像
Graphics::TBitmap *tempBmp = new Graphics::TBitmap();
HDC hdc = NULL;

//捕捉範圍的長寬
int x, y;

//取得全螢幕的DC handle
hdc = ::GetDC(0);
x = Screen->Width;
y = Screen->Height;

//取得Form1的DC handle
hdc = ::GetWindowDC(Form1->Handle);
x = Form1->Width;
y = Form1->Height;

//創造一相容於裝置的新圖檔,並指派給tmpBmp handle
tempBmp->Handle = ::CreateCompatibleBitmap( hdc, x, y);
//將hdc擷取到的內容複製至tempBmp中
::BitBlt(tempBmp->Canvas->Handle, 0, 0,
tempBmp->Width, tempBmp->Height,
hdc, 0, 0, SRCCOPY);
//將tempBmp傳給Image1中
Image1->Picture->Bitmap = tempBmp;

TPrinter *Prntr = Printer();

tempBmp->Width = (Image1->Width);
tempBmp->Height = (Image1->Height);

Prntr->BeginDoc();
Prntr->Canvas->StretchDraw(Rect(200,200,Image1->Width-200,Image1->Height-200) , tempBmp);
Prntr->EndDoc();

delete tempBmp;

[/code]

以上程式碼不知為何印表機跑出來都是空白的,請各位先進幫忙一下~

Image1有秀出圖~但是印出來是空白的
編輯記錄
taishyang 重新編輯於 2008-01-24 14:37:32, 註解 無‧
系統時間:2024-04-21 0:05:34
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!