|
hong 님이 쓰신 글 :
: 현재, 캔바스에 뿌려서 출력하게 되어있는데요.
: 이럴경우, Memo나 edit박스의 내용들이 한줄에 이어서 나옵니다.
: 흔히들 쓰는 hwp파일들 처럼, 화면에 쓰고 나면,
: 출력시에 화면에 쓴것과 똑같이 나오게 할수는 없나요?
: 아시는 분 있으면 조언 부탁드립니다.
질문의 요지를 잘 모르겠으나 줄바꿈을 자동으로 처리하겠다는 의미가 있는 듯하네요.
문자열에 포함된 줄바꿈 문자들을 감안하여 출력하려면 아래와 같은 방법이 있습니다.
void __fastcall TForm1::Button1Click(TObject *Sender)
{
RECT rt={10,10,0,0};
rt.right = ClientWidth;
rt.bottom = ClientHeight;
//DT_CALCRECT 옵션을 지정하여 right와 bottom을 구함
DrawText(
Canvas->Handle, // handle to device context
Memo1->Text.c_str(), // pointer to string to draw
Memo1->Text.Length(), // string length, in characters
&rt, // pointer to structure with formatting dimensions
DT_LEFT|DT_WORDBREAK|DT_CALCRECT // text-drawing flags
);
//실제로 출력
DrawText(
Canvas->Handle, // handle to device context
Memo1->Text.c_str(), // pointer to string to draw
Memo1->Text.Length(), // string length, in characters
&rt, // pointer to structure with formatting dimensions
DT_LEFT|DT_WORDBREAK // text-drawing flags
);
}
|