文章列表
 
您正在查看 "编程资源-vcl" 分类下的文章

2009-06-17 20:13
Delphi的StringGrid使用技巧代码

Procedure GridSort(StrGrid: TStringGrid;NoColumn:Integer);//实现排序操作
Var
Line, PosActual:Integer;
Row: TStrings;
begin
Renglon:=TStringList.Create;
For Line := 1 to StrGrid.RowC ount-1 do
Begin PosActual := Line;
Row.Assign(TStringlist(StrGrid.Rows[PosActual ]));
While True do
Begin If (PosActual = 0) Or (StrToInt(Row.Strings[NoColum n-1]) >= StrToInt(StrGrid.Cells[NoColumn-1,PosActual-1
 
2006-10-30 17:52

Creating Simple User Object

This article first appeared in The Delphi Magazine Issue 92 (April 2003)

Creating Simple User Object
Property Dialogs

by Brian Frost

Have you ever needed to create a dialog which exposes the properties of an object to the user? A typical application is to provide a formatted form with text and controls to allow the user to view and edit some settings. This apparently easy task can soak up time and resources just simply wiring up the controls to the properties. This article shows one solution.

Introduction

Delphi has provided us with a great time-saving aid: the ability to drop controls onto forms in seconds, a task that hitherto took significant time to code in a non-visual environment. One area where time is still spent, though, is in ‘wiring up’ the control events to cause (ultimately) property changes to take place. This is also an area of coding th

 
2006-10-30 17:49

===============================================================================
  补充知识:TWndMethod 概述
===============================================================================
写这段基础知识是因为我在阅读 MakeObjectInstance(MainWndProc) 这句时不知道究竟传递了什么东西给 MakeObjectInstance。弄清楚了 TWndMethod 类型的含义还可以理解后面 VCL 消息系统中的一个小技巧。

  TWndMethod = procedure(var Message: TMessage) of object;

这句类型声明的意思是:TWndMethod 是一种过程类型,它指向一个接收 TMessage 类型参数的过程,但它不是一般的静态过程,它是对象相关(object related)的。TWndMethod 在内存中存储为一个指向过程的指针和一个对象的指针,所以占用8个字节。TWndMethod类型的变量必须使用已实例化的对象来赋值。举个例子:
  var
    SomeMethod: TWndMethod;
  begin
    SomeMethod := Form1.MainWndProc; // 正确。这时 SomeMethod 包含 MainWndProc
      

 
2006-10-30 17:49

Delphi 的消息

目  录
===============================================================================
  一个 GUI Application 的执行过程:消息循环的建立
  TWinControl.Create、注册窗口过程和创建窗口
  补充知识:TWndMethod 概述
  VCL 的消息处理从 TWinControl.MainWndProc 开始
  TWinControl.WndProc
  TControl.WndProc
  TObject.Dispatch
  TWinControl.DefaultHandler
  TControl.Perform 和 TWinControl.Broadcast
  TWinControl.WMPaint
  以 TWinControl 为例描述消息传递的路径
===============================================================================

 

正  文
===============================================================================
  一个 GUI Application 的执行过程:消息循环的建立
===============================================================================
通常一个 Win32 GUI 应用程

 
2006-10-30 17:09

增加附加的数据到stringlist中

How to append additional data to a string in a StringList, ListBox, Memo or ComboBox. The great thing is that this works in the same way for every VCL class that uses TStings like TMemo, TListbox, TCombobox etc. or other classes that provide a Data property, like TTreeView or TListView

To add strings in a stringlist is very easy:
 
var hSL: TStringList;

begin
  hSL:= TStringList.Create;
  hSL.Add('any string...');

  hSL.Destroy;
end;

Howevery - sometimes you need to add additional information to every string. This can be done by the objects-property:

var hIndex: integer;
//any number that specifies the line

begin
  hSL.Add('my string');
  hSL.Sort;
  hIndex:= hSL.IndexOf('my string');
  hSL.Objects[hIndex] := TStringList.Create;
  TStringList(hSL.Objects[hIn

 
 
   
 
 
文章存档
 
     
 
最新文章评论
  

对已经存在或者更改过的文件怎样加解密?
 

如果编号能修改就好了
 

[表情]
 

感谢前辈指路。。
 

你好,怎么打印啊?怎么注册?
   
帮助中心 | 空间客服 | 投诉中心 | 空间协议
©2012 Baidu