报表制作技巧(一)
比较大的数字在输出时会显得不易阅读,在Delphi中显示带分节号的数字是相当简单的一件事,如下即可:xxxxx.caption:ΚFormatFloat(′#′,524667500)。
当前打印机的分辨率
Windows下的打印分辨对打印程序有着至关重要的作用,如果你想知道打印机的分辨率,请在程序中加入一行:ShowMessage(′水平分辨率′+inttostr(GetDeviceCaps(printerHandle,LOGPIXELSX))+chr(13)+′垂直分辨率:′+inttostr(GetDeviceCaps(printerHandle,LOGPIXELSY)));结果就一目了然了。
将结果直接送到打印机
Delphi提供了两种打印方式:一是将结果输送到Form,再调用Form的print方法将结果输送到打印机,二是将结果直接输送到打印机。如果你采用第一种方式,则无论你怎样调整Form的PrintScal属性,打印出来的东西也不会让你满意。因此建议采用第二种方式。
报表制作技巧(二)
整理编辑:China ASP
尽量不要使用AssignPrn
尽管AssignPrn简化了文本打印操作,使输出到打印机像输出到文件一样简单。但简单带来的是一系列的不方便:你无法知道当前打印的行数,无法准确控制行距,无法灵活改变字体字形等等。还是用打印机的Canvas属性进行打印吧。
用打印机的点数做度量单位
如果想让打印程序在任何打印机上都能正常地打印,你就必须改变你的度量单位。如果采用固定的度量,不同分辨率的打印效果是不同的。举例来讲:printerCanvasrectangle(0,0,360,720)在360×360的佳能4200SP上能打出一个1英寸宽、2英寸高的矩形,但在600×600的惠普6L上只能打出06英寸宽、12英寸高的矩形。使用打印机的点数做为度量单位是一个明智的选择。具体做法如下:VarPointX,PointY:integer;PointX:=GetDeviceCaps(printerHandle,LOGPIXELSX);PointY:=GetDeviceCaps(printerHandle,LOGPIXELSX);printerCanvasrectangle(0,0,PointX*1,PointY*2)这样,无论你使用什么样的打印机,都能得到一个1英寸宽、2英寸高的矩形。
添加打印程序单元
尽管Delphi在生成窗体时会自动在USES部分加入许多程序单元,但打印程序单元(Printers)却不在之列,要想使打印机正常工作和程序不出错,你还是老老实实手工给它加上吧。
报表制作技巧(三)
整理编辑:China ASP
任意打印
有时我们要打印任意排列的表或往已经印好的登记表上对号入座写上数据时,可以新建一个窗体(假设为Form1),再把Form1的BorderStyle设为bsNone、AutoScroll设为True,接下来再创建一个新窗体(假设为Form2),再建个按钮Button1,编写代码:
procedure TForm2.Button1Click(Sender: TObject);
begin
Form1.Width :=900;
Form1.Height :=800;
Form1.Print;
end;
接下来你在Form1上对应的位置写上数据,运行后按Button1就会一五一十的打印下来了。
打印机的分辨率问题?
Printer Resolution ?
问:
I want to know, wich way I have to program, so every print is equal. No
matter what resolution
of the printer (300 or 600 dpi).
Since now I program: TextOut(DC, 150, 150...) on a 300 dpi printer. But on
600 dpi, everything
looks a bit strange, (small).
What Objects can I use to print corectly??
答:
I get the printer resolution (and unprintable are if desired) and
then specify coordinates using decimal inches * resulution e.g.
x = trunc(1.5 * ResX) at 300 dpi will begin at 360 * 1.5 or 540 pixels.
Get Resolution and unprintable
ResX := GetDeviceCaps(ACanvas.Handle,LOGPIXELSX);
ResY := GetDeviceCaps(ACanvas.Handle,LOGPIXELSY);
pOffsetX := GetDeviceCaps(ACanvas.Handle,PHYSICALOFFSETX);
pOffsetY := GetDeviceCaps(ACanvas.Handle,PHYSICALOFFSETY);
print something
Printer.Canvas.TextOut(trunc(1.5 * ResX)-pOffsetX,
trunc(2.5 * ResY)-pOffsetY,'Hello');
This is nice when prp元件上点出右键菜单,选Report Setting项,将弹出一个设置窗口,将
Margins项中的Number of columns项设为你想在一行中显示的记录数,然后你会发现。。。:)
在打印或打印预览前如何获取报表页数
整理编辑:China ASP
我们有时需要在打印前获取报表的打印页数, 比如我们需要在页眉或页脚中打印“共 xx 页 第 xx 页”,那如何实现呢? QuickRep生成Report之前,我们是无法得知报表页数的,而QuickReport是在打印或打印预览时才生成报表,换言之我们只有在 打印或打印预览前先将报表生成一次才能获取打印页数.生成报表的方法是 Prepare。参考以下的例子:
...
var nPageCount:integer;
begin
{...}
QuickRep1.Prepare;
nPageCount:=QuickRep1.QRPrinter.PageCount;
QuickRep1.QRPrinter.Free;
QuickRep1.QRPrinter:=nil;
{在此修改QuickRep1,实现在页眉或页脚中打印“共 xx 页 第 xx 页” ... }
QuickRep1.PreView;
{...}
End;
相关推荐
Objective C Pocket Reference.rar
Objective C Pocket Reference.rar
iPhone.rar_iPhone/iOS_Objective-C_
iPhone开发必备资料,齐全,是开发必不可缺的资料
Kindle Computer Science other.rar
计算机科学类图书打包,mobi格式。 Apress Beginning 3D Game Development with Unity.mobi Apress Beginning BlackBerry 7 Development.mobi NoStarch IDA Pro Book 2nd.mobi OReilly PDF Explained.mobi OReilly Programming Scala.mobi Social Engineering.mobi Wrox Beginning Lua Programming.mobi Android\Android Programming Tutorials.mobi Android\Apress Android Recipes.mobi Android\Apress Pro Android Python with SL4A.mobi Android\OReilly Application Security for the Android Platform.mobi Android\Oreilly Learning Android.mobi Android\The Busy Coders Guide to Advanced Android Development.mobi Android\The Busy Coders Guide to Android Development.mobi Android\Wiley App Inventor for Android.mobi Apple\101024Apple Pro Training Aperture 3.mobi Apple\101102Apple Pro Training Series AppleScript 1-2-3.mobi Apple\Apple Pro Training Aperture 3 - Organize Perfect and Showcase Your Photos.mobi Apple\Apple Pro Training Series AppleScript 1-2-3.mobi Database\Apress Access 2010 Development.mobi Database\Apress Expert Oracle Exadata.mobi Database\Apress Expert Oracle GoldenGate.mobi Database\Apress Expert PL SQL Practices for Oracle Developers and DBAs.mobi Database\Apress Oracle PLSQL Recipes - A Problem-Solution Approach.mobi Database\Apress Pro Oracle Database 11g Administration.mobi Database\Apress Troubleshooting Oracle Performance.mobi Database\Oracle Internals - Tips Tricks and Techniques for DBAs.mobi Database\OReilly High Performance MySQL.mobi Database\OReilly SQL and Relational Theory 2nd.mobi Database\OReilly SQL Cookbook.mobi Database\OReilly SQL Pocket Guide 3rd.mobi Database\Pragmatic SQL Antipatterns Avoiding the Pitfalls of Database Programming.mobi Flash\FriendsofED AdvancED ActionScript 3.0 Design Patterns.mobi Flash\OReilly Automating ActionScript Projects with Eclipse and Ant.mobi Flash\OReilly Quick Guide to Flash Catalyst.mobi iOS_Mac\Addison Learning Cocos2D.mobi iOS_Mac\Addison Programming in Objective-C 3rd.mobi iOS_Mac\Apple Pro Training Aperture 3 - Organize Perfect and Showcase Your Photos.mobi iOS_Mac\Apple Pro Training Series AppleScript 1-2-3.mobi iOS_Mac\Apress Beginning OSX Lion Apps Development.mobi iOS_Mac\Apress Learn cocos2d Game Development with iOS 5.mobi iOS_Mac\Apress Migrating to iPhone and iPad for dotNET Developers.mobi iOS_Mac\Apress Pro iOS Apps Performance Optimization.mobi iOS_Mac\iPhone Programming The Big Nerd Ranch Guide.mobi iOS_Mac\OReilly Basic Sensors in iOS.mobi iOS_Mac\OReilly Developing Enterprise iOS Applications.mobi iOS_Mac\OReilly iOS 4 Programming Cookbook.mobi iOS_Mac\OReilly Mac OS X for Unix Geeks Leopard 4th.mobi iOS_Mac\Pragmatic iOS Recipes.mobi iOS_Mac\Pragmatic Mac Kung Fu.mobi iOS_Mac\Wrox Beginning iOS Game Development.mobi iOS_Mac\Wrox Building Applications for Mac App Store.mobi Lisp\NoStarch Land of Lisp - Learn to Program One Game at a Time.mobi Perl\OReilly Learning Perl 6th.mobi Perl\OReilly Perl Pocket Reference.5th.mobi PHP\OReilly Building on SugarCRM.mobi PHP\OReilly Web Database Applications with PHP and MySQL 2nd.mobi PHP\Packt WordPress 3 Plugin Development Essentials.mobi Python\Addison Python Standard Library by Example, the Developers Library.mobi Python\Addison Python Web Development with Django.mobi Python\Apress The Definitive Guide to Django - Web Development Done Right.mobi Python\OReilly Learning Python 4th.mobi Python\OReilly MongoDB and Python.mobi Python\OReilly Programming Python 3rd.mobi Python\OReilly Python and AWS Cookbook.mobi Python\OReilly Python for Unix and Linux System Administration.mobi Python\OReilly Social Network Analysis for Startups.mobi Python\Packt Django 1.1 Testing and Debugging.mobi R\NoStarch The Art of R Programming.mobi R\OReilly Data Mashups in R.mobi R\OReilly Machine Learning for Email.mobi R\OReilly Parallel R.mobi SAP\McGraw SAP Project System Handbook.mobi SAP\OReilly Microsoft .NET and SAP (Pro-Developer).mobi SAP\Sams Teach Yourself SAP in 24 Hours 4th.mobi StackOverflowE-Books\stack_overflow_ajax.mobi StackOverflowE-Books\stack_overflow_android.mobi StackOverflowE-Books\stack_overflow_asp.net.mobi StackOverflowE-Books\stack_overflow_c.mobi StackOverflowE-Books\stack_overflow_clojure.mobi StackOverflowE-Books\stack_overflow_cocoa.mobi StackOverflowE-Books\stack_overflow_css.mobi StackOverflowE-Books\stack_overflow_database.mobi StackOverflowE-Books\stack_overflow_delphi.mobi StackOverflowE-Books\stack_overflow_django.mobi StackOverflowE-Books\stack_overflow_drupal.mobi StackOverflowE-Books\stack_overflow_erlang.mobi StackOverflowE-Books\stack_overflow_f#.mobi StackOverflowE-Books\stack_overflow_flash.mobi StackOverflowE-Books\stack_overflow_flex.mobi StackOverflowE-Books\stack_overflow_git.mobi StackOverflowE-Books\stack_overflow_haskell.mobi StackOverflowE-Books\stack_overflow_html.mobi StackOverflowE-Books\stack_overflow_html5.mobi StackOverflowE-Books\stack_overflow_iphone.mobi StackOverflowE-Books\stack_overflow_jquery.mobi StackOverflowE-Books\stack_overflow_linq.mobi StackOverflowE-Books\stack_overflow_linux.mobi 。。。
无人机固定翼无人机简化燃油燃烧仿真的模拟模型(Matlab代码实现)
内容概要:本文提出了一种面向固定翼无人机的简化燃油燃烧仿真模拟模型,该模型基于Matlab平台实现,旨在对无人机在飞行过程中的燃油消耗行为进行高效、准确的模拟与分析。模型在保证工程实用性的前提下,对复杂的燃烧化学反应和热力学过程进行了合理简化,重点保留了燃料消耗速率、发动机效率与飞行状态(如高度、速度、迎角等)之间的动态耦合关系,构建了一个轻量化且具备良好泛化能力的燃油经济性评估工具。该模型可用于不同飞行剖面下的续航能力预测、任务航程规划以及能源管理策略的初步设计与验证,为无人机系统级仿真与优化提供关键支撑。; 适合人群:具备Matlab编程与仿真实践能力,从事固定翼无人机总体设计、飞行任务规划、航空动力系统或绿色航空技术研究的科研人员与工程师。; 使用场景及目标:①支撑固定翼无人机在多种工况(巡航、爬升、机动等)下的燃油消耗预测与航程评估;②服务于无人机能源管理系统的概念设计与性能优化,提升任务可靠性和飞行经济性; 阅读建议:建议读者结合Matlab代码深入理解模型结构,通过调整飞行参数(空速、海拔、推力设定等)开展仿真实验,观察燃油流量与累积消耗的变化趋势,进而掌握模型的响应特性与适用边界。
风光储协同并网发电系统仿真(Simulink仿真实现)
内容概要:本文系统介绍了基于Simulink的风光储协同并网发电系统的仿真研究,聚焦风能、光伏与储能系统的多能互补协调控制策略,涵盖并网逆变器控制、虚拟同步发电机(VSG)、下垂控制、模型预测控制(MPC)、中点电位平衡、孤岛检测、低电压穿越(LVRT)等多项核心技术的建模与仿真实现。文档列举了多个典型应用场景,如风光储交直流微电网一体化控制、PEM电解槽制氢耦合系统、VSG预同步切换控制等,并强调结合参考文献与仿真模型进行SCI级别论文的复现,突出其科研指导性与工程实用性。资源包还提供详尽的设计文档、建模报告、Mathcad计算书及配套程序,支持深入理解与二次开发; 适合人群:面向具备电力系统、新能源发电、自动控制等相关专业知识背景的研究生、科研人员及工程技术人员,尤其适用于从事MATLAB/Simulink仿真实践、需完成高水平学术论文或参与实际能源系统设计的研发人员; 使用场景及目标:①用于风光储多能互补系统的并网特性分析、动态响应评估与先进控制策略验证;②支撑SCI论文复现、科研项目攻关与创新方法提出,提升科研竞争力;③服务于高校毕业设计、课程课题研究及实际工程项目中的系统优化、性能测试与方案论证; 阅读建议:建议读者结合提供的参考文献与仿真模型同步操作,优先掌握VSG、MPC、双闭环控制等核心模块的建模逻辑与参数整定方法,注重理论推导与仿真实践相结合,循序渐进地从单一单元扩展至复杂系统集成仿真,全面提升建模能力与科研素养。


IBM开发者
