网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > Delphi
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
本月文章推荐
.Delphi操作Wrod的几个知识点.
.用DELPHI实现特色按钮.
.使用COM+参数化对象结构编程技术.
.截获与管理Windows的消息.
.TreeView使用笔记.
.Delphi中RichEdit的奥妙.
.delphi常用文档之一.
.delphi小技巧集锦.
.Delphi中根据分类数据生成树形结.
.查句柄知多少.
.字符画软件的四个关键技术.
.制作一个简单的setup.
.提取应用程序中的图标资源.
.Delphi中实现界面与业务逻辑的分.
.改良控件-Delphi自带控件Bug的消.
.开发一个基于DCOM的局域网聊天室.
.Delphi程序设计综合训练任务书.
.win2000/xp/2003下不能关闭程序的.
.平滑SpeedButton.
.Delphi4的Winsocket编程.

模拟delphi编辑窗体操作控件。。。

发表日期:2006-2-4


 

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls, jpeg;
const LMouseDown=False;
type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Panel2: TPanel;
    Panel1: TPanel;
    Panel3: TPanel;
    Panel4: TPanel;
    Panel5: TPanel;
    Panel6: TPanel;
    Panel7: TPanel;
    Panel8: TPanel;
    Panel11: TPanel;
    Panel22: TPanel;
    Panel33: TPanel;
    Panel44: TPanel;
    Panel55: TPanel;
    Panel66: TPanel;
    Panel77: TPanel;
    Panel88: TPanel;
    Button1: TButton;
    procedure Edit1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure Edit1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure Edit1MouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure Button1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure Button1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure Button1MouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  s,a:boolean;
implementation

{$R *.dfm}

 procedure ManipulateControl(Control: TControl; Shift: TShiftState; X, Y, Precision: integer);
var SC_MANIPULATE: Word;
begin
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  //光标在控件的最左侧**********************************************************
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       if (X<=Precision) and (Y>Precision) and (Y<Control.Height-Precision)
  then begin
         SC_MANIPULATE  := $F001;
         Control.Cursor := crSizeWE;
       end
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  //光标在控件的最右侧**********************************************************
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  else if (X>=Control.Width-Precision) and (Y>Precision) and (Y<Control.Height-Precision)
  then begin
         SC_MANIPULATE  := $F002;
         Control.Cursor := crSizeWE;
       end
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  //光标在控件的最上侧**********************************************************
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  else if (X>Precision) and (X<Control.Width-Precision) and (Y<=Precision)
  then begin
         SC_MANIPULATE  := $F003;
         Control.Cursor := crSizeNS;
       end
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  //光标在控件的左上角**********************************************************
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  else if (X<=Precision) and (Y<=Precision)
  then begin
         SC_MANIPULATE  := $F004;
         Control.Cursor := crSizeNWSE;
       end
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  //光标在控件的右上角**********************************************************
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  else if (X>=Control.Width-Precision) and (Y<=Precision)
  then begin
         SC_MANIPULATE  := $F005;
         Control.Cursor := crSizeNESW    ;
       end
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  //光标在控件的最下侧**********************************************************
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  else if (X>Precision) and (X<Control.Width-Precision) and (Y>=Control.Height-Precision)
  then begin
         SC_MANIPULATE  := $F006;
         Control.Cursor := crSizeNS;
       end
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  //光标在控件的左下角**********************************************************
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  else if (X<=Precision) and (Y>=Control.Height-Precision)
  then begin
         SC_MANIPULATE  := $F007;
         Control.Cursor := crSizeNESW;
       end
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  //光标在控件的右下角**********************************************************
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  else if (X>=Control.Width-Precision) and (Y>=Control.Height-Precision)
  then begin
         SC_MANIPULATE  := $F008;
         Control.Cursor := crSizeNWSE;
       end
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  //光标在控件的客户区(移动整个控件)******************************************
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  else if (X>5) and (Y>5) and (X<Control.Width-5) and (Y<Control.Height-5)
  then begin
         SC_MANIPULATE  := $F009;
         Control.Cursor := crSizeAll;
       end
  else begin
         SC_MANIPULATE := $F000;
         Control.Cursor := crDefault;
       end;
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  if Shift=[ssLeft] then
  begin
    ReleaseCapture;
    Control.Perform(WM_SYSCOMMAND, SC_MANIPULATE, 0);
  end;
  end;
procedure TForm1.Edit1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  ManipulateControl((Sender as TControl), Shift, X, Y, 9);
  edit1.Hint:='Edit1:TEdit'+chr(13)+'Origin:'+IntToStr(edit1.Top)+','
  +IntToStr(edit1.Left)+';'+'Size:'+IntToStr(edit1.Width)+IntToStr(edit1.Height)+chr(13)+'Tab Stop:Ture;Order:0';
        if s=true then
        begin
        a:=false;
        panel1.Visible:=true;      panel2.Visible:=true;     panel3.Visible:=true;
        panel4.Visible:=true;      panel5.Visible:=true;
        panel6.Visible:=true;      panel7.Visible:=true;     panel8.Visible:=true;
        panel1.top:=edit1.Top-6;
        panel1.Left:=edit1.Left-6;
        panel2.Top:=edit1.Top+(edit1.Height div 2)-3;
        panel2.Left:=edit1.Left-6;
        panel3.Top:=edit1.Top+edit1.Height;
        panel3.Left:=edit1.Left-6;
        panel4.Top:=edit1.top-6;
        panel4.Left:=edit1.Left+(edit1.Width div 2);
        panel5.Top:=edit1.Top+edit1.Height;
        panel5.Left:=edit1.Left+(edit1.Width div 2);
        panel6.Top:=edit1.Top-6;
        panel6.Left:=edit1.Left+edit1.Width;
        panel7.Top:=edit1.Top+(edit1.Height div 2)-3;
        panel7.Left:=edit1.Left+edit1.Width;
        panel8.top:=edit1.Top+edit1.Height;
        panel8.Left:=edit1.Left+edit1.Width;
        end;
end;

procedure TForm1.Edit1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin

        panel11.Visible:=false;      panel22.Visible:=false;     panel33.Visible:=false;
        panel44.Visible:=false;      panel55.Visible:=false;
        panel66.Visible:=false;      panel77.Visible:=false;     panel88.Visible:=false;

  s:=true;
  a:=false;
        panel1.Visible:=true;      panel2.Visible:=true;     panel3.Visible:=true;
        panel4.Visible:=true;      panel5.Visible:=true;
        panel6.Visible:=true;      panel7.Visible:=true;     panel8.Visible:=true;
        panel1.top:=edit1.Top-6;
        panel1.Left:=edit1.Left-6;
        panel2.Top:=edit1.Top+(edit1.Height div 2)-3;
        panel2.Left:=edit1.Left-6;
        panel3.Top:=edit1.Top+edit1.Height;
        panel3.Left:=edit1.Left-6;
        panel4.Top:=edit1.top-6;
        panel4.Left:=edit1.Left+(edit1.Width div 2);
        panel5.Top:=edit1.Top+edit1.Height;
        panel5.Left:=edit1.Left+(edit1.Width div 2);
        panel6.Top:=edit1.Top-6;
        panel6.Left:=edit1.Left+edit1.Width;
        panel7.Top:=edit1.Top+(edit1.Height div 2)-3;
        panel7.Left:=edit1.Left+edit1.Width;
        panel8.top:=edit1.Top+edit1.Height;
        panel8.Left:=edit1.Left+edit1.Width;
end;

procedure TForm1.Edit1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
        if s=true then
        begin
        a:=false;
        s:=false;
        panel1.Visible:=true;      panel2.Visible:=true;     panel3.Visible:=true;
        panel4.Visible:=true;      panel5.Visible:=true;
        panel6.Visible:=true;      panel7.Visible:=true;     panel8.Visible:=true;
        panel1.top:=edit1.Top-6;
        panel1.Left:=edit1.Left-6;
        panel2.Top:=edit1.Top+(edit1.Height div 2)-3;
        panel2.Left:=edit1.Left-6;
        panel3.Top:=edit1.Top+edit1.Height;
        panel3.Left:=edit1.Left-6;
        panel4.Top:=edit1.top-6;
        panel4.Left:=edit1.Left+(edit1.Width div 2);
        panel5.Top:=edit1.Top+edit1.Height;
        panel5.Left:=edit1.Left+(edit1.Width div 2);
        panel6.Top:=edit1.Top-6;
        panel6.Left:=edit1.Left+edit1.Width;
        panel7.Top:=edit1.Top+(edit1.Height div 2)-3;
        panel7.Left:=edit1.Left+edit1.Width;
        panel8.top:=edit1.Top+edit1.Height;
        panel8.Left:=edit1.Left+edit1.Width;
        end;
end;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
a:=false;
s:=false;
        panel1.Visible:=false;      panel2.Visible:=false;     panel3.Visible:=false;
        panel4.Visible:=false;      panel5.Visible:=false;
        panel6.Visible:=false;      panel7.Visible:=false;     panel8.Visible:=false;
       //**********
        panel11.Visible:=false;      panel22.Visible:=false;     panel33.Visible:=false;
        panel44.Visible:=false;      panel55.Visible:=false;
        panel66.Visible:=false;      panel77.Visible:=false;     panel88.Visible:=false;

end;
procedure TForm1.Button1MouseUp(Sender: TObject; Button: TMouseButton;  Shift: TShiftState; X, Y: Integer);
begin if a=true then
        begin
        a:=false;
        s:=false;
        panel1.Visible:=false;      panel2.Visible:=false;     panel3.Visible:=false;
        panel4.Visible:=false;      panel5.Visible:=false;
        panel6.Visible:=false;      panel7.Visible:=false;     panel8.Visible:=false;

        panel11.Visible:=true;
        panel22.Visible:=true;
        panel33.Visible:=true;
        panel44.Visible:=true;
        panel55.Visible:=true;
        panel66.Visible:=true;
        panel77.Visible:=true;
        panel88.Visible:=true;
        panel11.top:=Button1.Top-6;
        panel11.Left:=Button1.Left-6;
        panel22.Top:=Button1.Top+(Button1.Height div 2)-3;
        panel22.Left:=Button1.Left-6;
        panel33.Top:=Button1.Top+Button1.Height;
        panel33.Left:=Button1.Left-6;
        panel44.Top:=Button1.top-6;
        panel44.Left:=Button1.Left+(Button1.Width div 2);
        panel55.Top:=Button1.Top+Button1.Height;
        panel55.Left:=Button1.Left+(Button1.Width div 2);
        panel66.Top:=Button1.Top-6;
        panel66.Left:=Button1.Left+Button1.Width;
        panel77.Top:=Button1.Top+(Button1.Height div 2)-3;
        panel77.Left:=Button1.Left+Button1.Width;
        panel88.top:=Button1.Top+Button1.Height;
        panel88.Left:=Button1.Left+Button1.Width;
        end;
end;
 procedure TForm1.Button1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
    a:=true;
    s:=false;
        panel1.Visible:=false;      panel2.Visible:=false;     panel3.Visible:=false;
        panel4.Visible:=false;      panel5.Visible:=false;
        panel6.Visible:=false;      panel7.Visible:=false;     panel8.Visible:=false;

        panel11.Visible:=true;      panel22.Visible:=true;     panel33.Visible:=true;
        panel44.Visible:=true;      panel55.Visible:=true;
        panel66.Visible:=true;      panel77.Visible:=true;     panel88.Visible:=true;
        panel11.top:=Button1.Top-6;
        panel11.Left:=Button1.Left-6;
        panel22.Top:=Button1.Top+(Button1.Height div 2)-3;
        panel22.Left:=Button1.Left-6;
        panel33.Top:=Button1.Top+Button1.Height;
        panel33.Left:=Button1.Left-6;
        panel44.Top:=Button1.top-6;
        panel44.Left:=Button1.Left+(Button1.Width div 2);
        panel55.Top:=Button1.Top+Button1.Height;
        panel55.Left:=Button1.Left+(Button1.Width div 2);
        panel66.Top:=Button1.Top-6;
        panel66.Left:=Button1.Left+Button1.Width;
        panel77.Top:=Button1.Top+(Button1.Height div 2)-3;
        panel77.Left:=Button1.Left+Button1.Width;
        panel88.top:=Button1.Top+Button1.Height;
        panel88.Left:=Button1.Left+Button1.Width;
end;

 procedure TForm1.Button1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  ManipulateControl((Sender as TControl), Shift, X, Y, 9);
  edit1.Hint:='Button1:TButton'+chr(13)+'Origin:'+IntToStr(Button1.Top)+','
  +IntToStr(Button1.Left)+';'+'Size:'+IntToStr(Button1.Width)+IntToStr(Button1.Height)+chr(13)+'Tab Stop:Ture;Order:0';
      
     
       if a=true then
        begin
        s:=false;
        panel1.Visible:=false;      panel2.Visible:=false;     panel3.Visible:=false;
        panel4.Visible:=false;      panel5.Visible:=false;
        panel6.Visible:=false;      panel7.Visible:=false;     panel8.Visible:=false;

        panel11.Visible:=true;      panel22.Visible:=true;     panel33.Visible:=true;
        panel44.Visible:=true;      panel55.Visible:=true;
        panel66.Visible:=true;      panel77.Visible:=true;     panel88.Visible:=true;
        panel11.top:=Button1.Top-6;
        panel11.Left:=Button1.Left-6;
        panel22.Top:=Button1.Top+(Button1.Height div 2)-3;
        panel22.Left:=Button1.Left-6;
        panel33.Top:=Button1.Top+Button1.Height;
        panel33.Left:=Button1.Left-6;
        panel44.Top:=Button1.top-6;
        panel44.Left:=Button1.Left+(Button1.Width div 2);
        panel55.Top:=Button1.Top+Button1.Height;
        panel55.Left:=Button1.Left+(Button1.Width div 2);
        panel66.Top:=Button1.Top-6;
        panel66.Left:=Button1.Left+Button1.Width;
        panel77.Top:=Button1.Top+(Button1.Height div 2)-3;
        panel77.Left:=Button1.Left+Button1.Width;
        panel88.top:=Button1.Top+Button1.Height;
        panel88.Left:=Button1.Left+Button1.Width;
        end;
end;

end.

上一篇:PowerBuilder调用Delphi写的Dll时发生的奇怪问题 人气:4340
下一篇:扫雷外挂的设计与实现(五) 人气:4150
浏览全部Delphi的内容 Dreamweaver插件下载 网页广告代码 祝你圣诞节快乐 2009年新年快乐