Delphi 图形设计(3)

本文介绍了Delphi中用于图形图像处理的组件和类,包括PaintBox、Shape、Image组件,以及TGraphic、TPicture和TBitmap等图像类。详细讨论了如何加载、显示和保存图像,以及使用TPrinter进行打印图像。
摘要由CSDN通过智能技术生成

10.3 

        Delphi提供一组图形图像组件和一组图像类用于图形及图像处理。

     常用的图形图像组件有ShapePaintBoxImage组件,相关的图像类有TGraphicTPictureTBitmap

 

10.3.1  图形图像组件

1PaintBox绘图区域组件

     Delphi除了允许在Form上直接绘制图形外,还允许使用PaintBox组件来作图。PaintBox 组件位于System选项卡中。

   用PaintBox绘制图形与在Form上绘制图形的方法相似,不同的是在程序设计阶段,可以直接设定PaintBox的大小和位置。

   在使用Canvas属性绘制图形时,图形的坐标都是相对于PaintBox组件的,即PaintBox的左上角为(0,0) 的坐标,而不用管PaintBoxForm上的位置,同时当图形的大小超出PaintBox组件区域时,超出部分将自动被切割。

2Shape显示图形组件

     Shape组件用于显示简单的图形,如矩形、椭圆等,位于Additional选项卡中。

     Shape组件的WidthHeightLeftTop属性决定图形的大小和位置;

   BrushPen属性的意义与TCanvas中的完全相同;

   Shape属性决定所显示图形的形状,取值为stEllipse(椭圆)、stCircle(圆形)、stRectangle(矩形)、stRoundRect(圆角矩形)、stSquare(正方形)或stRoundSquare(圆角正方形)。

3Image绘图及显示图像组件

    Image组件除了可以绘图外,还可用于显示各种不同格式的图像,位于Additional选项卡上。其主要属性如下:

1Picture属性。

    Picture属性保存Image组件所要显示的图像文件。使用该属性编辑器中的Load按钮,可装入.bmp.ico

一个非常漂亮的图形处理界面控件资源 unit GraphicEx; // The contents of this file are subject to the Mozilla Public License // Version 1.1 (the "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ // // Software distributed under the License is distributed on an "AS IS" basis, // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the // specific language governing rights and limitations under the License. // // The original code is GraphicColor.pas, released November 1, 1999. // // The initial developer of the original code is Dipl. Ing. Mike Lischke (Plei遖, Germany, www.delphi-gems.com), // // Portions created by Dipl. Ing. Mike Lischke are Copyright // (C) 1999-2003 Dipl. Ing. Mike Lischke. All Rights Reserved. //---------------------------------------------------------------------------------------------------------------------- // // GraphicEx - // This unit is an addendum to Graphics.pas, in order to enable your application // to import many common graphic files. // // See help file for a description of supported image types. Additionally, there is a resample routine // (Stretch) based on code from Anders Melander (http://www.melander.dk/delphi/resampler/index.html) // which has been optimized quite a lot to work faster and bug fixed. // // version - 9.9 // // 03-SEP-2000 ml: // EPS with alpha channel, workaround for TIFs with wrong alpha channel indication, // workaround for bad packbits compressed (TIF) images // 28-AUG-2000 ml: // small bugfixes // 27-AUG-2000 ml: // changed all FreeMemory(P) calls back to ... if Assigned(P) then FreeMem(P); ... // 24-AUG-2000 ml: // small bug in LZ77 decoder removed // 18-AUG-2000 ml: // TIF deflate decoding scheme // 15-AUG-2000 ml: // workaround for TIF images without compression, but prediction scheme set (which is not really used in this case) // 12-AUG-2000 ml: // small changes // // For older his
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值