將輸入字串放至image上 |
尚未結案
|
jcee
一般會員 發表:2 回覆:1 積分:0 註冊:2004-05-16 發送簡訊給我 |
我想抓Edit上的文字輸到Image上
Edit的Text若有改也能改Image的文字
但是會一直跑出亂碼
下面是我的code
可以請問一下是哪裡出了問題嗎
謝謝
char *LineData; LineData = Edit1->Text.c_str(); Form1->Image1->Height = Image1->Canvas->TextHeight(LineData);
Form1->Image1->Width = Image1->Canvas->TextWidth(LineData); GetObject(Image1->Canvas->Font->Handle, sizeof(LOGFONT), &logfont);
logfont.lfEscapement = 10*StrToInt(Angle*90);
logfont.lfOrientation = 10*StrToInt(Angle*90);
logfont.lfOutPrecision = OUT_TT_ONLY_PRECIS;
Image1->Canvas->Font->Handle = CreateFontIndirect(&logfont); SetGraphicsMode(Image1->Canvas->Handle, GM_ADVANCED); Image1->Canvas->Brush->Color = clWhite;
Image1->Canvas->FillRect(Rect(0,0,Image1->Width,Image1->Height)); Form1->Image1->Canvas->Brush->Style = bsClear;
Form1->Image1->Canvas->Font->Color = ColorDialog1->Color;
Form1->Image1->Canvas->TextOut(0, 0, LineData);
|
jest0024
高階會員 發表:11 回覆:310 積分:224 註冊:2002-11-24 發送簡訊給我 |
引言:學而時習之不亦樂乎!我想抓Edit上的文字輸到Image上 Edit的Text若有改也能改Image的文字 但是會一直跑出亂碼 下面是我的code 可以請問一下是哪裡出了問題嗎 謝謝 //* Form1->Image1->Height = Image1->Canvas->TextHeight(LineData); Form1->Image1->Width = Image1->Canvas->TextWidth(LineData); GetObject(Image1->Canvas->Font->Handle, sizeof(LOGFONT), &logfont); logfont.lfEscapement = 10*StrToInt(Angle*90); logfont.lfOrientation = 10*StrToInt(Angle*90); logfont.lfOutPrecision = OUT_TT_ONLY_PRECIS; Image1->Canvas->Font->Handle = CreateFontIndirect(&logfont); SetGraphicsMode(Image1->Canvas->Handle, GM_ADVANCED); *// char *LineData; LineData = Edit1->Text.c_str(); char *LineData; TLogFont *LogFont; LogFont.lfOrientation = 30*10; //角度 LogFont.lfFaceName = '細明體'; //字型名稱 LogFont.lfHeight = 40; //高度 ... ... Image1->Canvas.Font.Handle = CreateFontIndirect(&logfont); Image1->Canvas->Brush->Color = clWhite; Image1->Canvas->FillRect(Rect(0,0,Image1->Width,Image1->Height)); Form1->Image1->Canvas->Brush->Style = bsClear; Form1->Image1->Canvas->Font->Color = ColorDialog1->Color; Form1->Image1->Canvas->TextOut(0, 0, LineData); |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |