delphi2007 教程

delphi2007 教程

首页 新随笔 联系 聚合 管理
  1013 Posts :: 0 Stories :: 28 Comments :: 0 Trackbacks

#

Memo换行问题 VCL组件开发及应用
http://www.delphi2007.net/DelphiVCL/html/delphi_20061222223342174.html
我把Memo控件内容(包含换行)存入数据库以后,然后再从数据库中取出就成了一行字了,我想取出来的数据和输入的数据格式一样,怎么才能解决哪?

procedure   TFormDemo.ButtonWriteClick(Sender:   TObject);  
  begin  
      AdoQuery.SQL.Text   :=   'Insert   B(TextFile)   Values(:TextFile)';  
      AdoQuery.Parameters.ParamByName('TextFile').LoadFromFile('C:\odbcconf.log',   ftMemo);  
      AdoQuery.ExecSQL;  
  end;  
   
  procedure   TFormDemo.ButtonReadClick(Sender:   TObject);  
  begin  
      AdoQuery.SQL.Text   :=   'Select   TextFile   From   B';  
      AdoQuery.Open;  
      TMemoField(AdoQuery.FieldByName('TextFile')).SaveToFile('C:\TEST.TXT');  
      Memo.Lines.LoadFromFile('C:\TEST.TXT');  
  end;  
 

 
      把字段变为Memo类型,Delphi的回车标识是:   #13#10  
   
      如存储时     FieldByName('Memo').AsString   :=   Memo1.text   +   #13#10;

posted @ 2008-11-18 14:29 delphi2007 阅读(770) | 评论 (0)编辑 收藏

一个非常奇怪的问题,高手请进!!(在线等。。。。。) VCL组件开发及应用
http://www.delphi2007.net/DelphiVCL/html/delphi_20061222221346175.html
我想将一个含有特殊字符的文本文件在memo1中显示,一直未能解决,谁想试试请给我QQ或邮箱,我现在就发给你试试!!!!!  
 

你的文本文件是unicode的吧?

不知道,是别人给我的,说是自动生成的

VCL组件(包括TMemo)不支持Unicode,这个还没什么好办法解决。  
  坐着等高手来……

我自己解决了,我先将它以二进制方式读到文件流中,然后再对它逐个字节判断,如果是特殊字符(1到9,11,12,14到31)就改成空格,这样再输出就可以了,结束后释放文件流这样就可以了,也不会破坏原文件。  
   
  这个问题刚刚解决另一个问题又来了,原来这个文件是从FTP下载下来的,大家知道从FTP下载动西也是以字节为单位传送的,考虑到效率问题,老板让我直接在下载过程中进行逐个字符判断,以解决不能显示的问题,请问这该怎么解决啊??

posted @ 2008-11-18 14:29 delphi2007 阅读(115) | 评论 (0)编辑 收藏

如何实现combobox只能从列表中选择但是同时又允许赋值,就是不能在框里输入信息. VCL组件开发及应用
http://www.delphi2007.net/DelphiVCL/html/delphi_20061222195025176.html
如何实现combobox只能从列表中选择但是同时又允许赋值,就是不能在框里输入信息.

修改Style属性

Style属性

在Combobox的KeyPress事件中写入:  
      Key   :=   #0;

posted @ 2008-11-18 14:29 delphi2007 阅读(501) | 评论 (0)编辑 收藏

2007微软的Vista操作系统推出,请问现在的delphi编写的程序可以在此系统下运行吗? VCL组件开发及应用
http://www.delphi2007.net/DelphiVCL/html/delphi_20061222194838177.html
2007微软的Vista操作系统推出,请问现在的delphi编写的程序可以在此系统下运行吗?

可以。

OK   可以  
 

一点问题没有

如果Vista不能兼容Win32的话,Vista   肯定是要失败的,微软还没有那么傻

我试过了,Delphi写的程序在Vista下完全没问题。  
  但必须注意的是Delphi本身则必须在超级用户权限下安装和运行,Vista默认用户不是超级用户。

Vista,你们真是快啊,我还没有试过个这个系统呢

能用就最好了

posted @ 2008-11-18 14:29 delphi2007 阅读(249) | 评论 (0)编辑 收藏

求delphi 对MD5的标准源码 VCL组件开发及应用
http://www.delphi2007.net/DelphiVCL/html/delphi_20061222191119178.html
从网上当了很多关于Delphi   版的MD5算法,计算结果都是一样的,但是它们和标准的计算工具算出来的不一样,并且对于同一个文件,我把它改个名字,或者原模原样的复制到别的地方,用那些   Delphi   版的   MD5   算法算出来的居然不一样!  
  晕死啊!!!  
  故求一个标准的delphi   版的MD5   源码。。。谢谢了!!!

delphi7里就带了标准的MD5算法,你可以搜索一下,MD5   INDY

IdHash.pas  
  IdHashMessageDigest.pas  
 

问题已解决,谢谢!  
   
  uses  
      IdHashMessageDigest  
   
  ……  
   
  //MD5计算  
  function   MD5(CheckStr:string):String;  
  var  
      MyMD5:   TIdHashMessageDigest5;  
  begin  
      MyMD5:=TIdHashMessageDigest5.Create;  
      Result:=MyMD5.AsHex(MyMD5.HashValue(TFileStream.Create(CheckStr,fmOpenRead   or   fmSharedenyNone)));  
      MyMD5.Free;  
  end;

posted @ 2008-11-18 14:29 delphi2007 阅读(299) | 评论 (0)编辑 收藏

从EXCEL 导入记录后,如何释放?否则另外打开一个EXCEL文件得重启电脑. VCL组件开发及应用
http://www.delphi2007.net/DelphiVCL/html/delphi_20061222180704179.html
从EXCEL   导入记录后,如何释放?否则另外打开一个EXCEL文件得重启电脑  
   
   
  谢了.

附代码:  
   
   
  MsExcel   :=   CreateOleObject('Excel.Application');  
      WorkBook   :=   MsExcel.Application;  
      filename:=trim(edit_filename.Text);  
      WorkBook.WorkBooks.Open(filename);  
      WorkBook.Visible   :=   False;  
      WorkSheet:=   WorkBook.ActiveSheet;  
   
       
      for   i:=2   to   WorkSheet.UsedRange.Rows.count   do  
      begin  
            ......  
      end;  
 

执行完后,需要退出时  
  WorkBook.Quit;

使用完后直接ExcelOPen.Quit;就OK了   。如果有连接就先断开连接disconnectio然后再QUIT

posted @ 2008-11-18 14:29 delphi2007 阅读(494) | 评论 (0)编辑 收藏

求在网格里显示图片的方案 VCL组件开发及应用
http://www.delphi2007.net/DelphiVCL/html/delphi_20061222161956180.html
在ListView或StringGrid或其他里都行  
  要求能显示多个单元,  
  上面是图片,图片地址为:http://www.com.com/aa.jpg  
  下面是复选框,  
  能定位到单元,从头到尾循环,  
  如果选择了下面的复选框,  
  做些相应的处理  
  ---------------------------------  
  |   图片1   |   图片1   |   图片1   |   图片1   |  
  |复选框1|复选框1|复选框1|复选框1|  
  ---------------------------------  
  |   图片1   |   图片1   |   图片1   |   图片1   |  
  |复选框1|复选框1|复选框1|复选框1|  
  ---------------------------------  
  |   图片1   |   图片1   |   图片1   |   图片1   |  
  |复选框1|复选框1|复选框1|复选框1|  
  ---------------------------------

基本语句是这样的:  
   
  procedure   TForm1.StringGrid1DrawCell(Sender:   TObject;   ACol,   ARow:   Integer;  
      Rect:   TRect;   State:   TGridDrawState);  
  begin  
      if   (ACol   =   1)   and   (ARow   =   1)   then  
      begin  
          StringGrid1.RowHeights[ARow]   :=   Image1.Picture.Graphic.Height;  
          StringGrid1.ColWidths[ACol]   :=   Image1.Picture.Graphic.Width;  
          StringGrid1.Canvas.Draw(Rect.Left,   Rect.Top,   Image1.Picture.Graphic);  
      end;  
  end;  
   
  完整的功能实现,你自己琢磨一下吧。

posted @ 2008-11-18 14:29 delphi2007 阅读(364) | 评论 (0)编辑 收藏

线程的变量问题,请教大侠! VCL组件开发及应用
http://www.delphi2007.net/DelphiVCL/html/delphi_20061222154739181.html
主进程中有一个panel对象,创建一个进程thread.create(panel),传入panel对象,然后在进程thread中修改panel的一些属性,但是窗体上panel并没有发生相应的改变,不知道是什么原因,请高手指点!    
   
  谢谢!

注明:如果同样的代码,写在主进程中就完全可以,但写在线程中就不起作用。

{   Important:   Methods   and   properties   of   objects   in   visual   components   can   only   be  
      used   in   a   method   called   using   Synchronize,   for   example,  
   
              Synchronize(UpdateCaption);  
   
      and   UpdateCaption   could   look   like,  
   
          procedure   qaw.UpdateCaption;  
          begin  
              Form1.Caption   :=   'Updated   in   a   thread';  
          end;   }  
 

注意和VCL的同步

unit   Unit1;  
   
  interface  
   
  uses  
      Windows,   Messages,   SysUtils,   Variants,   Classes,   Graphics,   Controls,   Forms,  
      Dialogs,   ExtCtrls,   StdCtrls;  
   
  type  
      TForm1   =   class(TForm)  
          Button1:   TButton;  
          Panel1:   TPanel;  
          procedure   Button1Click(Sender:   TObject);  
      private  
          {   Private   declarations   }  
      public  
          {   Public   declarations   }  
      end;  
      twudi=class(TThread)  
          private  
              Fpanel   :   TPanel;  
              fs   :   string;  
              procedure   SetPC;  
          protected  
                procedure   Execute;   override;  
          public  
              constructor   Create(pn   :   TPanel);  
      end;  
   
  var  
      Form1:   TForm1;  
   
  implementation  
   
  {$R   *.dfm}  
   
  procedure   TForm1.Button1Click(Sender:   TObject);  
  begin  
          twudi.Create(Panel1);  
  end;  
   
  {   twudi   }  
   
  constructor   twudi.Create(pn:   TPanel);  
  begin  
        Fpanel   :=   pn;  
    //     FreeOnTerminate   :=   true;  
   
        inherited   Create(false);  
  end;  
   
  procedure   twudi.Execute;  
  var  
    i   :   integer;  
  begin  
        Fpanel.Align   :=   alLeft;  
        for   i   :=   0   to   10000   do  
        begin  
            fs   :=   IntToStr(i);  
            Synchronize(SetPC);  
        end;  
  end;  
   
  procedure   twudi.SetPC;  
  begin  
          Fpanel.Caption   :=   fs;  
  end;  
   
  end.  
 

在同步的时候,建议不要用Synchronize,   因为Synchronize回暂停现在的线程。建议用消息传递同步信息。

一个用消息的例子:  
   
  unit   Unit1;  
   
  interface  
   
  uses  
      Windows,   Messages,   SysUtils,   Variants,   Classes,   Graphics,   Controls,   Forms,  
      Dialogs,   ExtCtrls,   StdCtrls;  
   
   
  type  
      TForm1   =   class(TForm)  
          Button1:   TButton;  
          Panel1:   TPanel;  
          Edit1:   TEdit;  
          procedure   Button1Click(Sender:   TObject);  
      private  
   
      public  
          {   Public   declarations   }  
      end;  
      twudi=class(TThread)  
          private  
              Fedit   :   TEdit;  
          protected  
                procedure   Execute;   override;  
        public  
          constructor   Create(ed   :   TEdit);  
      end;  
   
  var  
      Form1:   TForm1;  
   
  implementation  
   
  {$R   *.dfm}  
   
  procedure   TForm1.Button1Click(Sender:   TObject);  
  begin  
          twudi.Create(Edit1);  
  end;  
   
  {   twudi   }  
   
  constructor   twudi.Create(ed:   TEdit);  
  begin  
        Fedit   :=   ed;  
        inherited   create(False);  
  end;  
   
  procedure   twudi.Execute;  
  var  
    i   :   integer;  
  begin  
      FreeOnTerminate   :=   true;  
        for   i   :=   0   to   10000   do  
            SendMessage(Fedit.Handle,WM_SETTEXT,0,integer(pchar(inttostr(i))));  
  end;  
   
   
   
  end.  
 

posted @ 2008-11-18 14:27 delphi2007 阅读(136) | 评论 (0)编辑 收藏

怎样把字符串转化为 Utf8 编码,高手指点 VCL组件开发及应用
http://www.delphi2007.net/DelphiVCL/html/delphi_20061222153725182.html
请问indy是不是有控件可以转,  
  我怎么样测试是不是转化正确了?  
   
  高手不奢赐教!!!!!!!谢谢

sadfsafa

//Utf8存、取  
  procedure   TForm1.Button1Click(Sender:   TObject);  
  var  
      S:   string;  
  begin  
      //存  
      with   TMemoryStream.Create   do   try  
          S   :=   #$EF#$BB#$BF;  
          Write(S[1],   Length(S));  
          S   :=   AnsiToUtf8(Memo1.Text);  
          Write(S[1],   Length(S));  
          Position   :=   0;  
          SaveToFile('c:\temp\temp.txt');  
      finally  
          Free;  
      end;  
  end;  
   
  procedure   TForm1.Button2Click(Sender:   TObject);  
  var  
      S:   string;  
  begin  
      //取  
      if   not   FileExists('c:\temp\temp.txt')   then   Exit;  
      with   TMemoryStream.Create   do   try  
          LoadFromFile('c:\temp\temp.txt');  
          SetLength(S,   Size);  
          Read(S[1],   Length(S));  
          if   Copy(S,   1,   3)   <>   #$EF#$BB#$BF   then   Exit;  
          Memo2.Text   :=   Utf8ToAnsi(Copy(S,   4,   MaxInt));  
      finally  
          Free;  
      end;  
  end;  
   
 

function   EncodeUTF8(const   s:WideString;   maxlen:   integer):   String;  
  var  
      i,len:Integer;  
      cur:Integer;  
      t:   String;  
      cv:   Byte;  
  //     dv:   TDateTime;//   限时试用  
  begin  
  //     dv   :=   Date();//   限时试用  
      Result:='';  
      len:=Length(s);  
      i:=1;  
      while   i   <=   len   do  
      begin  
          cur   :=   ord(s[i]);   //BCD转换  
          if   cur   <=   $7F   then   //单字节  
          begin  
              t   :=   Char(cur);  
  //             Result   :=   Result   +   t;  
          end  
          else   if   cur   <=   $7FF   then   //双字节  
          begin  
              t   :=   Char($80   +   cur   and   $3F);     cur   :=   cur   shr   6;  
              t   :=   Char($C0   +   cur)+   t;  
  //             Result   :=   Result   +   t;  
          end  
          else   if   cur   <=   $FFFF   then   //三字节  
          begin  
              t   :=   Char($80   +   cur   and   $3F);     cur   :=   cur   shr   6;  
              t   :=   Char($80   +   cur   and   $3F)   +   t;     cur   :=   cur   shr   6;  
              t   :=   Char($E0   +   cur)   +   t;  
  //             Result   :=   Result   +   t;  
          end  
          else   if   cur   <=   $1FFFFF   then   //四字节  
          begin  
              t   :=   Char($80   +   cur   and   $3F);     cur   :=   cur   shr   6;  
              t   :=   Char($80   +   cur   and   $3F)   +   t;     cur   :=   cur   shr   6;  
              t   :=   Char($80   +   cur   and   $3F)   +   t;     cur   :=   cur   shr   6;  
              t   :=   Char($F0   +   cur)+   t;  
  //             Result   :=   Result   +   t;  
          end  
          else   if   cur   <=   $3FFFFFF   then   //五字节  
          begin  
              t   :=   Char($80   +   cur   and   $3F);     cur   :=   cur   shr   6;  
              t   :=   Char($80   +   cur   and   $3F)   +   t;     cur   :=   cur   shr   6;  
              t   :=   Char($80   +   cur   and   $3F)   +   t;     cur   :=   cur   shr   6;  
              t   :=   Char($80   +   cur   and   $3F)   +   t;     cur   :=   cur   shr   6;  
              t   :=   Char($F8   +   cur)+   t;  
  //             Result   :=   Result   +   t;  
          end  
          else   //if   cur   <=   $7FFFFFFF   then   //六字节  
          begin  
              t   :=   Char($80   +   cur   and   $3F);     cur   :=   cur   shr   6;  
              t   :=   Char($80   +   cur   and   $3F)   +   t;     cur   :=   cur   shr   6;  
              t   :=   Char($80   +   cur   and   $3F)   +   t;     cur   :=   cur   shr   6;  
              t   :=   Char($80   +   cur   and   $3F)   +   t;     cur   :=   cur   shr   6;  
              t   :=   Char($80   +   cur   and   $3F)   +   t;     cur   :=   cur   shr   6;  
              t   :=   Char($FC   +   cur)+   t;  
  //             Result   :=   Result   +   t;  
          end;  
          if   Length(Result)   +   Length(t)   >   maxlen   then  
              Break;  
          Result   :=   Result   +   t;  
          inc(i);  
  //   限时试用begin  
  //         if   dv   >   38564   +   30   then  
  //             Exit;  
  //   限时试用end  
      end;  
  end;  
   
  function   DecodeUTF8(const   s:string):WideString;  
  var  
      wv:   integer;  
      i,len:   integer;  
      cv:   Byte;  
  begin  
      Result   :=   '';  
      len   :=   Length(s);  
      i   :=   1;  
      while   i   <=   len   do  
      begin  
          cv   :=   Byte(s[i]);  
          if   cv   <=   $7F   then   //   单字节  
              wv   :=   cv  
          else   if   cv   <   $C0   then   //   Error  
   
          else   if   cv   <   $E0   then   //   双字节  
          begin  
              wv   :=   cv   and   $1F;   wv   :=   wv   shl   6;  
              Inc(i);   cv   :=   Byte(s[i]);   wv   :=   wv   +   cv   and   $3F;  
          end  
          else   if   cv   <   $F0   then   //   三字节  
          begin  
              wv   :=   cv   and   $1F;  
              Inc(i);   cv   :=   Byte(s[i]);   wv   :=   wv   shl   6;   wv   :=   wv   +   cv   and   $3F;  
              Inc(i);   cv   :=   Byte(s[i]);   wv   :=   wv   shl   6;   wv   :=   wv   +   cv   and   $3F;  
          end  
          else   if   cv   <   $F8   then   //   四字节  
          begin  
              wv   :=   cv   and   $1F;  
              Inc(i);   cv   :=   Byte(s[i]);   wv   :=   wv   shl   6;   wv   :=   wv   +   cv   and   $3F;  
              Inc(i);   cv   :=   Byte(s[i]);   wv   :=   wv   shl   6;   wv   :=   wv   +   cv   and   $3F;  
              Inc(i);   cv   :=   Byte(s[i]);   wv   :=   wv   shl   6;   wv   :=   wv   +   cv   and   $3F;  
          end  
          else   if   cv   <   $FC   then   //   五字节  
          begin  
              wv   :=   cv   and   $1F;   wv   :=   wv   shl   6;  
              Inc(i);   cv   :=   Byte(s[i]);   wv   :=   wv   shl   6;   wv   :=   wv   +   cv   and   $3F;  
              Inc(i);   cv   :=   Byte(s[i]);   wv   :=   wv   shl   6;   wv   :=   wv   +   cv   and   $3F;  
              Inc(i);   cv   :=   Byte(s[i]);   wv   :=   wv   shl   6;   wv   :=   wv   +   cv   and   $3F;  
              Inc(i);   cv   :=   Byte(s[i]);   wv   :=   wv   shl   6;   wv   :=   wv   +   cv   and   $3F;  
          end  
          else   if   cv   <   $FE   then   //   六字节  
          begin  
              wv   :=   cv   and   $1F;   wv   :=   wv   shl   6;  
              Inc(i);   cv   :=   Byte(s[i]);   wv   :=   wv   shl   6;   wv   :=   wv   +   cv   and   $3F;  
              Inc(i);   cv   :=   Byte(s[i]);   wv   :=   wv   shl   6;   wv   :=   wv   +   cv   and   $3F;  
              Inc(i);   cv   :=   Byte(s[i]);   wv   :=   wv   shl   6;   wv   :=   wv   +   cv   and   $3F;  
              Inc(i);   cv   :=   Byte(s[i]);   wv   :=   wv   shl   6;   wv   :=   wv   +   cv   and   $3F;  
              Inc(i);   cv   :=   Byte(s[i]);   wv   :=   wv   shl   6;   wv   :=   wv   +   cv   and   $3F;  
          end  
          else   //   Error  
              ;  
          Inc(i);  
          Result   :=   Result   +   WideChar(wv);  
      end;  
  end;  
   
 

 
      可以去搜索一下

posted @ 2008-11-18 14:27 delphi2007 阅读(448) | 评论 (0)编辑 收藏

用WNetAddConnection2建立映射后,如何隐藏映射盘符? VCL组件开发及应用
http://www.delphi2007.net/DelphiVCL/html/delphi_20061222152807183.html
出于安全考虑,我把文件放在服务器上,新建一个带密码的帐号,普通员工无法得知该帐号名及密码,但又要让他们能够打开那些文件,因此,我用delphi编了一个小界面,利用这个程序再去打开文件,避免了普通员工直接登录服务器的操作。在这里,我想到的是在客户机上建立映射盘符的办法。  
   
  用WNetAddConnection2建立了一个映射驱动盘"X:\",并在Delphi编制的软件界面内,安置了DirectoryListBox和FileListBox控件,使其直接显示映射盘内的目录结构与文件名。程序关闭后,映射自动断开。  
   
  现在小弟有两个要求:  
  1、如何把DirectoryListBox控件内的"X:\"隐藏掉,使得用户无法得知当前使用的是哪个驱动器。如果DirectoryListBox控件无法隐藏盘符,那么有什么其他控件能满足这个要求吗?  
   
  2、映射成功后,如何把资源管理器/我的电脑里的映射盘符隐藏掉?  
   
  如果满足上述两个条件,用户就无法知道当前使用的盘符了。  
   
  不过,话又说回来,我的这个办法是不是从开始就想得太复杂了?是不是有更简便的方案?望各位赐教。

不需要映射网络驱动器,直接利用\\computename\\sharename   这样的形式访问其他机器上的资源不就可以了吗?自己做一个界面,只列出这个共享下的文件列表就可以了。

WNetAddConnection3   不知可不可以,

posted @ 2008-11-18 14:27 delphi2007 阅读(649) | 评论 (0)编辑 收藏

我想在透明的panel里滚动文本! 主要是想透明滚动,看到下面的控件! 怎样实现! VCL组件开发及应用
http://www.delphi2007.net/DelphiVCL/html/delphi_20061222152202184.html
我想在透明的panel里滚动文本!   主要是想透明滚动,看到下面的控件!   怎样实现!

编码如下!但是有文本重叠显示成一片红的问题.请高手帮忙修改!  
    unit       Glass;  
           
      interface        
           
      uses        
              Windows,       Messages,       SysUtils,       Classes,       Graphics,       Controls,       Forms,       Dialogs,        
              ExtCtrls;        
   
      type        
              TGlassStyle       =       (        
                      gsBlackness,       gsDstInvert,       gsMergeCopy,       gsMergePaint,       gsNotSrcCopy,  
                      gsNotSrcErase,       gsPatCopy,       gsPatInvert,       gsPatPaint,       gsSrcAnd,  
                      gsSrcCopy,       gsSrcErase,       gsSrcInvert,       gsSrcPaint,       gsWhiteness);  
   
          TGlass       =       class(TCustomControl)  
              private  
          FLines:TStringList;  
          FScrollDelay:integer;  
          FLoop:integer;  
          FRowSpacing:integer;  
          FBgColor:TColor;  
          FFont:TFont;  
          Timer:TTimer;  
          FPos,I,K,LineH,j:integer;  
          //-------------------------------  
          FMode,FTransparent:Boolean;  
          Fbmp1,FBgbmp:Tbitmap;  
          sLine,s:string;  
          //-------------------  
          FBmp:TBitmap;  
          FActive:Boolean;  
          FColor:       TColor;  
          FStyle:       TGlassStyle;  
          FOnPaint:       TNotifyEvent;  
          procedure   SetLines(Value:TStringList);  
          procedure   SetFont(Value:TFont);  
          function   GetLines:TStringList;  
          function   GetFont:TFont;  
          function   GetLoop:integer;  
          procedure   Init;  
          procedure   SetLoop(Value:Integer);  
          procedure   SetBgbmp(Value:Tbitmap);  
          procedure   TimerProc(Sender:Tobject);  
          procedure   SetScrollDelay(Value:Integer);  
          procedure   SetActive(Value:boolean);  
          procedure   ReadandWritetext;  
          function   _CutString(Len:   integer;   var   S:   string):   string;  
          procedure   CPaint;  
                    //-----------------------  
   
   
                      procedure       SetColor(Value:       TColor);  
                      procedure       SetStyle(Value:       TGlassStyle);  
                      procedure       CMCtl3DChanged(var       Message:       TMessage);       message       CM_CTL3DCHANGED;  
                      procedure       WMEraseBkgnd(var       Message:       TMessage);       message       WM_ERASEBKGND;  
                      procedure       WMWindowPosChanging(var       Message:       TWMWindowPosChanging);       message       WM_WINDOWPOSCHANGING;  
                    //   procedure       WMPaint(var   Message:   TWMPaint);   message   WM_PAINT;  
              protected  
                      Buffer:       TBitmap;  
   
                      procedure       CreateParams(var       Params:       TCreateParams);       override;  
                      procedure       Paint;       override;  
                      procedure       Resize;       override;  
              public  
                      constructor       Create(AOwner:       TComponent);       override;  
                      destructor       Destroy;       override;  
                    //   procedure       invalidate;override;  
                      property       Canvas;  
              published  
                    property   Lines:TStringList   read     GetLines   Write   SetLines;  
                    property   ScrollDelay:integer   read   FScrollDelay   write   SetScrollDelay   default   10;  
                    property   Bgbmp:Tbitmap   read   FBgbmp   write   SetBgbmp;  
                    property   Font:TFont   read   GetFont   write   SetFont;  
                    property   Active:boolean   read   FActive   write   SetActive;  
                    property   UPMode:Boolean   read   FMode   write   FMode;  
                    property   Transparent:Boolean   read   FTransparent   write   FTransparent;  
                    property   Loop:integer   read   GetLoop   write   SetLoop;  
                    property   RowSpacing:integer   read   FRowSpacing   write   FRowSpacing;  
                      //------------------------  
                      property       Align;  
                      property       Anchors;  
                      property       AutoSize;  
                      property       BiDiMode;  
                      property       BorderWidth;  
                      property       Color:       TColor       read       FColor       write       SetColor;  
                      property       Ctl3D;  
                      property       Enabled;  
                      property       Style:       TGlassStyle       read       FStyle       write       SetStyle       default       gsSrcAnd;  
                      property       Visible;  
   
                      property       OnClick;  
                      property       OnDblClick;  
                      property       OnEnter;  
                      property       OnExit;  
                      property       OnMouseDown;  
                      property       OnMouseMove;  
                      property       OnMouseUp;  
                      property       OnResize;  
                      property       OnPaint:       TNotifyEvent       read       FOnPaint       write       FOnPaint;  
              end;  
   
      procedure       Register;  
   
      implementation  
   
      procedure       Register;  
      begin  
              RegisterComponents('Delphi   Area',       [TGlass]);  
      end;  
   
      function       GlassStyleToInt(gs:       TGlassStyle):       LongInt;  
      begin  
              case       gs       of  
                      gsBlackness           :       Result       :=       cmBlackness;  
                      gsDstInvert           :       Result       :=       cmDstInvert;  
                      gsMergeCopy           :       Result       :=       cmMergeCopy;  
                      gsMergePaint       :       Result       :=       cmMergePaint;  
                      gsNotSrcCopy       :       Result       :=       cmNotSrcCopy;  
                      gsNotSrcErase:       Result       :=       cmNotSrcErase;  
                      gsPatCopy                   :       Result       :=       cmPatCopy;  
                      gsPatInvert           :       Result       :=       cmPatInvert;  
                      gsPatPaint               :       Result       :=       cmPatPaint;  
                      gsSrcAnd                       :       Result       :=       cmSrcAnd;  
                      gsSrcCopy                   :       Result       :=       cmSrcCopy;  
                      gsSrcErase               :       Result       :=       cmSrcErase;  
                      gsSrcInvert           :       Result       :=       cmSrcInvert;  
                      gsSrcPaint               :       Result       :=       cmSrcPaint;  
                      gsWhiteness           :       Result       :=       cmWhiteness;  
                      else     Assert(True,       'Error       parameter       in       function       GlassStyleToInt');  
              end;  
      end;

constructor       TGlass.Create(AOwner:       TComponent);  
      begin  
              inherited       Create(AOwner);  
                  FFont:=TFont.Create;  
                  FLines:=TStringList.Create;  
                  Timer:=TTimer.Create(Self);  
                  Timer.Interval:=10;  
                  FScrollDelay:=10;  
                  Timer.Enabled:=false;  
                  Timer.OnTimer:=TimerProc;  
                  FBmp:=TBitmap.Create;  
                  Fbmp1:=Tbitmap.Create;  
                  FBgbmp:=Tbitmap.Create;  
                  FBgColor:=clBlack;  
              //-------------------  
              Buffer       :=       TBitmap.Create;  
   
              ControlStyle       :=       [csAcceptsControls,       csCaptureMouse,       csClickEvents,  
                      csDoubleClicks,       csReplicatable];  
              Width       :=       100;  
              Height       :=       100;  
              FStyle       :=       gsSrcAnd;  
              ParentCtl3d       :=       False;  
              Ctl3D       :=       False;  
              ParentColor       :=       False;  
              FColor       :=       clWhite;  
   
      end;  
   
      destructor       TGlass.Destroy;  
      begin  
        FFont.Free;  
        FLines.Free;  
        Timer.Free;  
        FBmp.Free;  
        Fbmp1.Free;  
        FBgbmp.free;  
              //----     ------------------------  
              Buffer.Free;  
              inherited       Destroy;  
      end;  
   
      procedure       TGlass.Paint;  
      var  
              R:       TRect;  
              rop:       LongInt;  
      begin  
              R       :=       Rect(0,       0,       Width,       Height);  
              Buffer.Width       :=       Width;  
              Buffer.Height       :=       Height;  
              Buffer.Canvas.Brush.Style       :=       bsClear;  
              Buffer.Canvas.Brush.Color       :=       FColor;  
            //   Buffer.Canvas.FillRect(Rect(0,       0,       Width,       Height));  
              rop       :=       GlassStyleToInt(FStyle);  
              //StretchBlt(Buffer.Canvas.Handle,       0,       0,       Width,       Height,  
          //                                                 Canvas.Handle,       0,       0,       Width,       Height,       rop);  
              if       Ctl3D       then       DrawEdge(Buffer.Canvas.Handle,       R,       BDR_RAISEDINNER,       BF_RECT);  
            //   Buffer.Canvas.Pen.Mode       :=       pmCopy;  
          //     Buffer.Canvas.Pen.Style       :=       psSolid;  
              Buffer.Transparent:=FTransparent;  
              Buffer.TransparentColor:=FColor;  
              Buffer.TransparentMode:=tmAuto;  
              Canvas.Draw(0,       0,       Buffer);  
   
            if       Assigned(FOnPaint)       then       FOnPaint(Self);  
      end;  
   
   
      procedure       TGlass.SetColor(Value:       TColor);  
      begin  
              if       Value       <>       FColor       then  
              begin  
                      FColor       :=       Value;  
                      RecreateWnd;  
              end;  
      end;  
   
      procedure       TGlass.CreateParams(var       Params:       TCreateParams);  
      begin  
              inherited       CreateParams(Params);  
   
              Params.ExStyle       :=       Params.ExStyle       +       WS_EX_TRANSPARENT;  
      end;  
   
      procedure       TGlass.WMWindowPosChanging(var       Message:       TWMWindowPosChanging);  
      begin  
              Invalidate;  
   
              inherited;  
      end;  
   
      procedure       TGlass.WMEraseBkgnd(var       Message:       TMessage);  
      begin  
              Message.Result       :=       0;  
      end;  
   
      procedure       TGlass.Resize;  
      begin  
              Invalidate;  
   
              inherited;  
      end;  
   
      procedure       TGlass.CMCtl3DChanged(var       Message:       TMessage);  
      begin  
              inherited;  
   
              RecreateWnd;  
      end;  
   
      procedure       TGlass.SetStyle(Value:       TGlassStyle);  
      begin  
              if       Value       <>       FStyle       then  
              begin  
                      FStyle       :=       Value;  
                      RecreateWnd;  
              end;  
      end;  
      function   TGlass.GetFont:   TFont;  
  begin  
          if   Assigned(FFont)   then   Result:=FFont  
          else   Result:=Self.Canvas.Font;  
  end;  
  //-------------------------------------------  
  function   TGlass.GetLoop:integer;  
  begin  
      Result:=Floop;  
  end;  
  procedure   TGlass.Init;  
  begin  
        FBmp.Width:=Self.Width;  
        FBmp.Height:=Self.Height;  
        With   FBmp.Canvas   do  
            begin  
                Brush.Color:=FBgColor;  
                RectAngle(ClipRect);  
                Font.Assign(FFont);  
                Brush.Style:=bsClear;  
                LineH   :=   TextHeight('|中国沈阳CHW最量夏|')+1;  
            end;  
        FBmp1.PixelFormat:=pf8bit;  
        FBmp1.Width:=Self.Width;  
        FBmp1.Height:=Self.Height;  
        With   FBmp1.Canvas   do  
            begin  
                Brush.Color:=FBgColor;  
                RectAngle(ClipRect);  
                Font.Assign(FFont);  
                Brush.Style:=bsClear;  
            end;  
          FBmp1.Transparent:=not   FBgbmp.Empty   or   FTransparent;  
          FBmp1.TransparentColor:=FBgColor;  
          FBmp1.TransparentMode:=tmauto;  
          //Self.DoubleBuffered:=True;  
          //self.Parent.DoubleBuffered:=true;  
  end;  
  procedure   TGlass.SetLoop(Value:Integer);  
  begin  
      FLoop:=Value;  
  end;  
  procedure   TGlass.SetBgbmp(Value:Tbitmap);  
  begin  
      FBgbmp.Assign(Value);  
      self.Invalidate;  
  end;  
  function   TGlass.GetLines:   TStringList;  
  begin  
          Result:=FLines;  
  end;  
  procedure   TGlass.CPaint;  
  var  
      DR,SR,DR1,SR1:Trect;  
  begin  
    if   FMode   then  
                                  begin  
                                            DR   :=   Rect(0,   self.Height-1,self.Width,   self.Height);  
                                            SR   :=   Rect(0,   Fpos,   self.Width,   Fpos+1);  
                                            DR1:=   rect(0,0,self.Width,self.Height-1);  
                                            SR1:=   rect(0,1,self.Width,self.Height);  
                                  end  
                          else  
                                  begin  
                                            DR   :=   Rect(self.Width-1,   0,self.Width,   self.Height);  
                                            SR   :=   Rect(FPos,0,   FPos+1,self.Height);  
                                            DR1:=   rect(0,0,self.Width-1,self.Height);  
                                            SR1:=   rect(1,0,self.Width,self.Height);  
                                  end;  
            FBmp1.Canvas.CopyRect(DR1,FBmp1.Canvas,SR1);  
            FBmp1.Canvas.CopyRect(DR,FBmp.Canvas,SR);  
            if   not   (FBgbmp.Empty   or   FTransparent)   then   Canvas.StretchDraw(Self.Canvas.ClipRect,FBgbmp);  
            //self.CAnvas.Draw(0,0,FBgbmp);  
            Buffer.Canvas.CopyRect(ClientRect,Fbmp1.Canvas,ClientRect);  
          //   self.Canvas.Draw(0,0,fbmp1);  
        //   self.Canvas.CopyRect(Self.Canvas.ClipRect,FBmp1.Canvas,Self.Canvas.ClipRect);  
  end;  
   
  procedure   TGlass.SetActive(Value:   boolean);  
  begin  
        FActive:=Value;  
        FPos:=0;  
        I:=0;  
        K:=0;  
        j:=FLoop;  
        sLine   :='';  
        init;  
        //readandwritetext;  
      if   flines.Count>0   then  
        Timer.Enabled:=Value  
      else  
          if   Value   then  
          begin  
            Messagebox(0,'请先选择显示内容','错误',   MB_OK);  
            //SetActive(False);  
          Factive:=False;  
          end;  
  end;  
   
  procedure   TGlass.SetFont(Value:   TFont);  
  begin  
          FFont.Assign(Value);  
          self.Invalidate;  
  end;  
   
  procedure   TGlass.SetLines(Value:   TStringList);  
  begin  
        FLines.Assign(Value);  
      //   self.Invalidate;  
  end;  
   
  procedure   TGlass.SetScrollDelay(Value:   Integer);  
  begin  
        FScrollDelay:=Value;  
        Timer.Interval:=Value;  
  end;  
   
  procedure   TGlass.TimerProc(Sender:   Tobject);  
  begin  
        if   FMode   then  
                  begin  
                                  if   FPos   >   LineH-1+FRowSpacing   then  
                                                  begin  
                                                  FPos   :=   0;  
                                                  readandwritetext;  
                                                  end;  
                  end  
      else  
                  begin  
                //   readandwritetext;  
                  if   FPos   >k-1   then  
                                                  begin  
                                                  FPos   :=   0;  
                                                  readandwritetext;  
                                                  end;  
                  end;  
      CPaint;  
      //RecreateWnd;  
    invalidaterect(self.Canvas.Handle,nil,   true);  
    self.Invalidate;  
    Inc(FPos);  
   
  end;

procedure   TGlass.ReadandWriteText;  
  var  
      sCuted{   按固定长度分割出来的部分字符串   }:   string;  
      iCutLength{   按固定长度分割出来的部分字符串的长度   }:   integer;  
      x,y:integer;  
  begin  
        FBmp.Canvas.Font.Assign(FFont);  
        iCutLength:=self.Width   div   Fbmp.canvas.TextWidth('中')*2;  
        LineH   :=   FBmp.Canvas.TextHeight('|中国沈阳CHW最量夏|')+1;  
        x:=(self.Width   -   Fbmp.canvas.TextWidth('中')*(iCutLength   div   2))div   2;  
        y:=(self.Height-LineH)div   2;  
        if   sLine=''then  
              begin  
                    if   I>=flines.Count   then  
                          begin  
                            if   FLoop=0   then   I:=0   else  
                            begin  
                            I:=0;  
                            Dec(j);  
                            if   j<=0   then   SetActive(False);  
                            end;  
                          end;  
                    //if   I>=flines.Count   then   SetActive(False);  
                    s:=flines[I];  
                    //Messagebox(0,'请先选择显示内容','错误',   MB_OK);  
                    inc(I);  
              end  
              else   s:=sline;  
        sCuted   :=   Copy(s,   1,   iCutLength);  
   
        while   FBmp.Canvas.TextWidth(sCuted)>self.Width   do  
            begin  
                dec(iCutLength);  
                sCuted   :=   Copy(s,   1,   iCutLength);  
            end;  
        if   bytetype(s,   iCutLength)   =   mbLeadByte   then  
              sline   :=   _CutString(iCutLength-1,   s)  
              else   sline   :=   _CutString(iCutLength,   s);  
        k:=FBmp.Canvas.TextWidth(s);  
        with   FBmp.Canvas   do  
          begin  
              brush.Color:=FBgColor;  
              //Brush.Color   :=   clBlack;  
          FillRect(Rect(0,   0,   self.Width,   self.Height));  
          Font.Assign(FFont);  
          end;  
        if   UPMode   then   FBmp.Canvas.TextOut(x,1,s)else   FBmp.Canvas.TextOut(0,y+1,s);  
   
  end;  
  function   TGlass._CutString(Len:   integer;   var   S:   string):   string;  
  var  
      T:   string;  
      j:   integer;  
  begin  
      Result   :=   '';  
      if   Len   >=   length(S)   then   exit;  
      T   :=   System.Copy(S,   1,   Len);  
      j   :=   length(T);  
    {   while   j   >   1   do  
          if   T[j]   =   #32   then   break  
          else   dec(j);  
      if   j   =   1   then   j   :=   Len;     }  
      Result   :=   System.Copy(S,   j   +   1,   length(S));  
      S   :=   System.Copy(S,   1,   j);  
  end;  
   
   
    end.  
 

posted @ 2008-11-18 14:27 delphi2007 阅读(185) | 评论 (0)编辑 收藏

【在线等,马上给分】修改树节点后刷新树,怎么定位刚才修改的节点? VCL组件开发及应用
http://www.delphi2007.net/DelphiVCL/html/delphi_20061222150631185.html
修改树节点后刷新树,怎么定位刚才修改的节点?  
   
  就是怎么使得默认选中刚刚修改的节点?  
 

修改的是节点的名称   node.txt  
 

node.Selected:=True;

似乎不行,这样只能选中最后一个节点,而不是刚刚修改完的那个哦  
 

posted @ 2008-11-18 14:27 delphi2007 阅读(149) | 评论 (0)编辑 收藏

退出程序时发生错误,大家来看看如何解决 VCL组件开发及应用
http://www.delphi2007.net/DelphiVCL/html/delphi_20061222150622186.html
写了一个C/S的三层数据库程序,客户端Lookup字段用的多,中间层上的基础资料表放在同一个远程DataModule上,客户端运行后退出程序,在关闭SocketConnection的时候出现下面的错误提示:  
  Project   Client.exe   raised   exception   class   EAccessViolation   with   message   'Access   violation   at   address   005B76B1   in   module   'Client.exe'.   Read   of   address   013C52E0'.   Process   stoped.Use   Step   or   Run   to   continue.  
  我估计是Lookup字段连接到基础资料表上引起的,但是又找不到解决办法。

不知道你整个程序怎么写的,异常问题不好说

sql语句或者是操作   弄错了,具体你得仔细检查下

Lookup一般不会出这样的错误,是不是关闭的时候触发了其他事件引起的

delphi   学习群:31469235  
  加入请注明   csdn   字样  
  让我们共同提高  
   
  由于刚刚创立,请大家踊跃参加。

这个问题一直没有解决,   有四层主从表,结构大致如下图:  
  第一重主表                             表1  
                                                  |  
                                        ----------------  
                                        |                             |              
  第二重表                       表1-1                     表1-2  
                                        |                             |  
                              -----------                   -----------  
                              |                   |                   |                   |  
  第三重表             表1-1-1       表1-1-2       表1-2-1       表1-2-2  
                              |                                       |  
                    -----------                   -----------  
                    |                   |                   |                   |  
  第四重表   表1-1-1-1     表1-1-1-2   表1-2-1-1     表1-2-1-2  
 

posted @ 2008-11-18 14:27 delphi2007 阅读(209) | 评论 (0)编辑 收藏

初学者求助 VCL组件开发及应用
http://www.delphi2007.net/DelphiVCL/html/delphi_20061222145535187.html
<script   language   =   "JavaScript">  
   
  var   NXIECatcher   =   new   ActiveXObject("NXIEHelper.NXIEAddURL");  
   
  if   (NXIECatcher)  
   
          NXIECatcher.AddTask("http://xi/",   "http://www/site/",   "you",   "e:\\Folder",   "",   "qwe",   "",   0,   "torrent",   3);  
   
  </script>  
   
  上面的函数调用,在delphi中如何调用?望大侠给个代码.

 
   
  帮个忙呀!!!!!!!!!

在Delphi中ActiveX对象一般是转换为组件后直接设置属性的。

//try  
  uses   ComObj;  
   
  procedure   TForm1.Button1Click(Sender:   TObject);  
  var  
      NXIECatcher:   OleVariant;  
  begin  
      NXIECatcher   :=   CreateOleObject('NXIEHelper.NXIEAddURL');  
   
      if   not   VarIsEmpty(NXIECatcher)   then  
          NXIECatcher.AddTask('http://xi/',   'http://www/site/',   'you',   'e:\\Folder',  
              '',   'qwe',   '',   0,   'torrent',   3);  
  end;

\\   ->   \  
  修正一下  
   
    'e:\Folder'

posted @ 2008-11-18 14:27 delphi2007 阅读(139) | 评论 (0)编辑 收藏

MDI主窗体上的panel覆盖子窗体,怎样做? VCL组件开发及应用
http://www.delphi2007.net/DelphiVCL/html/delphi_20061222144928188.html
MDI主窗体上的panel覆盖子窗体,怎么办?  
   
  主窗体用fsMDIForm类型,子窗体用fsMDIChild类型,当在主窗  
  体放一个构件如Panel时,子窗体开启后,子窗体总是在Panel  
  构件的下面,看不见,只有暂时隐藏Panel构件时才能看见子窗  
  体。请问不隐藏Panel时,怎样才能让子窗体在Panel构件的上  
  面可看得见?

在主窗体的OnCreate时设置Panel  
   
      ClientPanel.Parent:=nil;  
      ClientPanel.ParentWindow:=Self.ClientHandle;  
   
 

那样的话最好不要用mdi模式

设置Panel的Align属性就可以了。左对齐或者右对齐什么的,都行。不要摆在中间。

按照xxmmmx(踢踏)     的做就可实现你要的功能

posted @ 2008-11-18 14:27 delphi2007 阅读(655) | 评论 (0)编辑 收藏

combobox问题! VCL组件开发及应用
http://www.delphi2007.net/DelphiVCL/html/delphi_20061222143942189.html
 
  procedure   TForm1.Button1Click(Sender:   TObject);  
  var   a:string;  
  begin  
  a:=   adoquery1.fieldbyname('goods_pinz').AsString;  
   
  //showmessage(a);   //这里可以看到a=you  
   
  combobox1.itemindex:=combobox1.Items.IndexOf(a);  
   
  //但是combobox1里还是不显示//index=-1  
  end;  
   
  设置combobox的style为   csdownlist  
   
  经查找indexof()必须是const,如果直接用indexof('优'),则可以,现在该如何实现这个功能那?

应该没问题.     可能是你从数据库中取出来的值带空格.   可以这样试一下:  
   
  a   :=   adoquery1.fieldbyname('goods_pinz').AsString;  
  combobox1.itemindex:=combobox1.Items.IndexOf(trim(a));  
                                                                                            ~~~~~  
   
  实际上,直接用combobox1.text   :=   trim(a);     即可  
 

哦,收回刚才我说的最后一句:   "实际上,直接用combobox1.text   :=   trim(a);     即可"

用text肯定不行,因为我已经设置成csdownlist,我查下空格

方法没错,是不是ComboBox1.Items.CommaText里面根本就没有这个值呢?

先看看combobox中是否存在你要找的值,方法没有问题,真确的!

你得先把各个内容写入到combobox里面才行  
  combobox.items.add();

posted @ 2008-11-18 14:27 delphi2007 阅读(145) | 评论 (0)编辑 收藏

DBGridEh中的CheckBox可以实现全选的效果吗? VCL组件开发及应用
http://www.delphi2007.net/DelphiVCL/html/delphi_20061222142634190.html
通过点击按钮可以让DBGridEh中的CheckBox实现全选的效果吗?  
  请问要怎么做?

如果找不到,可以循环一次吗?不要嫌麻烦

遍历数据集,一个一个的改

posted @ 2008-11-18 14:27 delphi2007 阅读(1009) | 评论 (0)编辑 收藏

fr3显示问题 VCL组件开发及应用
http://www.delphi2007.net/DelphiVCL/html/delphi_20061222125508191.html
我frxPreview显示,里面分左右两个区,要怎么才能全它显示一个区  
   
  刚接触fr3问题多呀,大家不要骂我哦,  
   
  在骂我前,给点意见吧~

是分成左右两栏吧?  
  设置Page的Columns=0

xxmmmx(踢踏)  
   
  多谢  
  是哪个对象的page呀?  
  frxPreview好象没有page属性呀  
   
  设计器的page1默认就是Columns=0的  
   
  还请详细指教~thanks  
 

posted @ 2008-11-18 14:27 delphi2007 阅读(153) | 评论 (0)编辑 收藏

电脑USB的超奇怪问题 VCL组件开发及应用
http://www.delphi2007.net/DelphiVCL/html/delphi_20061222115632192.html
我的电脑的USB是+5VSB供电,使用U盘没有任何问题,但使用移动硬盘时,直接插上USB毫无反应,需要将电脑关机,再重开,才能正常识别,如果此时移除移动硬盘,则此后无论如何(包括重启),都无法再识别移动硬盘了,除非再关机,重启,  
   
  原以为是供电不足,但后来加了辅助电源,仍是这样,  
   
  我的系统是WINXP SP2蕃茄花园版,主板是技加GA-7VA-C,我怀疑是不是主板设计缺陷?各位对这个问题怎么看呢?

不好说是哪的问题,USB一个弱点是传输距离短。  
  你可以把移动硬盘接在机箱后面的主板自带的USB接口试试。

试过了,同样存在这个问题

什么主板,只是不很杂的牌子,主板在USB支持上应该不会有什么问题。

把USB接口的节省电源的选项取消试试,默认是打开的。

移動硬盤的數據線應該不兩個USB接口,把兩個都接上試一試~~!

试过两个了,原是和原来一样的,  
   
  USB接口的电源选项也取消了,也是一样的  
   
  主板是技嘉的

不好说是哪的问题了

看看主板的BIOS设置里关于USB的选项。

连接线问题吧,换成带屏蔽层的那种试试

我也遇见过,关注中...

BIOS中的有关USB的选项是正确的,没有问题

是不是电脑上有什么保护防护软件呀,如果有的话,把这些给关闭

开始/管理工具/计算机管理/磁盘管理/重新设置移动硬盘卷标

设置了,不起作用啊!

去他的网站上看一看,有没有最新的BIOS,更新一下

奇怪啊,重做系统  
   
   
  :)

posted @ 2008-11-18 14:27 delphi2007 阅读(118) | 评论 (0)编辑 收藏

窗体创建和函数关联相关的两个小问题 VCL组件开发及应用
http://www.delphi2007.net/DelphiVCL/html/delphi_20061222112800193.html
1,用窗体名称作为传入参数,创建窗体,怎么避免重复创建?  
  如下面代码中注释调的部分;使用not   assigned()判断返回的结果每次都是false  
  也就是说,assigned判断结果一直为true。  
  function   JaxCreateForm(const   AFormName:string):boolean;  
  var  
      AForm:   TForm;  
      AFormClass:   TFormClass;  
  begin  
      try  
          if   FindClass(AFormName)   <>   nil   then  
          begin  
              try  
                  AFormClass   :=   TFormClass(FindClass(AFormName));  
  //             if   not   assigned(TForm(copy(AFormName,2,Length(AFormName)-1)))   then  
                  AForm   :=   AFormClass.Create(nil);  
                  AForm.Show;             //mdi类型form不能使用showmodal释放窗体;  
              except  
                  AForm.Free;  
                  AForm   :=   nil;  
              end;  
          end  
          else   begin  
              showmessage(format('创建窗体"%s"出错!',[AFormName]));  
          end;  
      except  
      end;  
  end;

2,动态创建的菜单项,怎么将其onclick事件与全局tnotifyevent类型的函数关联起来。  
  with   tbutton.create(nil)   do  
  begin  
      parent   :=   self;  
      caption   :=   '';  
      onclick   :=   ?.  
  end;

这个   窗口是不是自动创建的?

Q:   1,用窗体名称作为传入参数,创建窗体,怎么避免重复创建?  
   
  A:   看实例:  
   
  procedure   TActionsModule.OpenForm(FormClass:   TFormClass;   var   fm;  
      AOwner:   TComponent);  
  var  
      Idx:   Integer;  
      Child:   TForm;  
  begin  
      for   Idx   :=   0   to   Pred(Screen.FormCount)   do  
          if   Screen.Forms[Idx].ClassType   =   FormClass   then  
          begin  
                  Child   :=   Screen.Forms[Idx];  
                  if   Child.WindowState   =   wsMinimized   then  
                        ShowWindow(Child.handle,SW_SHOWNORMAL)  
                  else  
                        ShowWindow(Child.handle,SW_SHOWNA);  
                  if   (not   Child.Visible)   then   Child.Visible:=True;  
                  Child.BringToFront;  
                  Child.Setfocus;  
                  TForm(fm):=Child;  
                  exit;  
          end;  
      Child   :=   TForm(FormClass.NewInstance);  
      TForm(fm):=   Child;  
      Child.Create(AOwner);  
  end;  
   
  OpenForm(TLogInformationForm,   LogInformationForm,   Application.MainForm);  
   
  Q:,动态创建的菜单项,怎么将其onclick事件与全局tnotifyevent类型的函数关联起来。  
   
  A:   看实例  
   
  procedure   TMainForm.ButtonOnClick(Sender:   TObject);  
  begin  
      if   Sender   is   TButton   then  
          Showmessage((Sender   as   TButton).Caption);  
  end;  
   
  with   tbutton.create(nil)   do  
  begin  
      parent   :=   self;  
      caption   :=   '';  
      onclick   :=   ButtonOnClick  
  end  
   
 

Q:,动态创建的菜单项,怎么将其onclick事件与全局tnotifyevent类型的函数关联起来。  
   
  with   tbutton.create(nil)   do  
   
  ----------------------------  
   
  你的问题是菜单项,   而你的代码是TBUTTON。呵呵。   没有关系,菜单项也是一样的

1,看到了老冯的实例,不过我的创建方式和你有点不同;现在已经自己解决了;  
  将代码AForm:=   AForm.create(nil);改成..create(Application);  
  然后用Application.findcomponent('AFormName');就可以了。  
   
  2,onclick   :=   ButtonOnClick;  
  中如果buttononclick是在同一个类下是可以;但,相反,如果buttononclick是一个全局定义函数,不属于任何类下的话,好像不行。  
  再次请教。

对不起,   刚才一直无法上来。  
   
  procedure   ButtonOnClick(Sender:   TObject);  
  begin  
      Showmessage('Pointer,   Pointer   ,   I   Hate   You!');  
  end;  
   
  procedure   TForm1.FormCreate(Sender:   TObject);  
  begin  
      with   TButton.Create(nil)   do  
      begin  
          Parent   :=   Self;  
          Visible   :=   True;  
          @OnClick   :=   @ButtonOnClick;  
      end;  
  end;  
 

posted @ 2008-11-18 14:27 delphi2007 阅读(174) | 评论 (0)编辑 收藏

fastreport3 问题~~ VCL组件开发及应用
http://www.delphi2007.net/DelphiVCL/html/delphi_20061222112316194.html
上次听有人说fr3可以解决  
  实现当文字过多,自动换行,行过多,表格自动加高的问题  
  但我刚试了试,好象没什么不同的  
  各位大虾那应该怎么做呀  
   
  多谢各位积极参与讨论~~

fr2.4就可以了(再前的没用过)  
  主项数据和主项数据上的Memo   Streched   都设置为True

xxmmmx(踢踏)    
   
  多谢,可以了  
   
  找了好久终于有结果了,thank~~

那就早点结贴给分吧~~~~~~~~

好啦~~  
   
  我还有一个问题你也去帮我解决一下  
  你回过贴的

posted @ 2008-11-18 14:27 delphi2007 阅读(120) | 评论 (0)编辑 收藏

FastReport的问题 在先等待 VCL组件开发及应用
http://www.delphi2007.net/DelphiVCL/html/delphi_20061222111309195.html
我用frxReport+frxPreview来显示报表    
  代码如下  
      Screen.Cursor   :=   crHourGlass;  
   
      try  
          cdsP.Close;  
          cdsP.CommandText   :=   'Select   *   from   sjb   ';  
          cdsP.Open;  
   
          if   cdsP.IsEmpty   then  
          begin  
              application.messagebox('没有数据可以显示','提示信息',MB_OK);  
              Exit;  
          end;  
          frxReport1.LoadFromFile(AppPath   +   '\report\YJStat2.fr3');  
          frxReport1.PrepareReport;  
          frxReport1.ShowReport();  
      finally  
          Screen.Cursor   :=   crDefault;  
          frxPreview1.Cancel;  
      end;  
  现在问题出现在两个方面。  
  1。当在统计过程中(也就是说有100页,现在到50页的时候)重新点击统计按钮,这个时候程序报错。   这种情况怎么控制。  
  2。当在统计过程中(也就是说有100页,现在到50页的时候)关闭了该窗体。程序自动关闭。这种情况怎么控制。  
 

程序报错的提示是什么?

我捕获的错误    
  Access   violation   at   address   00000001.   Read   of   address   00000001

设置frReport的ShowProgress=True,这样在统计的过程中会出现进度条,其他操作不能进行。

posted @ 2008-11-18 14:27 delphi2007 阅读(231) | 评论 (0)编辑 收藏

用过TWEBBROWSER的请进来,高分求救 VCL组件开发及应用
http://www.delphi2007.net/DelphiVCL/html/delphi_20061222111048196.html
用TWEBBROWSER做了一个浏览器,调用本机的两个网页文件  
  网页中有大量的JAVESCRIP脚本,  
  在来回切换时出现三种错误,这三种错误不经常出,但总有,  
        一个是MSHTML。DLL异常  
   
    二是弹出一个对话框,标题为“实时调试”  
     最上方是:“请选择一个调试器”  
     下面是一个列表框,标题为“可能的调试器”  
     列表框中有一个“新实例Mircosoft   script   editor”  
            下方是一个复选框,内容是将当前的调试器设为默认调试器,对后最下方是,是否希望用选定的调试器进行调试然后是按钮  
   
        三是 出现一个对话框,从英文看是告诉我在调试状态下  
   
    第一个问题是测试时在所有机器上都会出现  
    第二个问题和第三个问题,在有的机器上不出现,  
    第三个问题出现后,会直接关闭程序  
   
  开发环境 D7 XP   
  网页   javascrip,加MP7是由工具软件生成的  
  请高手解决

关注中...

//   有没有初始化Ole?    
  //   全当路过  
   
  uses   ActiveX;  
   
  //...  
   
  initialization  
      OleInitialize(nil);  
   
  finalization  
      OleUninitialize;  
   
  end.  
 

http://support.microsoft.com/default.aspx/kb/261003

伴水清清和蒋晟,我其它的问题都是看你们的回复解决的,就想着你们了  
  我试试先,不过那个网页我看来之后,还没有找到思路,可否详细点

自顶一下

webBrowser.Silent:=true?

剪兄也来了,还没看到小河  
  剪兄,我这个不是脚本运行错误的问题,  
 

:)

up

再顶一下,帮顶有分啊

再次声明,帮顶有分

没有看到你的网页脚本  
  你叫大家怎么帮你调试?  
   
  至少你要提供一个调试环境

问题没有解决,但已经两天了,我决定结贴,感谢捧场的朋友  
  我将再开一贴,继续求助,  
  伴水兄  
  我的代码是这样  
          我有一个单元,定义了一个类,这个类从数据库中读出参数,生成实例,然后在界面上生成按钮  
          每个按钮对应这个类的一个实例  
          点击一个按钮则会打开相应的网页,这些网页都是存在本地的,是由软件生成的MP7课件  
          包含视频和PPT,并由网页中的javaSCRIPt   脚本负责视频和PPT的播放,同步问题,  
          网页内的脚本是由软件生成的,而且单独播放一个是没有问题的  
          问题都出在我不停的按按钮的时候,也就是我打开一个网页之后,马上又打开一个网页  
          我想是WEBBROWSER调入了新的网页,但原网页中的脚本没有释放干净,或者还在运行,造成了冲突,所以出现了这个问题  
          主要代码如下,  
          unit   define;  
   
  //  
            TPowerCtl   =   class(TObject)  
      private  
          but:   Boolean;  
          Fobj:   Tcontrol;  
          FCtlInfo:   TCtlFieldINfo;  
          oldx:   Integer;  
          oldy:   Integer;  
          procedure   objClick(Sender:Tobject);  
          procedure   objenter(sender:Tobject);  
   
  procedure   TPowerCtl.objClick(Sender:Tobject);  
  var  
      i:integer;  
      doc:IHTMLDOCUMENT2;  
  //   temp:integer;  
  begin  
    //   temp:=0;  
      For   i:=0   to   TControl(sender).Parent.ControlCount-1   do  
      begin  
   
          if   TControl(TControl(sender).Parent.Controls[i]).Tag   =9999   then     //网页控件的TAG  
          begin  
              while     TWebBrowser(TControl(sender).Parent.Controls[i]).ReadyState   <>4     do  
                Application.ProcessMessages;//   完成后再执行  
   
              TWebBrowser(TControl(sender).Parent.Controls[i]).Stop   ;  
   
              doc:=TWebBrowser(TControl(sender).Parent.Controls[i]).document   as   IhtmlDOCument2;  
              doc.close   ;  
              doc.clear   ;  
   
              TWebBrowser(TControl(sender).Parent.Controls[i]).Navigate(MainPath+self.FCtlInfo.FINdexPage);         //调入相应的网页  
   
              doc._Release;  
          end;  
      end;  
   
   
  end;  
   
  由主窗体调用这个单元,  
  在这个单元的初始化事件中初始化了OLE控件//这点我有疑问,到底在那初始化好  
                                                                    //     WEB是办面上固定的,是否应当写在PRJ的初始化事件  
                                                                    //或是主窗体单元的初始化事件中  
   
           
           
 

各位兄台,如果有办法,请到新贴中回复,解决一定再给分,谢谢

posted @ 2008-11-18 14:27 delphi2007 阅读(174) | 评论 (0)编辑 收藏

如何合并两个popupmenu? VCL组件开发及应用
http://www.delphi2007.net/DelphiVCL/html/delphi_20061222102924197.html
如在edit上右键弹出系统默认的菜单,如何将系统默认的这个菜单加到自己新建的另一个popupmenu中。谢谢先!

popupmenu1.Items.Add(popupmenu2.Items);   ?

谁能说得详细点儿?这个难道很难吗?

parent:=n2  
  没有实验过

posted @ 2008-11-18 14:27 delphi2007 阅读(201) | 评论 (0)编辑 收藏

怎样在ComboBox下拉列表框中显示Hint?类似的也行? VCL组件开发及应用
http://www.delphi2007.net/DelphiVCL/html/delphi_20061222101243198.html
怎样在ComboBox下拉列表框中显示Hint?类似的也行?
posted @ 2008-11-18 14:27 delphi2007 阅读(487) | 评论 (0)编辑 收藏

看delphi的源代码,发现比vc的源代码难看懂. VCL组件开发及应用
http://www.delphi2007.net/DelphiVCL/html/delphi_20061222100524199.html
不知道大家有没有对比过..有些无聊..

那有DELPHI的源代码?

只有VCL的源码吧

jf

习惯问题,看惯了就好

就是说vcl的源代码..感觉挺难看懂,

从总体上理解它的构架,就比较容易看得懂了。  
  看李维的《Inside   VCL》

如果你   vc熟过delphi,正如你说的delphi的源代码,发现比vc的源代码难看懂  
  如果你   delphi熟过vc,那么vc的源代码比delphi的源代码难看懂  
   
  呵呵,任何事物也许都这样,熟悉了你就会觉得他容易,就好像你讲普通话。

这是两个公司代码架构和风格不同造成的吧...  
 

从总体上理解它的构架,就比较容易看得懂了。  
  --------------------  
  有道理!

这只是你个人的理解,你能够达到大师级的时候才能知道怎么样才好.

delphi代码我觉得更规范些看起来很舒服。

而且可以用castaliaz进行一些模版的自定义,这样加上一些自定义的信息看起来更舒服

如果你   vc熟过delphi,正如你说的delphi的源代码,发现比vc的源代码难看懂  
  如果你   delphi熟过vc,那么vc的源代码比delphi的源代码难看懂  
  ------------------------------------------------------------------------  
  我也這樣認為~~!

从来不看的  
 

美国人说汉语难学,中国说英语难懂,关键是你熟悉哪个

够了。

posted @ 2008-11-18 14:27 delphi2007 阅读(206) | 评论 (0)编辑 收藏

求fastreport3 VCL组件开发及应用
http://www.delphi2007.net/DelphiVCL/html/delphi_20061222095201200.html
本人刚接触fr3,哪位大虾有fr3使用实例或使用方法之类的,  
  发一份给我,小弟不胜感激~  
  hnhslwl@163.com  
   
  多谢

你可以看FAST3   自带的DEMOS

posted @ 2008-11-18 14:27 delphi2007 阅读(159) | 评论 (0)编辑 收藏

Help!!关于图形图象控件的刷新问题 Delphi / Windows SDK/API
http://www.delphi2007.net/DelphiMultimedia/html/delphi_20061113195857151.html
小人前一个天在做一个交给老师的小图形图像演示程序时遇到了点问题,窗体Form1上面放了一个TPageControl1控件,并生成了3个TabSheet,分别完成不同的功能,当做第二个Tabsheet2时出了麻烦,该页的功能是单击一按钮时可在窗体上划线段,单击另一按钮时要求刷新窗体,使画的线消失,该页上我用了控件Timage1,一个表示画线开始的TButton1,另一个刷新按钮TButton2,但是刷新功能怎么也做不出来,但我在一新窗体上测试不放pageControl控件,在窗体上划线时则可以刷新,部分代码如下:请赐教!  
  implementation  
  var  
  start:boolean;  
  {$R   *.dfm}  
   
  procedure   TForm1.PageControl1Change(Sender:   TObject);  
  begin  
      if   pagecontrol1.ActivePage=tabsheet2   then  
      start:=false;  
  end;//当从别的页切换到第二页时,标志位为假,非得单击画线按钮才能在窗体画线    
   
  procedure   TForm1.DrawLineClick(Sender:   TObject);  
  begin  
      start:=true;//单击画线按钮,标志位赋为真,可以在窗体上画线  
  end;  
   
   
  procedure   TForm1.Image1MouseDown(Sender:   TObject;   Button:   TMouseButton;  
      Shift:   TShiftState;   X,   Y:   Integer);  
  begin  
      if   start=true   then  
      image1.Canvas.MoveTo(x,y);  
  end;   //鼠标按下的时候确定线段的第一个坐标  
   
   
  procedure   TForm1.Image1MouseUp(Sender:   TObject;   Button:   TMouseButton;  
      Shift:   TShiftState;   X,   Y:   Integer);  
  begin  
      if   start=true   then  
      image1.canvas.LineTo(x,y);  
  end;//鼠标放开的时候确定线段的第二个坐标,并画出线段  
   
  {问题就在这里????}  
  procedure   TForm1.RefreshClick(Sender:   TObject);  
  begin  
  ???{我不懂这里用image1.refresh或image1.canvas.refresh或form1.refresh都不行}  
  end;//单击刷新按钮,刷新,该功能不知道咋个实现啊,试了多次,都出不来  
   
  end.

试试image1.Invalidate;

试过了,不行啊,有没哪位高人晓滴???

是否在image1.refresh或image1.canvas.refresh之前要加"pageControl."来限定?  
  没有具体试过.

posted @ 2008-11-05 09:40 delphi2007 阅读(241) | 评论 (0)编辑 收藏

把一图片改为画笔,用来画线!!!!!! (有代码)请大家帮忙看看应该怎么改好。 Delphi / Windows SDK/API
http://www.delphi2007.net/DelphiMultimedia/html/delphi_20061113161717153.html
最近在做一个画铁路线的程序,我想把画笔的形状改变,它的形状用我选择的图片(铁路图片,bmp格式)来替换,这样再画线的时候,就是选择的图片。我急需大家的帮忙!  
   
  这是我写的代码,但是就是不能正常显示。希望大家给点提示:不会的帮忙顶一下。  
  procedure   TForm1.Button1Click(Sender:   TObject);  
  var  
      Bmpmap:TBitmap;  
      myBrush:   LOGBRUSH;  
  begin  
   
      Bmpmap   :=   TBitmap.Create;  
      try  
          Bmpmap.LoadFromFile('C:\bmp\31-1.bmp');  
          form1.Canvas.Brush.Bitmap   :=   Bmpmap;  
          myBrush.lbStyle   :=   form1.Canvas.Brush.Handle;  
   
          form1.Canvas.Pen.Handle   :=   ExtCreatePen(PS_GEOMETRIC   ,   20,   myBrush,   0,   nil);  
          form1.canvas.MoveTo(100,0);  
          form1.canvas.LineTo(100,300);  
      finally  
          Bmpmap.Free;  
      end;  
  end;  
  end.

好久不搞GDI了,具体细节都想不起来了。

to   gogogo:我相信你一定能想起来的,帮帮忙吧,大哥!

1,Canvas.Brush.Bitmap属性用于指定使用位图来添充刷子要画的区域  
  2,Canvas.Rectangle(100,0,   105,300);  
  3,如果要改变画笔我觉得可以改变鼠标的形状

myBrush.lbStyle   :=   form1.Canvas.Brush.Handle;//这个赋值什么意思?  
   
          form1.Canvas.Pen.Handle   :=   ExtCreatePen(PS_GEOMETRIC   ,   20,   myBrush,   0,   nil);  
  感觉这2句有问题,  
  你的目的是创建一个刷子,然后Canvas用这个刷子创建一个   Pen  
  感觉这个Pen的创建有问题  
  提示你Handle属性不要轻易使用,还是找找其他的方法属性,另外近两不要用API,其他的抱歉真的想不起来。  
  反正感觉这2句不是多余,就是错了。

能不能改变画刷的角度的?因为我现在画斜线的时候这个图片还是原来的角度,我也想让他平行与画出来的线,旋转图片我试了一下,好像旋转后不太好,请问大家一下有没有刷子或者画笔改变角度的?

再请帮忙!

posted @ 2008-11-05 09:40 delphi2007 阅读(407) | 评论 (0)编辑 收藏

请教,如何将image显示的图相保存到数据库中? Delphi / Windows SDK/API
http://www.delphi2007.net/DelphiMultimedia/html/delphi_20061113160341154.html
请教,如何将image显示的图相保存到数据库中?   多谢了!!!!!!!!

看下例程  
  http://www.delphibox.com/article.asp?articleid=3685

以流的方式保存一下。我做过,就按照这样的。

var  
      _picture:   TFileStream;  
  begin  
            _picture:=   TFileStream.Create('c:\11.bmp',fmOpenRead);  
            with   ADOCommand   do  
            begin  
                    Parameters.Clear;  
                    Parameters.AddParameter.Name:='UserPicture';//添加一个参数    
                    Parameters.AddParameter.DataType:=   ftBlob;//参数类型为数据流  
                    if   _picture<>nil   then  
                          Parameters.ParamByName('UserPicture').LoadFromStream(_picture,ftBlob);//给参数赋值  
  //下面是你的insert   sql语句  
  //image类型字段在values里对应':userpicture'参数  
                            fsql:=   'insert   into   UserInfo   (UserID,USERNAME,LOGNNAME,'  
                                        +'UsePsw,UserSex,UserBirthday,LearnLevel,UserDutyName,UserDuty,UserSecOffice,'  
                                        +'SuitSpecID,DeptID,ClassID,UserAddr,UserPhone,UserPicture,UserPictureEx,UserPower,Remark)   '  
                                        +'values   ('+inttostr(fid)+','''  
                                        +trim(editName.Text)+''','''+trim(editLogn.Text)+''','''+trim(editPswd1.Text)+''','''  
                                        +cboxUserSex.Text+''',cdate('''+DateTimeToStr(UserBirthday.DateTime)+'''),'''  
                                        +cboxXl.Text+''','''+trim(editZc.Text)+''','''+trim(editZw.Text)+''','''  
                                        +trim(editKs.Text)+''','+inttostr(_SuitSpecID)+','+inttostr(_DeptID)+','''  
                                        +strTemp2+''','''+trim(editAddr.Text)+''','''+trim(editPhone.Text)+''',:userpicture,'''  
                                        +_picEx+''','+inttostr(_power)+','''+memo1.Text+''')';  
                            CommandText:=   fsql;  
                            try  
                                    Execute;  
                                    if   messagebox(Handle,pchar('添加用户成功!'+#13+#13+'是否继续添加?'),  
                                          pchar('提示'),mb_yesno+MB_ICONQUESTION)=mryes   then  
                                    begin  
   
                                    end   else   Close;  
                            except  
                            end;  
                    end;  
  end;

posted @ 2008-11-05 09:40 delphi2007 阅读(844) | 评论 (0)编辑 收藏

仅列出标题
共34页: First 20 21 22 23 24 25 26 27 28 Last