向上帝打申请了,下辈子再也不做程序员!! 上帝批复:OK!
本例分别用五种办法初始化了同样的一个矩形, 运行效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: ... Read More
posted @ 2009-03-17 17:18 zywuhao Views(599) Comments(0) Diggs(0)
Windows.CopyRect 是系统 API 函数, 功能是复制矩形的参数;TCanvas.CopyRect 是 TCanvas 类的方法, 功能是复制矩形范围内的图像, 有点像 BitBlt 函数. 本例效果图: 代码文件: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, ... Read More
posted @ 2009-03-17 17:17 zywuhao Views(225) Comments(0) Diggs(0)
unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sende... Read More
posted @ 2009-03-17 17:17 zywuhao Views(333) Comments(0) Diggs(0)
TGraphic 是 TBitmap 的父类, 很多绘图函数的参数是 TGraphic, 但我们经常给函数的是 TBitmap;TBitmap 的很多功能都是继承自 TGraphic, 譬如:Width、Height、LoadFromFile、SaveToFile、LoadFromStream、SaveToStream;还有 Palette(调色板)、Transparent(是否透明) 等等.TG... Read More
posted @ 2009-03-17 17:16 zywuhao Views(334) Comments(0) Diggs(0)
1、判断位图的像素格式: var bit: TBitmap; pix: TPixelFormat; s: string; begin bit := TBitmap.Create; bit.LoadFromFile('c:\temp\test.bmp'); //位图路径 pix := bit.PixelFormat; s := ''; case pix of ... Read More
posted @ 2009-03-17 17:16 zywuhao Views(257) Comments(0) Diggs(0)
捕捉全屏图像 unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; procedure Button1Clic... Read More
posted @ 2009-03-17 17:15 zywuhao Views(280) Comments(0) Diggs(0)
unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; Button2: TButton; Button3... Read More
posted @ 2009-03-17 17:13 zywuhao Views(270) Comments(1) Diggs(0)
procedure TForm1.Button1Click(Sender: TObject);var str: string; wh: TSize; w,h: Integer;begin {前面用过 Canvas.TextWidth、Canvas.TextHeight} str := '万'; w := Canvas.TextWidth(str); h := Canvas.TextH... Read More
posted @ 2009-03-17 17:13 zywuhao Views(1113) Comments(0) Diggs(0)
----TFONT 类 //先来个例子: procedure TForm1.FormPaint(Sender: TObject); const S = '万一的 Delphi 博客'; var font: TFont; begin font := TFont.Create; font.Name := '微软雅黑'; font.Style := [fsBold, fsItali... Read More
posted @ 2009-03-17 17:12 zywuhao Views(1205) Comments(0) Diggs(0)
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button1... Read More
posted @ 2009-03-17 17:09 zywuhao Views(1262) Comments(0) Diggs(0)
---Polygon、Polyline unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; ... Read More
posted @ 2009-03-17 17:08 zywuhao Views(2102) Comments(0) Diggs(0)
在窗体上添加 Panel1、PaintBox1 和 Button1, 代码如下: procedure TForm1.Button1Click(Sender: TObject); var cvs: TCanvas; begin {PaintBox1 就像窗体一样, 也有 Canvas 属性} PaintBox1.Canvas.Brush.Color := clRed; Paint... Read More
posted @ 2009-03-17 17:06 zywuhao Views(640) Comments(0) Diggs(0)
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton;... Read More
posted @ 2009-03-17 17:05 zywuhao Views(228) Comments(0) Diggs(0)
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton;... Read More
posted @ 2009-03-17 17:04 zywuhao Views(383) Comments(0) Diggs(0)
绘图需要有纸、画笔、画刷; Delphi 有 Canvas、Pen、Brush.Canvas 就是画布, 譬如窗体的 Canvas 属性, 就是窗体的画布;Pen 是画笔, 可以设置笔色、笔宽等等;Brush 是画刷, 可以设置颜色等等. //举例: {绘制直线} procedure TForm1.Button1Click(Sender: TObject); begin Canvas.Pe... Read More
posted @ 2009-03-17 17:03 zywuhao Views(154) Comments(0) Diggs(0)
//过程:ArcBrushCopyChordCopyRectDrawDrawFocusRectEllipseEllipseFillRectFloodFillFrameRectLineToLockMoveToPiePolygonPolylinePolyBezierPolyBezierToRectangleRectangleRefreshRoundRectStretchDrawTextOutTextR... Read More
posted @ 2009-03-17 17:03 zywuhao Views(149) Comments(0) Diggs(0)
//Graphics 单元中的类TGraphicsObjectTFontTPenTBrushTFontRecallTPenRecallTBrushRecallTCanvasTGraphicTPictureTMetafileCanvasTMetafileImageTMetafileTBitmapImageTBitmapTIconImageTIconTResourceManagerTBrushReso... Read More
posted @ 2009-03-17 17:01 zywuhao Views(141) Comments(0) Diggs(0)
虚拟键码 对应值 对应键 VK_LBUTTON 1 鼠标左键 VK_RBUTTON 2 鼠标右键 VK_CANCEL 3 Cancel VK_MBUTTON 4 鼠标中键 VK_XBUTTON1 5 VK_XBUTTON2 6 VK_BACK 8 Backspace VK_TAB 9 Tab VK_CLEAR 12 Clear VK_RETURN ... Read More
posted @ 2009-03-17 16:59 zywuhao Views(387) Comments(0) Diggs(0)
function GetPyChar(const HZ: AnsiString): string; const HZCode: array[0..25, 0..1] of Integer = ((1601, 1636), (1637, 1832), (1833, 2077), (2078, 2273), (2274, 2301), (2302, 2432), (2433, 2593),... Read More
posted @ 2009-03-17 16:20 zywuhao Views(272) Comments(0) Diggs(0)
unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; Button2: TButton; procedu... Read More
posted @ 2009-03-17 16:11 zywuhao Views(212) Comments(0) Diggs(0)
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Memo1: TMemo; procedure Button1Cli... Read More
posted @ 2009-03-17 16:07 zywuhao Views(424) Comments(0) Diggs(0)
unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls;type TForm1 = class(TForm) Button1: TButton; Button2: TButton; ... Read More
posted @ 2009-03-17 16:05 zywuhao Views(327) Comments(0) Diggs(0)
{函数} function ReadFileToHex(FileName: string): string; var b: Byte; begin Result := ''; if not FileExists(FileName) then Exit; with TMemoryStream.Create do begin LoadFromFile(FileName); ... Read More
posted @ 2009-03-17 16:03 zywuhao Views(292) Comments(0) Diggs(0)
absolute //它使得你能够创建一个新变量, 并且该变量的起始地址与另一个变量相同. var Str: string[32]; StrLen: Byte absolute Str; //这个声明指定了变量StrLen起始地址与Str相同. //由于字符串的第0个位置保存了字符串的长度, 所以StrLen的值即字符串长度. begin Str := 'abc'; Edit1.Text :=... Read More
posted @ 2009-03-17 15:56 zywuhao Views(231) Comments(0) Diggs(0)
----------------------------------------------------- --作用:用于sql server 2005 导出用户表数据字典 --作者:郭强--时间:年月日--用法如下: --1 默认导出当前数据库中所有用户表(xtype = 'u')的数据字典; --2 可以在xtype = 'u'替换为如下所示语句xtype = 'u' and name in... Read More
posted @ 2009-03-17 15:47 zywuhao Views(929) Comments(0) Diggs(0)
如何查询处某字段不连续的纪录,比如 记录字段值为1,5,6,7,查处2,3,4 --参考这个: /* 显示编码连号--缺号表 */ begin tran --创建测试表 select top 100 id=identity(int,1,1) into #tb fro... Read More
posted @ 2009-03-17 15:46 zywuhao Views(421) Comments(0) Diggs(0)
1:利用SQL自带的存储过程 EXEC sp_pkeys @table_name='表名' 2:利用系统表INFORMATION_SCHEMA.KEY_COLUMN_USAGE SELECT TABLE_NAME,COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_NAME='表名' 3: 以下这个查询表结构的语... Read More
posted @ 2009-03-17 15:44 zywuhao Views(476) Comments(0) Diggs(0)
每一个游标必须有四个组成部分这四个关键部分必须符合下面的顺序; 1.DECLARE 游标 2.OPEN 游标 3.从一个游标中FETCH 信息 4.CLOSE 或DEALLOCATE 游标 其中: cursor_name:指游标的名字 定义游标的作用域仅限在其所在的存储过程、触发器或批处理中。当建立游标的存储过程执行结束后,游标会被... Read More
posted @ 2009-03-17 15:42 zywuhao Views(775) Comments(0) Diggs(0)
报表作为系统信息的典型输出形式之一,是大多数应用系统特别是MIS系统的重要功能。是否具有一个良好的打印功能,往往从一定程度上关系到系统的成败。Delphi有很强的报表功能,但是它的报表功能还不能满足我们的需要。于是许多Delphi高手相继推出了不少优秀的报表控件(模块),作为QuickReport的补充,其中FastReport就是一个代表。 FastReport综合了QuickReport和... Read More
posted @ 2009-03-17 15:22 zywuhao Views(1241) Comments(0) Diggs(0)
fastreport 果然好用,几乎什么功能都能实现 fastrepot分栏数据有两种排列方式 纵向排列:page options ->options ->column number 改为2即可,页头和页脚都不受分栏影响,主项数据才受影响。注意2.53纵向分栏才正常,以前版本第二页开始会偏移。 横向排列:主项数据band里column设置为列数。 当分栏以后,如果不满一页,页面下方会留下很多空格... Read More
posted @ 2009-03-17 15:21 zywuhao Views(1630) Comments(0) Diggs(0)
说明,BCB,Delphi,C++Builder,内存分配,文件操作,磁盘目录管理,字符串操作,时间日期管理,类型转换 -------------------- 内存分配 -------------------- 函数名称:AllocMem 函数说明:在队中分配指定字节的内存块,并将分配的每一个字节初始化为 0.函数原型如下: void * __fastcall AllocMem(Cardi... Read More
posted @ 2009-03-17 15:17 zywuhao Views(290) Comments(0) Diggs(0)
本例效果图: Dll 文件: library Lib; uses SysUtils, Classes; {$R *.res} procedure Test(p: PChar); const Title = 'Title '; var str: string; begin str := p; StrCopy(p, Title); StrCat(p, PChar(str)); end; expo... Read More
posted @ 2009-03-17 14:53 zywuhao Views(271) Comments(0) Diggs(0)
本例将把一张 bmp 图片, 以资源文件的方式嵌入 dll, 然后再调用. 第一步: 建一个 DLL 工程, 如图:然后保存, 我这里使用的名称都是默认的. 第二步: 建一个资源原文件, 如图:编辑内容如下(路径中的文件一定要存在):img1 BITMAP "c:\temp\test.bmp"然后, 取个名(后缀须是 rc, 我这里取名为 Res.rc), 保存在工程目录下. 第三步:... Read More
posted @ 2009-03-17 14:51 zywuhao Views(179) Comments(0) Diggs(0)
//通过 DLL Wizard 建立:library TestDLL;uses SysUtils, Classes, Dialogs;{$R *.res}//建立过程procedure Test;begin ShowMessage('TestDLL.Test');end;//输出exports Test;beginend.//在其他工程调用,如果不在一个工程组,需要在相同目录下、Sys... Read More
posted @ 2009-03-17 14:50 zywuhao Views(157) Comments(0) Diggs(0)
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type //晚绑定,也就是动态调用外部函数主要用以下三个命令: //LoadLibrary:获取 DLL //GetProcAddress:获取函数... Read More
posted @ 2009-03-17 14:48 zywuhao Views(183) Comments(0) Diggs(0)