使用 IntraWeb (13) - 基本控件之 TIWLabel、TIWLink、TIWURL、TIWURLWindow
TIWLabel // TIWLink //内部链接 TIWURL //外部链接 TIWURLWindow //页内框架, 就是 <iframe></iframe>
TIWLabel 所在单元及继承链:
IWCompLabel.TIWLabel < TIWCustomLabel < TIWCustomControl < TIWBaseHTMLControl < TIWBaseControl < TIWVCLBaseControl < TControl < TComponent < TPersistent < TObject
主要成员:
property AutoSize: Boolean //自动大小 property Caption: TCaption //使用 Text 也行 property RawText: Boolean //= True 时, 会把 Caption 当做 Html 源代码 property ConvertSpaces: Boolean //是否转换空格; 如果 False, 连续的空格只能被识别为一个 property NoWrap: Boolean // = False 且 ConvertSpaces = False 且 AutoSize = False 时, 可换行 property ForControl: TIWCustomControl //指定它是哪个控件的标签; 指定后, 点击该 Label 会激活指定的控件
RawText 属性测试:
procedure TIWForm1.IWAppFormCreate(Sender: TObject); begin IWLabel1.RawText := True; IWLabel1.Caption := '<a href="http://del.cnblogs.com">万一的 Delphi 博客</a>'; end;
TIWLink 所在单元及继承链:
IWHTMLControls.TIWLink < TIWLinkBase < TIWCustomControl < TIWBaseHTMLControl < TIWBaseControl < TIWVCLBaseControl < TControl < TComponent < TPersistent < TObject
主要成员:
property Confirmation: string // property DoSubmitValidation: Boolean // property RawText: Boolean // property Caption: TCaption // property RawText: Boolean // property OnClick: TNotifyEvent //
TIWLink 示例:
uses Unit2; procedure TIWForm1.IWLink1Click(Sender: TObject); begin TIWForm2.Create(WebApplication).Show; end;
TIWURL 所在单元及继承链:
IWHTMLControls.TIWURL < TIWLinkBase < TIWCustomControl < TIWBaseHTMLControl < TIWBaseControl < TIWVCLBaseControl < TControl < TComponent < TPersistent < TObject
主要成员:
property TargetOptions: TIWURLTarget //目标窗口选项 property TerminateApp: Boolean //跳转时, 是否同时终止应用 property URL: string //跳转地址 property UseTarget: Boolean //是否使用目标窗口 property RawText: Boolean // property Caption: TCaption // TIWURLTarget 类的成员: property Left: Integer property Top: Integer property Width: Integer property Height: Integer property WindowName: string property AddressBar: Boolean property Menu: Boolean property Resizable: Boolean property Scrollbars: Boolean property Toolbar: Boolean property Mode: TIWURLTargetMode //TIWURLTargetMode = (tmBlank, tmNewWindow, tmParent, tmSelf, tmTop) function GetModeString(AMode: IWHTMLControls.TIWURLTargetMode): string
TIWURL 示例:
{在新标签页打开} procedure TIWForm1.IWAppFormCreate(Sender: TObject); begin IWURL1.URL := 'http://www.cnblogs.com/del'; end; {在新窗口打开} procedure TIWForm1.IWAppFormCreate(Sender: TObject); begin IWURL1.URL := 'http://www.cnblogs.com/del'; IWURL1.UseTarget := True; IWURL1.TargetOptions.Top := 0; IWURL1.TargetOptions.Left := 0; end; {在当前页打开} procedure TIWForm1.IWAppFormCreate(Sender: TObject); begin IWURL1.URL := 'http://www.cnblogs.com/del'; IWURL1.UseTarget := True; IWURL1.TargetOptions.Mode := tmSelf; end;
TIWURLWindow 所在单元及继承链:
IWHTMLControls.TIWURLWindow < TIWCustomControl < TIWBaseHTMLControl < TIWBaseControl < TIWVCLBaseControl < TControl < TComponent < TPersistent < TObject
主要成员:
property URI: string //地址 property Border: Boolean //使用要边框 property Scrolling: TIWURLWindowScrolling //是否显示滚动条: usYes、usNo、usAuto
TIWLink 示例:
procedure TIWForm1.IWAppFormCreate(Sender: TObject); begin IWURLWindow1.URI := 'http://del.cnblogs.com'; IWURLWindow1.Border := True; IWURLWindow1.Align := alLeft; end;