델파이
TMemo 모든 내용(행, Line) 보이게 세로 크기 늘리기
미스터몽키
2019. 1. 4. 18:53
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | var bmp: TBitmap; LineHeight, TotalHeight: integer; begin // TMemo의 모든 Text가 보이게 세로 늘리기 즉 모든 행이 보이고 세로스크롤바가 비활성화되게 bmp:=TBitmap.Create; try bmp.Canvas.Font.Assign(aMemo.Font); LineHeight:=bmp.Canvas.TextHeight('홍'); TotalHeight:=(aMemo.Lines.Count+2) * LineHeight finally FreeAndNIL(bmp) end; if (aMemo.Tag > 0) and (aMemo.Tag > TotalHeight) then //Tag에 최소 높이를 설정할 수 있다.
aMemo.Height := aMemo.Tag
else
aMemo.Height := TotalHeight;
|