unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;type
  TForm1 = class(TForm)
  procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;implementation{$R *.dfm}
procedure TForm1.FormShow(Sender: TObject);
begin
   showmessage('ssss'); //为什么这里的代码不会执行呢?
end;end.

解决方案 »

  1.   

    本帖最后由 bdmh 于 2009-08-18 10:05:12 编辑
      

  2.   

    看一下窗体的onShow事件里有没有链接
      

  3.   

    可能是因为你的Form的OnShow事件根本没有和这个函数挂钩.
    设计时状态,选中form,然后在OnShow事件下拉框中选择FormShow
    或者在代码中指定:OnShow = FormShow;
      

  4.   

    本帖最后由 bdmh 于 2009-08-18 10:09:04 编辑
      

  5.   

    OnShow = FormShow; 要在哪里的代码指定?
      

  6.   

    Form1的onShow事件没有连接,按F11到属性那里看一看
      

  7.   

    嗯,那里的我会弄了,如果不在那里指定直接在代码中指定要怎么做? 直接在代码中指定
    OnShow = FormShow;