Make Www.Edu-cn.Com Your Home Page!
用户名: 密码: 验证码: 注册
  当前位置: > 中国教程网>软件开发>Delphi> Delphi使用三则

Delphi使用三则

作者:   来源:中国教程网   点击:   日期:2007-04-02
 

  隐藏和显示Windows的任务条
  如果隐藏和显示Windows的任务条,仅仅调用以下的函数就可以:
  procedure hideTaskbar; //隐藏
  var
  wndHandle : THandle;
  wndClass : array[0..50] of Char;
  begin
  StrPCopy(@wndClass[0], ′Shell—TrayWnd′);
  wndHandle:=FindWindow(@wndClass[0],nil);
  ShowWindow(wndHandle, SW—HIDE);
  End;
  procedure showTaskbar;
  var
  wndHandle : THandle;
  wndClass : array[0..50] of Char;
  begin
  StrPCopy(@wndClass[0], ′Shell—TrayWnd′);
  wndHandle:=FindWindow(@wndClass[0], nil);
  ShowWindow(wndHandle, SW—RESTORE);
  end;

  控制窗体
  如何在中把Form控制成不能放大/缩小/移动/关闭的窗体,可进行如下步骤:
  1.把Form的BorderIcons下的几个子属性值全改为False;
  2.修改Form的BorderStyle的值为bsSingle;
  3.为了让窗口不能移动,可以自已拦下WM—NCHITTEST消息,对该消息的处理为:一概回应鼠标点在窗口的Client区域, 相信这个视窗就不会动了。
中国教程网

  下面是一个例子, 请参考:
  unit Unit1;
  interface
  uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls,Forms, Dialogs, StdCtrls;
  type
  TForm1 = class(TForm)
  Button1: TButton;
  procedure Button1Click(Sender: TObject);
  private
  { Private declarations }
  procedure WMNCHitTest(var Msg: TMessage); message WM—NCHITTEST;
  public
  { Public declarations }
  end;
  var Form1: TForm1;
  implementation {$R *.DFM}
  procedure TForm1.Button1Click(Sender: TObject);
  begin
  Close; // 不可少, 因为已经没有其他方法能关闭此捶ň褪恰捌燮毕低?让它认为点中的是窗体的标题行:
  unit Dragmain;
  interface
  uses
   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
   Forms, Dialogs, StdCtrls;
  type
   TForm1 = class(TForm)
  Button1: TButton;
  procedure Button1Click(Sender: TObject);
   private
    procedure WMNCHitTest(var M: TWMNCHitTest); message wm—NCHitTest; 中国论文网
   end;
  var Form1: TForm1;
  implementation {$R *.DFM}
  procedure TForm1.WMNCHitTest(var M: TWMNCHitTest);
  begin
   inherited;    
  { call the inherited message handler }
   if M.Result = htClient then
  { is the click in the client area? }
    M.Result := htCaption;  
   { if so, make Windows think it′s   }
      { on the caption bar.  }
  end;
  procedure TForm1.Button1Click(Sender: TObject);
  begin
   Close;
  end;
  end.
  { 下面是这个窗体的设置}
  object Form1: TForm1
   Left = 203
   Top = 94
   BorderIcons = []
   BorderStyle = bsNone
   ClientHeight = 273
   ClientWidth = 427
   Font.Color = clWindowText
   Font.Height = -13
   Font.Name = ′System′
   Font.Style = []
   PixelsPerInch = 96
   TextHeight = 16
   object Button1: TButton
    Left = 160
    Top = 104
    Width = 89
    Height = 33 edu4u.com.cn
    Caption = ′Close′
    TabOrder = 0
    OnClick = Button1Click
   end
  end

AOE3 STUDIO

 

edu4u.com.cn



文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【论坛讨论

   最新文章:
·Delphi控制Excel自动生成报表(04-02)
·在Delphi应用程序中使用DLL(04-02)
·用DELPHI编程访问SQL SERVER数据库(04-02)
·用Delphi实现文件关联(04-02)
·Delphi中高级DLL的编写和调用(1)(04-02)
·Delphi+Cell全攻略(04-02)
·用Delphi实现选单的自动隐藏功能(04-02)
·QQ聊天记录器演示程序(二)(04-02)
·浅谈Delphi如何控制Excel操作(04-02)
·Delphi 4.0 制作数据库发行盘技巧(04-02)
   相关文章:
·用Delphi实现文件关联 ·用Delphi制作“复活节彩蛋”
·创建“控制面板”的新项目 ·用Delphi实现选单的自动隐藏功能
·用Delphi检测特殊键状态 ·Delphi 4.0 制作数据库发行盘技巧
·用Delphi制作Windows 98风格的工具栏 ·用Delphi 开发数据库程序经验三则
·用Delphi编制金额大写转换程序 ·在Delphi中定位文件位置

   文章评论:(0条)
  
用户名: 新注册) 密码: 匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。

 §最新评论:

  责任编辑:中国教程网  

© 2007 Copyright 中国教育网
DesignBy:AOE3 STUDIO & ROCOCO