-
Delphi在TListView中显示数据库
Delphi在TListView中显示数据库,ListView控件的简单用法,在日常的编程开发中,这个比较常用 。
self.ListView1.ViewStyle:=vsReport;
for i:=0 to Query1.FieldCount-1 do
begin
TempColumn:=self.ListView1.Columns.Add;
TempColumn.Caption:=Query1.Fields[i].FieldName;
end;
Query1.First;
while not Query1.Eof do
begin
TempItem:=self.ListView1.Items.Add;
TempItem.Caption:=Query1.Fields[0].AsString;
for i:=1 to Query1.FieldCount-1 do
begin
TempItem.SubItems.Add(Query1.Fields[i].AsString);
end;
Query1.Next;
end;
- 2023-06-25 00:05:04下载
- 积分:1
-
Delphi 垂直交错显示效果
图片的垂直交错效果,Delphi 编写的图片垂直交错显示效果,之前就分享过这种效果,类似百叶窗的交替显示效果,可用于图片转场,不过本效果还有很多地方需要优化,当时是写给一本书,作为随书实例的,有兴趣的可参考,关于本功能的关键代码部分,请看以下代码:
newbmp:= TBitmap.Create;
newbmp.Width:=image1.Width;
newbmp.Height:=image1.Height;
bmpheight:=image1.Height;
bmpwidth:=image1.Width;
i:=0;
while i0 do
begin
newbmp.Canvas.CopyRect(Rect(0,j-1,bmpwidth,j),image1.Canvas,Rect(0,bmpheight-i+j-1,bmpwidth,bmpheight-i+j));
newbmp.Canvas.CopyRect(Rect(0,bmpheight-j-1,bmpwidth,bmpheight-j),image1.Canvas,Rect(0,i-j,bmpwidth,i-j+1));
j:=j-2;
Application.ProcessMessages;
end;
form1.Canvas.Draw(0,0,newbmp);
i:=i+2;
end;
newbmp.free;
- 2023-04-12 21:35:03下载
- 积分:1
-
Delphi添加图层蒙版
Delphi添加图层蒙版,运行本程序后,在屏幕上添加一层阴影,透明度大概在70%左右,可看作是在屏幕上方蒙了一层薄膜的感觉,代码简单:procedure TForm1.FormCreate(Sender: TObject);
var
bTrans: Byte;
OldStyle: Integer;
begin
form1.Color := clGradientActiveCaption;
WindowState := wsMaximized;
BorderStyle := bsNone;
FormStyle := fsStayOnTop;
OldStyle := GetWindowLong(Handle, GWL_EXSTYLE);
SetWindowLong(Handle, GWL_EXSTYLE, OldStyle or WS_EX_LAYERED Or WS_EX_TRANSPARENT);
bTrans := 128;
SetLayeredWindowAttributes(Handle, 0, bTrans, LWA_ALPHA);
end;
- 2022-02-06 10:25:25下载
- 积分:1
-
Delphi中使用Word的一个例子
这个程序演示了使用Word作为自动化服务器,Delphi地自动化控制器是如何将一个查询结果插入到word文档中,在程序调用过程中返回应用参数.这个调用在英文和法文版的 Word中相同。如果这个过程不存在,存在一个不同的Word翻译版本。
对中文Word请在指定处插入。
- 2022-02-12 22:24:48下载
- 积分:1
-
Delphi创建透明图像效果的窗体
Delphi创建透明图像效果的窗体,这个示例实际是演示调用透明图片并显示的效果,用此制作成一个无边框且透明的窗口,制作时需要把此窗口设为Desktop型的。图片最好是BMP或PNG透明格式的,这样当图片显示时,会显示为一个无边框的透明窗口,没有图像的部分会显示窗口下层的内容,演示了一种制作透明窗口的方法。
- 2022-02-25 21:57:42下载
- 积分:1
-
获取windows System目录路径-Delphi示例
Delphi获取windows System目录路径,这个比较简单,觉得没啥用,只是可以练习一下GetSystemDirectory函数如何使用,下面分享出核心的代码,完整代码需要您下载哦:
begin
GetMem(SysDir,255);
GetSystemDirectory(SysDir,255);
Edit1.Text := SysDir;
end;
- 2022-03-18 16:21:27下载
- 积分:1
-
Delphi 隐藏或显示鼠标指针
Delphi 隐藏或显示鼠标指针,在编译后运行本程序生成的Exe程序,在窗口中单击鼠标左键,鼠标会消失,被隐藏了,再次单击后鼠标重现,很好的演示了在Delphi中如何显示或隐藏鼠标的操作。
- 2022-01-26 04:41:31下载
- 积分:1
-
Delphi 制作红绿眼镜三维立体画
这是一个Delphi色彩控制方面的示例,我看上去更像是Delphi分离出红绿颜色通道,从页形成的一种立体效果,复制和修改颜色模式来实现,相关代码可参考如下:
//设置添充颜色的大小
DBitmap.Width := LBitmap.Width;
DBitmap.Height := LBitmap.Height;
vRect := Rect(0, 0, DBitmap.Width, DBitmap.Height); //获取添充区域
DBitmap.Canvas.Brush.Color := vGreen; //设置画笔颜色
DBitmap.Canvas.FillRect(vRect); //添充颜色
LBitmap.Canvas.CopyMode := cmSrcPaint; //将复制模式改为OR
LBitmap.Canvas.CopyRect(vRect, DBitmap.Canvas, vRect); //对图片进行复制
DBitmap.Canvas.Brush.Color := vRed;
DBitmap.Canvas.FillRect(vRect);
RBitmap.Canvas.CopyMode := cmSrcPaint; //将复制模式改为OR
RBitmap.Canvas.CopyRect(vRect, DBitmap.Canvas, vRect); //对图片进行复制
DBitmap.Canvas.CopyRect(vRect, LBitmap.Canvas, vRect);
DBitmap.Canvas.CopyMode := cmSrcAnd; //将复制模式改为AND
DBitmap.Canvas.CopyRect(vRect, RBitmap.Canvas, vRect);
except
Exit;
end;
Result := True;
end;
- 2023-02-01 08:05:04下载
- 积分:1
-
Delphi 使用Canvas美化ListBox列表项
Delphi 使用Canvas美化列表项,当用户鼠标单击ListBox列表项时,该列表项高亮显示,改变背景色,文字居中对齐,如图所示。
主要是使用了Delphi中的Canvas.FrameRect对其进行美化,具体代码有兴趣可参考:
Canvas.FrameRect(Clientrect);
if odSelected in State then
begin
Canvas.Brush.Color:=clRed;
Canvas.RoundRect(Rect.Left,Rect.Top,Rect.Right,Rect.Bottom,8,15);
setBkMode(Canvas.Handle,TRANSPARENT );
Canvas.TextOut((Rect.right-Rect.Left) div 2,Rect.Top,Items.Strings[Index]);
end
else
begin
Canvas.Brush.Color:=clSkyBlue;
Canvas.RoundRect(Rect.Left,Rect.Top,Rect.Right,Rect.Bottom,15,15);
Canvas.TextRect(Rect,Rect.Left,Rect.Top,Items.Strings[Index]);
end;
- 2022-06-01 23:33:23下载
- 积分:1
-
Delphi 变速齿轮# 让时间变快减慢
Delphi 变速齿轮# 让时间变快减慢,其实这个似乎是做不到的,只是模拟一下,代码及描述如下:
procedure Speed(count:word); stdcall;
const ExceptionUsed = $03; { 中断号也可以用其它的中断号}
var
IDT : array [0..5] of byte; { 保存中断描述符表}
lpOldGate : dword; {存放旧向量}
begin
asm
push ebx
sidt IDT {读入中断描述符表}
mov ebx, dword ptr [IDT+2]{IDT表基地址}
add ebx, 8*ExceptionUsed {计算中断在中断描述符表中的位置}
cli {关中断}
mov dx, word ptr [ebx+6] {取6,7字节 另外4字节用于门属性和选择子 }
shl edx, 16d {左移16位}
mov dx, word ptr [ebx] {取1,2字节 }
mov [lpOldGate], edx {保存旧的中断门}
mov eax, offset @@Ring0Code {修改向量,指向Ring0级代码段}
mov word ptr [ebx], ax {低16位,保存到1,2字}
shr eax, 16d
mov word ptr [ebx+6], ax {高16位,保存到6,7位}
int ExceptionUsed {发生中断}
mov ebx, dword ptr [IDT+2] {重新定位到中断描述符表中}
add ebx, 8*ExceptionUsed
mov edx, [lpOldGate]
mov word ptr [ebx], dx
- 2023-02-13 04:55:03下载
- 积分:1