/*****1*****/
procedure CreateParams(var Params: TCreateParams); override;
......
procedure TXPForm.CreateParams(var Params: TCreateParams);
begin
 inherited CreateParams(Params);
  Params.Style := Params.Style and (not WS_CAPTION) and (not WS_BORDER);
  Params.Style := Params.Style or WS_POPUP or WS_THICKFRAME or WS_CLIPCHILDREN;
end;
这个过程是对CreateParams的重载,问:CreateParams是怎么的一个过程,它重载过的参数有何有?
/******2****/
procedure TXPForm.pnlCaptionMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if WindowState = wsMaximized then Exit;
  ReleaseCapture;
  Perform(WM_SysCommand, $F012, 0);
end;
这个过程中ReleaseCapture起什么作用?这句话:Perform(WM_SysCommand, $F012, 0);什么意思?
/*****3*****/
constructor Create(AOwner: TComponent); override;
......
constructor TXPForm.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  SetSysBtnVisible;
  if ImgIcon.Picture.Graphic <> nil then Exit;
  if (AOwner is TForm) then begin
    ImgIcon.Picture.Assign(TForm(AOwner).Icon);
  end else begin
    if (AOwner is TApplication) then begin
      ImgIcon.Picture.Assign(TApplication(AOwner).Icon);
    end;
  end;
end;
两个if语句实现绑定不同ICON功能,问:(AOwner is TForm)和(AOwner is TApplication)为什么要这样写?有何区别?不理解。
/******4****/
public
    procedure SetSysBtnVisible;
在两个单元中都有这一句的声明,有必要吗?public不是声明全局变量的吗?为什么不会冲突?
/*****5*****/
怎么查看project1.res的内容,它有什么用?它能编译成DLL文件吗?怎么编译?
/*****6*****/
procedure TFrmAb.EditClick(Sender: TObject);
begin
  inherited;
  datamodule2.ab.Edit;
end;
问:在这里的inherited有什么用呢?它是不是多余的?
/*******

解决方案 »

  1.   

    1、createparams可以改变参数传递给CreateWindowEx(),CreateWindowEx()创建窗口句柄,createparams可以在API级控制窗口创建的细节,比如窗口风格等。
    2、ReleaseCapture没怎么用过,看help似乎是释放鼠标线程什么的。
    看别人的说明:
    当前的应用程序释放鼠标捕获 
    返回值 
    Long,TRUE(非零)表示成功,零表示失败 
    注解 
    我的理解:与SetCapture函数一起使用,用于判断鼠标离开(mouseleave)事件 3、判断拥有者类型,再根据不同的类型,将拥有者转换成响应的类来使用,没见后面TApplication(...)?
    4、SetSysBtnVisible声明在public里,表示是该类提供的方法,使用时如下调用:类实例.SetSysBtnVisible
    5、.res是资源文件,具体可参见相关说明文档
    6、inherited是继承祖先类的相应方法,如果你把它父类该方法的代码copy到这来就可以省略。
    好累,简单说点。呵呵
      

  2.   

    楼上的帅哥老兄说的差不多了。^_^
    补充补充:
    1、除了用CreateParams外,也可以用SetWindowLong来做同样的事;
    2、Perform用于发送消息。
       Perform(WM_SysCommand, $F012, 0);这个语句实现用鼠标点住窗体的任意位置时可以拖动窗体;
    4、public声明的是类的全局变量,不同的类不会冲突;
      

  3.   

    :)
    走到哪都能看到 Kevin_Lmx(繁华阅尽) ,怎么没见你老兄多散点分?升星了才散200,汤都没喝到就没了。现在差不多升双星了吧?