RM报表 文本框 自动换行 相关代码
procedure TRMCustomMemoView.WrapMemo1(aAddChar: Boolean);
var
lCurHeight, lOneLineHeight, lMaxWidth: Integer;
lWCanvas: TCanvas; procedure _OutLine(const lStr: WideString);
begin
FSMemo.Add(lStr);
Inc(lCurHeight, lOneLineHeight);
end; procedure _WrapOutMemo;
var
h, oldh: HFont;
i: Integer;
begin
h := RMCreateAPIFont(lWCanvas.Font, , FFontScaleWidth);
oldh := SelectObject(lWCanvas.Handle, h); try
lCurHeight := ;
lOneLineHeight := -lWCanvas.Font.Height + LineSpacing; //每一行高度;
lMaxWidth := spWidth - spGapLeft * - _CalcHFrameWidth(LeftFrame.spWidth, RightFrame.spWidth);
if (DocMode = rmdmDesigning) and (FParentReport.FDesigner.Factor <> ) then
lMaxWidth := Round(lMaxWidth * / FParentReport.FDesigner.Factor); if (DocMode = rmdmDesigning) and (FMemo1.Count = ) and
(RMWideCanvasTextWidth(lWCanvas, FMemo1[]) > lMaxWidth) and
(FMemo1[] <> '') and (FMemo1[][] = '[') then
_OutLine(FMemo1[])
else
begin
if not FNeedWrapped then //不需要换行
begin
for i := to FMemo1.Count - do
_OutLine(FMemo1[i]);
end
else if WordWrap or AllowHtmlTag then //自动换行
begin
lCurHeight := lCurHeight + RMWrapStrings(FMemo1, FSMemo, lWCanvas, lMaxWidth, LineSpacing {lOneLineHeight},
WordBreak, CharWrap, AllowHtmlTag, True, aAddChar); FSMemo.Add(#);
end
else //不自动换行
begin
for i := to FMemo1.Count - do
begin
_OutLine(FMemo1[i]);
end; FSMemo.Add(#);
end;
end;
finally
FVHeight := lCurHeight - LineSpacing;
LineHeight := lOneLineHeight;
SelectObject(lWCanvas.Handle, oldh);
DeleteObject(h);
end;
end; procedure _WrapOutMemo90;
var
h, oldh: HFont;
i: Integer;
begin
h := RMCreateAPIFont(lWCanvas.Font, , FFontScaleWidth);
oldh := SelectObject(lWCanvas.Handle, h);
try
lCurHeight := ;
lOneLineHeight := -lWCanvas.Font.Height + LineSpacing;
lMaxWidth := spHeight - spGapTop * - _CalcVFrameWidth(TopFrame.spWidth, BottomFrame.spWidth);
if not FNeedWrapped then
begin
for i := to FMemo1.Count - do
_Outline(FMemo1[i]);
end
else if WordWrap then
lCurHeight := lCurHeight + RMWrapStrings(FMemo1, FSMemo, lWCanvas, lMaxWidth, LineSpacing {lOneLineHeight},
WordBreak, CharWrap, AllowHtmlTag, True, aAddChar)
else
begin
for i := to FMemo1.Count - do
_Outline(FMemo1[i]);
end;
finally
FVHeight := lCurHeight - LineSpacing;
LineHeight := lOneLineHeight;
SelectObject(lWCanvas.Handle, oldh);
DeleteObject(h);
end;
end; procedure _WrapOutMemo180;
var
i: Integer;
begin
lCurHeight := ;
lOneLineHeight := -lWCanvas.Font.Height + LineSpacing; //每一行高度;
lMaxWidth := spHeight - spGapTop * - _CalcVFrameWidth(TopFrame.spWidth, BottomFrame.spWidth); if (DocMode = rmdmDesigning) and (FMemo1.Count = ) and
(RMWideCanvasTextWidth(lWCanvas, FMemo1[]) > lMaxWidth) and
(FMemo1[] <> '') and (FMemo1[][] = '[') then
_OutLine(FMemo1[])
else
begin
if not FNeedWrapped then //已经换行
begin
for i := to FMemo1.Count - do
_OutLine(FMemo1[i]);
end
else if WordWrap then //自动换行
begin
lCurHeight := lCurHeight + RMWrapStrings(FMemo1, FSMemo, lWCanvas, lMaxWidth, LineSpacing {lOneLineHeight},
WordBreak, CharWrap, AllowHtmlTag, False, aAddChar);
end
else //不自动换行
begin
for i := to FMemo1.Count - do
begin
_OutLine(FMemo1[i]);
end;
end;
end;
FVHeight := lCurHeight - LineSpacing;
LineHeight := lOneLineHeight;
end; procedure _ChangeFontSize;
var
i: Integer;
lStr: string;
lMaxWidth: Integer;
begin
lMaxWidth := spWidth - spGapLeft * - _CalcHFrameWidth(LeftFrame.spWidth, RightFrame.spWidth);
if lMaxWidth < then Exit; for i := to FMemo1.Count - do
begin
lStr := FMemo1[i];
while (RMWideCanvasTextWidth(lWCanvas, lStr) > lMaxWidth) and (lWCanvas.Font.Size > ) do
lWCanvas.Font.Size := lWCanvas.Font.Size - ;
end; Font.Size := lWCanvas.Font.Size;
end; begin
if not AutoAddBlank then
aAddChar := False;
if RotationType <> rmrtNone then
AllowHtmlTag := False; FParentReport.DrawCanvas.LockCanvas;
try
lWCanvas := FParentReport.DrawCanvas.Canvas;
lWCanvas.Font.Assign(Font);
lWCanvas.Font.Height := -Round(Font.Size * / );
SetTextCharacterExtra(lWCanvas.Handle, CharacterSpacing);
case FScaleFontType of
rmstByWidth:
begin
if DocMode <> rmdmDesigning then
_ChangeFontSize;
end;
rmstByHeight:
begin
end;
end; FSMemo.Clear;
case RotationType of
rmrt90, rmrt270: _WrapOutMemo90;
rmrt180: _WrapOutMemo180;
else
_WrapOutMemo;
end; SetTextCharacterExtra(lWCanvas.Handle, );
finally
FNeedWrapped := False;
FParentReport.DrawCanvas.UnLockCanvas;
end;
end;
RM报表 文本框 自动换行 相关代码的更多相关文章
- 基于jQuery的计算文本框字数的代码-jquery
用户边输入计算同时进行,告诉用户还剩余多少可输入的字数,当超过规定的字数后,点击确定,会让输入框闪动 一.功能: 1.用户边输入计算同时进行,告诉用户还剩余多少可输入的字数; 2.当超过规定的字数 ...
- 解决ie文本框不能输入和获取焦点问题
解决办法: 从正常的机器上拷贝c:\windows\system32\mshtmled.dll到本机的system32目录下即可.或者从安装盘中提取该文件. 加载mshtmled.dll: ...
- jQuery 文本框得失焦点应用
一.文本框得失焦点一种是改变文本框的样式 得到焦点: 失去焦点: 二.文本框得失焦点另一种是改变文本框的值 得到焦点: 失去焦点: 三.jQ ...
- java学习:AWT组件和事件处理的笔记(1)--文本框
java.awt包中的TextField类是专门用来建立文本框的,即TextField类创建的一个对象便是一个文本框. 1.TextField类的主要方法 (1)TextField() ...
- jquery 文本框回车与change事件
文本框的改变用change事件 要用bind,两个是有区别的,change只是在失去焦点的时候出发,很多时候不能满足需要. 代码如下 $('#flowfromid').bind("pr ...
- C# 读取Word文本框中的文本、图片和表格(附VB.NET代码)
[概述] Word中可插入文本框,在文本框中可添加文本.图片.表格等内容.本篇文章通过C#程序代码介绍如何来读取文本框中的文本.图片和表格等内容.附VB.NET代码,有需要可作参考. [程序环境] 程 ...
- 同步文本框内容的JS代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- input文本框实现宽度自适应代码实例
代码实例如下: <!DOCTYPE html> <html><head><meta charset="utf-8"><meta ...
- input文本框实现宽度自适应代码实例,input文本框
本章节介绍一下如何让一个文本框的宽度能够随着文本框中的内容的宽度增长而增长,也就是能够实现宽度自适应效果. 代码实例如下: <!DOCTYPE html> <html> < ...
随机推荐
- eclipse xml 注释快捷键
注释:CTRL + SHIFT + / 撤销注释:CTRL + SHIFT + \
- 转:Teach Yourself Programming in Ten Years——用十年教会自己编程
转自:http://blog.csdn.net/UndeadWraith/article/details/6140455 作者:Peter Norvig 译者:刘海粟 本文原文为:http://nor ...
- [Selenium] 根据预期的日期格式,获取昨天的日期
我们不必考虑当前时间是否是本月1号,"MM/dd/yyyy"日期格式可以更改.
- iOS开发 UIPanGestureRecognizer手势抽象类
UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@sel ...
- ManyToMany关联方式----
http://blog.csdn.net/sinat_18882775/article/details/51171427 好的博客 系列文章总结
- Linux 打包和压缩 方法详解
一般基因组的数据都非常大,所以都会 打包 压缩 后进行传输,拿到数据后的第一步必然就是要 解包 和 解压缩. 基本常识 首先要弄清两个概念:打包 和 压缩. 打包 是指将一大堆文件或目录变成一个总的文 ...
- assert的用处
ASSERT函数是用于调试中,也就是说在你的代码中当是Debug的时候它完成对参数的判断,如果是TRUE则什么都不做,如果是FALSE则弹出一个程序中断对话框提示程序出现错误.在Release版本中它 ...
- ajax再接触
贴三个目前写的已经工作了的ajax,并且给出备注: 1.这是第一个ajax以及它的接口文档,需要注意的是1.因为返回数据是xml所以多加了contentType:"application/x ...
- [ssc] 数据库管理工具——SQuirreL SQL Client使用入门
简单介绍: SQuirrel SQL Client是一个用Java写的数据库客户端,用JDBC统一数据库访问接口以后,可以通过一个统一的用户界面来操作MySQL PostgreSQL MSSQL Or ...
- [JS] 限制上传文件的类型和大小
<!DOCTYPE html> <!-- saved from url=(0035)http://localhost:9090/qraved/update --> <ht ...