发信人: Borland (I love this), 信区: BorlandDev
标 题: 如何在BCB中制作模仿超级链接效果
发信站: 哈工大紫丁香 (2000年12月03日12:36:28 星期天), 站内信件
如何在BCB中制作模仿超级链接效果
用过Winamp的朋友知道Winamp的界面中有一些模仿的超级链接,可以把你
直接带到它的相关网站中去。下面这个例子就实现了这种功能,当鼠标点击其
中的仿超级链接时,你就会直接到达《电脑商情报》的网址:
新建一个应用,在窗体Form1上添加一个名为Label1的TLabel组件,然后
在代码编辑器中添加以下代码:
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Label1→Cursor=crHandPoint;
Label1→Font→Color=clBlue;
Label1→Font→Style=Label1→Font→Style< Label1→Caption=“http:
//www.cbinews.com”;
}
void __fastcall TForm1::Label1Click(TObject *Sender)
{
ShellExecute(Handle,NULL,Label1→Caption.c_str(),NULL,NULL,
SW_SHOWNORMAL);
}
void __fastcall TForm1::Label1MouseMove(TObject *Sender,
TShiftState Shift,
int X, int Y)
{
Label1→Font→Color=clRed;
}
void __fastcall TForm1::FormMouseMove(TObject *Sender,
TShiftState Shift,
int X, int Y)
{
Label1→Font→Color=clBlue;
}
注意:本示例应该包含头文件。
--
Borland Technology!
※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: mtnews.hit.edu.cn]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:3.486毫秒