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> < ...
随机推荐
- 什么是Plist文件
直接将数据直接写在代码里面,不是一种合理的做法.如果数据经常改,就要经常翻开对应的代码进行修改,造成代码扩展性低 因此,可以考虑将经常变的数据放在文件中进行存储,程序启动后从文件中读取最新的数据.如果 ...
- Java异常与运行时异常,以及与线程的关系
具体可以看这篇文章:http://www.cnblogs.com/charlesblc/p/6171103.html 都写在里面了,为了避免更新不一致,这里就不再写一遍了.只给个链接. 注意Java和 ...
- Delphi 使用之函数
函数由一句或多句代码组成,可以实现某个特定的功能.使用函数可以使代码更加易读.易懂,加快编程速度及减少重复代码.过程与函数类似,过程与函数最重要的区别在于,过程没有返回值,而函数能有返回值. ...
- Android版本升级同时Sqlite数据库的升级及之前数据的保留
http://www.cnblogs.com/wang340/archive/2013/05/06/3063135.html http://www.eoeandroid.com/forum.php?m ...
- spring.hibernate设置参数的位置问题
1.spring的注解设置在set方法上 2.hibernate的注解设置在get方法上
- Sqlserver_sql注入
随着B/S模式应用开发的发展,使用这种模式编写应用程序的程序员也越来越多.但是由于这个行业的入门门槛不高,程序员的水平及经验也参差不齐,相当大一部分程序员在编写代码的时候,没有对用户输入数据的合法性进 ...
- Hbase之使用回调函数进行批处理操作
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; impo ...
- (转)ConcurrentHashMap解析
原文地址:http://www.ibm.com/developerworks/cn/java/java-lo-concurrenthashmap/ ConcurrentHashMap 的结构分析 为了 ...
- 封装jquery时用到的东西
顺序都是瞎拍的,就是明显分割用 1.将函数封装成$(' ')这种形式 把函数名起成$ $(各种选择器) $(selector) 2.有时候jquery可以继续加点,返回自己本身的元素 创建个构造函数, ...
- ubuntu修改更新源为163
安装ubuntu后为了使下载及更新软件包更快,需要将自带的源更换为国内的源.以下以163为例: 1.首先备份下原始自带源: sudo cp sources.list /etc/apt/sources. ...