当前位置:IT168首页 > 技术开发 > 概述
[收藏此页] [打印] [推荐] [评论]

一个Office 2003风格的通知控件(VB.NET)

责任编辑:nancy作者:ITPUB论坛   2008-07-02   
【内容导航】
文本Tag: 微软 sql

【IT168技术文档】

  该控件有两个基本的类组成:

  一个 form (会实际显示出来的部分).
  一个包含所有可在form中包含的属性的类.

  类包含两个timers, 一个用来控制渐隐渐出的动画效果,另一个可配置为定义弹出窗口显示多久.下面是一个演示:
fPopup.Size = Size fPopup.Opacity = 0 fPopup.Location = _ New Point(Screen.PrimaryScreen.WorkingArea.Right_ - fPopup.Size.Width - 1, _ Screen.PrimaryScreen.WorkingArea.Bottom) fPopup.Show()
  form在Paint事件中完成绘制. 笔者使用了一下函数来获取比指定颜色更浅/更深的颜色,但不确定是否有更好的方法.
Private Function GetDarkerColor()Function GetDarkerColor(ByVal Color As Color) As Color Dim clNew As Color clNew = Drawing.Color.FromArgb(255, DedValueMin0(CInt(Color.R), _ Parent.GradientPower), DedValueMin0(CInt(Color.G), _ Parent.GradientPower), DedValueMin0(CInt(Color.B), _ Parent.GradientPower)) Return clNew End Function 为避免闪烁: Me.SetStyle(ControlStyles.OptimizedDoubleBuffer, True) Me.SetStyle(ControlStyles.ResizeRedraw, True) Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
  [1]如何为控件实现一个隐藏窗体的方法
  在PopupNotifier.vb 类中加入:
Sub Hide()Sub Hide() tmWait.Stop() tmAnimation.Start() End Sub
  在form中如此调用:
Private Sub PopupNotifier1_Close()Sub PopupNotifier1_Close() Handles PopupNotifier1.Close PopupNotifier1.Hide() End Sub
上一页
1
23下一页
收藏到: 添加到“百度搜藏”添加到“QQ书签”添加到“Google书签”添加到“Yahoo收藏”添加到“和讯网摘”
【内容导航】
本文欢迎转载,转载请注明:转载自IT168 [ http://www.it168.com/ ]
本文链接:http://tech.it168.com/d/2008-07-02/200807020951928.shtml
技术开发相关文章  
  • 暂无
友情推介