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> < ...
随机推荐
- Python中的Class的讨论
尽管Python在Function Programming中有着其他语言难以企及的的优势,但是我们也不要忘了Python也是一门OO语言哦.因此我们关注Python在FP上的优势的同时,还得了解一下P ...
- iOS开发 判断代理以及代理方法是否有人遵循
if (self.delegate && [self.delegate respondsToSelector:@selector]) { return YES; }
- mongodb数据库js查询
#健康风险-disease db.disease.find({versions:'2'}).forEach(function(item){ item.diseaseDetail && ...
- [转载]java中try 与catch的使用
留着以后看 原文地址:与catch的使用">java中try 与catch的使用作者:碌碌如玉 try{ //代码区 }catch(Exception e){ //异常处理 } 代码区 ...
- 启动eclipse说在sdk目录下的platforma-tools下面找不到adb.exe
adb是什么?adb有什么用?adb工具如何用? 是用来管理模拟器和真机的通用调试工具,该工具功能强大,直接打开cmd即可使用adb命令,adb的全称为Android Debug Bridge,是 ...
- 探究requestDisallowInterceptTouchEvent失效的原因
昨天在用requestDisallowInterceptTouchEvent的时候,发如今设置了requestDisallowInterceptTouchEvent(true)之后,父View的onI ...
- 为什么要baidu/Google问题 尽量少在群里问问题
群里问也是可以的 但是 不能指望群里的人详细的回答 有时候的回答会很到位 但是 也可以 应该更多的去网络上搜索信息 因为 那是别人已经写好的 我们为什么不顺便去获取呢 别人花费了精力 我们要尽量运用 ...
- 测序深度和覆盖度(Sequencing depth and coverage)
总是跑数据,却对数据一无所知,这说不过去吧. 看几篇文章吧 Sequencing depth and coverage: key considerations in genomic analyses( ...
- MM中如何更改物料的评估类
在SAP MM模块中,一物料XXX ,由原来的外购,变成厂内自制:评估类也由原来的7901 改为:7900 : 注:物料的评估类,对应一些帐号,对发生的为业,产生的数据,记录在相对的帐号里: 如要更改 ...
- selenium+python笔记10
#!/usr/bin/env python # -*- coding: utf-8 -*- """ 我们多添加一些测试场景,比如:删除邮件,查找邮件,发送邮件等等 &qu ...