用VB制作即时动态按钮

来源:互联网 发布:襄阳程序员工资 编辑:程序博客网 时间:2024/06/05 09:57
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
VB制作即时动态按钮首先,在主窗体上生成两个大小一样的按钮Command1和Command2,将它们的Style属性都设成1-Graphical,将Command1的Picture属性设为d:VBicomail01a.ico(变化前的图案,一个关闭的信封),将Command2的Picture属性设为d:VBicomail101b.ico(变化后的图案,一个打开的信封)。
其次,在主窗体的Private Sub Form-load()中加入以下代码:
Form1.Command1.Top=Form1.Height-7000
Form1.Command1.Left=Form1.Width-1300
Form1.Command2.Top=Form1.Height-7000
Form1.Command2.Left=Form1.Width-1300′使这两个按钮重合并放置在窗体的右上角
Form1.Command1.Visible=TrueForm1.Command2.Visible=False
′隐藏Command2按钮,显示Command1按钮
再次,在Command1-MouseMove事件里加入以下代码:
If Form1.Command1.Visible=True Then
Form1.Command1.Visible=False
Form1.Command2.Visible=True
End If

最后,在Form-MouseMove事件里加入如下代码:(如果按钮放置在图件框上,就在Picture1-MouseMove事件里加入代码)
If Form1.Command1.Visible=False Then
Form1.Command2.Visible=False
Form1.Command1.Visible=True
End If
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击