Click here to Skip to main content
16,017,351 members
Articles / Desktop Programming / Windows Forms
Article

An Office 2003-like popup notifier

Rate me:
Please Sign up or sign in to vote.
4.71/5 (58 votes)
23 Mar 2006CPOL1 min read 315.9K   7.1K   182   113
A nice little control to help the user notice you're trying to tell him something...

Image 1

Introduction

This is a simple project, a control that mimics the Microsoft® Outlook® 2003 mail alert.

Features

This control has several features. Among them, you'll find:

Image 2

Progressive appearance - transparency

Image 3

MSN Messenger like pop-ups (any size, color, etc.)

Image 4

Another sample

This control is 100% drawn in the code, there is absolutely no other dependencies than System.Drawing and System.Windows.Forms.

You can include a ContextMenuStrip when clicking on the "down arrow" button.

Using the code

The controls is made of two basic classes:

  • A form (the part that will actually show up).
  • A class that contains all the properties that will be includable on forms.

The class contains two timers, one used for the appearing/disappearing animation, the other (configurable) is used to define how much time the popup is shown before it disappears.

This is how the form is actually shown:

VB
fPopup.Size = Size
fPopup.Opacity = 0
fPopup.Location = _
  New Point(Screen.PrimaryScreen.WorkingArea.Right_
   - fPopup.Size.Width - 1, _
   Screen.PrimaryScreen.WorkingArea.Bottom)
fPopup.Show()

The form is does the drawing in the Paint event.

I'm using these functions to obtain a color that is similar but lighter/darker. There might exist another method.

VB
Private 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

And to avoid flickering...

VB
Me.SetStyle(ControlStyles.OptimizedDoubleBuffer, True)
Me.SetStyle(ControlStyles.ResizeRedraw, True)
Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)

Points of Interest

None really, it's nice, it's fun, it's colorful... that's it :)

History

  • March 2006 - V 1.0.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Switzerland Switzerland
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionRe: Avoid losing focus when popup appears Pin
calis online30-Oct-06 20:05
calis online30-Oct-06 20:05 
AnswerRe: Avoid losing focus when popup appears Pin
ddino11-Nov-06 23:52
ddino11-Nov-06 23:52 
GeneralRe: Avoid losing focus when popup appears Pin
calis online14-Nov-06 4:32
calis online14-Nov-06 4:32 
GeneralRe: Avoid losing focus when popup appears [modified] Pin
Gavinator123415-Nov-06 18:08
Gavinator123415-Nov-06 18:08 
GeneralRe: Avoid losing focus when popup appears Pin
calis online12-Dec-06 9:36
calis online12-Dec-06 9:36 
GeneralRe: Avoid losing focus when popup appears [modified] Pin
Brett Meyerowitz18-Dec-06 6:14
Brett Meyerowitz18-Dec-06 6:14 
GeneralRe: Avoid losing focus when popup appears Pin
lsri808814-Oct-07 23:47
lsri808814-Oct-07 23:47 
GeneralMSN-like stackable popup - OnClick Pin
calis online28-Sep-06 22:19
calis online28-Sep-06 22:19 
AnswerRe: MSN-like stackable popup - OnClick Pin
Nicolas Wälti28-Sep-06 23:05
Nicolas Wälti28-Sep-06 23:05 
GeneralRe: MSN-like stackable popup - OnClick Pin
calis online28-Sep-06 23:25
calis online28-Sep-06 23:25 
GeneralPopup Notifier minor issue Pin
brembot17-Sep-06 17:19
brembot17-Sep-06 17:19 
AnswerRe: Popup Notifier minor issue Pin
Nicolas Wälti28-Sep-06 23:07
Nicolas Wälti28-Sep-06 23:07 
QuestionHow ? Pin
zimmwarrior15-Sep-06 1:11
zimmwarrior15-Sep-06 1:11 
QuestionThreadSafe? Pin
brembot1-Aug-06 15:46
brembot1-Aug-06 15:46 
Generalgrow and shrink notifier Pin
zjanes6-Jul-06 2:02
zjanes6-Jul-06 2:02 
GeneralRe: grow and shrink notifier Pin
Nicolas Wälti29-Jul-06 6:37
Nicolas Wälti29-Jul-06 6:37 
QuestionCan the notifier be shown in at the top of the screen? Pin
flyte5-Jun-06 11:29
flyte5-Jun-06 11:29 
AnswerRe: Can the notifier be shown in at the top of the screen? Pin
Nicolas Wälti5-Jun-06 21:51
Nicolas Wälti5-Jun-06 21:51 
GeneralType PopupNotifier is not defined Pin
Untouchab1e29-May-06 10:24
Untouchab1e29-May-06 10:24 
AnswerRe: Type PopupNotifier is not defined Pin
Nicolas Wälti29-May-06 21:58
Nicolas Wälti29-May-06 21:58 
GeneralRe: Type PopupNotifier is not defined Pin
Untouchab1e30-May-06 4:22
Untouchab1e30-May-06 4:22 
GeneralRe: Type PopupNotifier is not defined Pin
ssamayoa1-Jul-06 7:27
ssamayoa1-Jul-06 7:27 
GeneralVB.NET 2003 Pin
madval17-May-06 10:40
madval17-May-06 10:40 
GeneralRe: VB.NET 2003 Pin
Untouchab1e28-May-06 9:16
Untouchab1e28-May-06 9:16 
AnswerRe: VB.NET 2003 Pin
Nicolas Wälti28-May-06 21:27
Nicolas Wälti28-May-06 21:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.