本博客记录傻猫的生活、工作和学习,并与大家一起分享快乐.
该日志由 samool 发表于 2007-02-16 11:44 AM
private
{ Private declarations }
SortCol: Integer;
SortWay: Integer;
procedure TMainFrm.ListView1ColumnClick(Sender: TObject; Column: TListColumn);
begin
SortCol:=Column.Index;
if (SortWay=1) then SortWay:=-1 else SortWay:=1;
(Sender as TCustomListView).AlphaSort;
end;
procedure TMainFrm.ListView1Compare(Sender: TObject; Item1, Item2: TListItem; Data: Integer; var Compare: Integer);
var
t: Integer;
begin
if (SortCol=0) then
begin
Compare:=SortWay * CompareText(Item1.Caption,Item2.Caption);
end else
begin
t:=SortCol-1;
Compare:=SortWay * CompareText(Item1.SubItems[t],Item2.SubItems[t]);
end;
end;
该日志由 samool 发表于 2007-02-16 11:01 AM
d5下开发的大多数控件都是从tcomponenteditor派生的
对于在d5开发的从tcomponenteditor派生的控件,要到d6下使用,需要经过以下
几个步骤:
1、添加 lib\designide.dcp到控件的dpk文件的requires部分
2、在控件的pas源文件中凡是uses dsgnintf的地方改成uses designintf, designeditors
3.加入搜索路径
C:\Program Files\Borland\Delphi7\Source\ToolsAPI
偶测试成功, 下面还有一种方法(来至大富翁论坛), 测试失败.
---------------------------------------------------------------------------------------------------
这个问题是D6及D7才有的,原因及解决方法如下文(英文站点,看晕了)
http://community.borland.com/article/0,1410,27717,00.html
不改包,直接改Delphi源文件的解决方法:(我是这样改的,没有出什么问题)
1.加入搜索路径
C:\Program Files\Borland\Delphi7\Source\ToolsAPI
2.打开
C:\Program Files\Borland\Delphi7\Source\ToolsAPI\DesignEditors.pas
3.找到并把
uses
Types, SysUtils, Classes, TypInfo, Variants, DesignIntf, DesignMenus,Proxies;
改为
uses
Types, SysUtils, Classes, TypInfo, Variants, DesignIntf, DesignMenus{,Proxies};
4.找到并把
if (FAncestor = nil) and (Component <> Designer.Root)
and IsProxyClass(Component.ClassType) then
改为
if (FAncestor = nil) and (Component <> Designer.Root)
{and IsProxyClass(Component.ClassType)} then
5.找到并把
while IsProxyClass(ComponentClass) do
改为
//while IsProxyClass(ComponentClass) do
6.保存,编译运行,OK
上面3.4.5.就是把Proxies单元从DesignEditors单元中剔除,DesignEditors单元
中只有两个地方引用了Proxies单元的函数,而且是同一个函数:IsProxyClass,把
这两个地方注释掉就可以了.
该日志由 samool 发表于 2007-02-15 9:58 AM
procedure ChangeDir(dir: string; SL: TStringList);
var
SearchRec : TSearchRec;
Attr : integer;
Found : integer;
ExtFileName:string;
temstr:string;
begin
SL.Clear;
//查找该目录下所有*.jpg的文件,并将文件路径及文件名添加到SL
temstr:=dir+'\*.jpg';
Attr := faAnyFile;
Found := FindFirst(temstr, Attr, SearchRec);
while Found = 0 do
begin
//获取扩展名
//ExtFileName:=LowerCase(ExtractFileExt(SearchRec.Name));
try
SL.Add(dir+'\'+SearchRec.Name);
except
end;
Found := FindNext(SearchRec);
end;
FindClose(SearchRec);
end;
该日志由 samool 发表于 2007-02-13 10:48 AM
webbrowser1.silent:=true; //屏蔽脚本错误
procedure TForm1.WebBrowser1NewWindow2(Sender: TObject; var ppDisp: IDispatch; var Cancel: WordBool);
begin
Cancel:=True; //禁止弹出窗口
end;
该日志由 samool 发表于 2007-02-08 6:07 PM
该日志由 samool 发表于 2007-02-08 4:30 PM
该日志由 samool 发表于 2007-02-07 1:47 PM
procedure TMainForm.btnSendPhotoMouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
if imgSelectPhotot2.Tag mod 2 <> 1 then
begin
imgSelectPhotot2.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Ico\SoftImage\a5_03.jpg');
imgSelectPhotot2.Tag := 5;
end;
if TImage(Sender).Tag mod 2 = 0 then exit;
TImage(Sender).Picture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Ico\SoftImage\b_03_2.jpg');
TImage(Sender).Tag := 0;
end;
该日志由 samool 发表于 2007-01-26 9:45 AM
我刚开始时, OLE DB Provider 连接PostgreSQL数据库, 连接成功了, 查询操作也是正常的.
但是, 我用ADOQuery 添加数据时,出现"在行集中没有定义列",但是数据添加成功了. 郁闷中.
后来通过ODBC DSN方式, 完全正常.. 不过PostgreSQL与MSSQL 有一些差别.