首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

【初学者级有关问题】OnChange打开窗体

2012-05-29 
【菜鸟级问题】OnChange打开窗体第一天研究delphi,还真有点不明白如object MENU_HELP_ABOUT: TMenuItemCapti

【菜鸟级问题】OnChange打开窗体
第一天研究delphi,还真有点不明白

  object MENU_HELP_ABOUT: TMenuItem
  Caption = '关于(&A)'
  OnClick = MENU_HELP_ABOUTClick \\打开的是一个作者信息的窗体
  end
  end

那么我想打开的是object frmPlayGold: TfrmPlayGold

Delphi(Pascal) code
object frmPlayGold: TfrmPlayGold  Left = 381  Top = 186  BorderIcons = [biSystemMenu, biMinimize]  BorderStyle = bsSingle  Caption = '新窗体'  ClientHeight = 384  ClientWidth = 587  Color = clBtnFace  Font.Charset = ANSI_CHARSET  Font.Color = clWindowText  Font.Height = -12  Font.Name = '宋体'  Font.Style = []  OldCreateOrder = True  ShowHint = True  PixelsPerInch = 96  TextHeight = 12  object Label52: TLabel    Left = 8    Top = 352    Width = 480    Height = 24    Caption =       '免责申明:此功能只可用于个人娱乐,如果使用此功能从事违法国家法规的' +      '活动而造成的后果'#13#10'和程序作者无关,如果不同意上述申明请立即删除本' +      '程序.'    Font.Charset = ANSI_CHARSET    Font.Color = clRed    Font.Height = -12    Font.Name = '宋体'    Font.Style = []    ParentFont = True  end


怎么做呢?

[解决办法]
在Menu子项目的OnClick事件(就是你的MENU_HELP_ABOUTClick事件)中:
Delphi(Pascal) code
Application.CreateForm(TfrmPlayGold, frmPlayGold);tryfrmPlayGold.show;//或是frmPlayGold.ShowModal;finallyfrmPlayGold.freeend;
[解决办法]
Delphi(Pascal) code
//定义如下一个方法//最后修正MENU_HELP_ABOUT.OnClick = ShowAboutDialog //也可以达到目的!procedure ShowAboutDialog(Sender:TObject);var  vForm:TfrmPlayGold;begin  vForm := TfrmPlayGold.Create(nil);  try    vForm.ShowModal;  finally    vForm.Free;  end;end; 

热点排行