Kerala Microsoft Users Group
Pay $0.00 for Windows Server 2008 and SQL Server 2008 licenses.

How to create a notification window like this

Latest post 02-06-2009 5:05 PM by EsseX07. 36 replies.
  • 12-11-2008 1:52 PM

    How to create a notification window like this

     

    Can any one guide me to create  window like this in VB.net? ...

    Filed under:
    • Post Points: 25
  • 12-11-2008 3:18 PM In reply to

    Re: How to create a notification window like this

     

    Hi Shoban

    The following solution is a basic one. I think you are using Windows Forms. The idea behind is we have to work around the Paint Event of the Form. 

    1) Goto the Form's Paint event.

    2) Create a Graphical path object.

    3) Add rectangles and lines

    4) Set the Form's region using the Graphical path.

    Code below

     

    Public mouse_offset As Point
        Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
            Dim p As System.Drawing.Drawing2D.GraphicsPath = New _
                    System.Drawing.Drawing2D.GraphicsPath()
            p.AddArc(New Rectangle(0, 0, 40, 40), 180, 90)
            p.AddLine(40, 0, Me.Width - 40, 0)
            p.AddArc(New Rectangle(Me.Width - 40, 0, 40, 40), -90, 90)
            p.AddLine(Me.Width, 40, Me.Width, Me.Height - 40)
            p.AddArc(New Rectangle(Me.Width - 40, Me.Height - 40, 40, 40), 0, 90)
            p.AddLine(Me.Width - 40, Me.Height, 40, Me.Height)
            p.AddArc(New Rectangle(0, Me.Height - 40, 40, 40), 90, 90)
            Me.Region = New Region(p)
            p.Dispose()
        End Sub
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Me.Close()
        End Sub
        Private Sub Form1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
            mouse_offset = New Point(-e.X, -e.Y)
        End Sub
    
        Private Sub Form1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
            Dim mousepos As Point
            If e.Button = Windows.Forms.MouseButtons.Left Then
                mousepos = Control.MousePosition
                mousepos.Offset(mouse_offset.X, mouse_offset.Y)
                Location = mousepos
            End If
        End Sub
    
        Private Sub Label1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseDown
            mouse_offset = New Point(-e.X, -e.Y)
        End Sub
    

     

    Also in the design

    1) Put a label and Dock to top

    2) Set the Form's border style as None.

    3) Set some nice background color for the label and form.

    Sorry it is not my code. I copied from various urls.
    Please look this code, it is nice one too. But using another approch : http://www.codeproject.com/KB/cs/customforms.aspx

     

     

    Thanks

    Anuraj P
    http://www.dotnetthoughts.net

    THIS POSTING IS PROVIDED "AS IS" WITH NO WARRANTIES, AND CONFERS NO RIGHTS.
    BEWARE OF BUGS IN THE ABOVE CODE; I HAVE ONLY PROVED IT CORRECT, NOT TRIED IT.

    • Post Points: 25
  • 12-12-2008 12:19 AM In reply to

    Re: How to create a notification window like this

    Shob,

    Create a transparent image which looks like that twitteroo image and place in it a form. Make the form borderless (FormBorderStyle=None) and set the 'TransparencyKey=Control (or what ever color you have for the form.

    It is done.

    Let me know if you need a sample application.

    PraVeeN
    Microsoft MVP
    blog.ninethsense.com | kidoos.net

    • Post Points: 5
  • 12-12-2008 12:22 AM In reply to

    Re: How to create a notification window like this

    Here is how it looks like. I did the form background with Photoshop and used PNG format. You can use gif also.

    PraVeeN
    Microsoft MVP
    blog.ninethsense.com | kidoos.net

    • Post Points: 5
  • 12-12-2008 4:21 AM In reply to

    Re: How to create a notification window like this

     

    The above code will render an window like this,


     

     

    Thanks

    Anuraj P
    http://www.dotnetthoughts.net

    THIS POSTING IS PROVIDED "AS IS" WITH NO WARRANTIES, AND CONFERS NO RIGHTS.
    BEWARE OF BUGS IN THE ABOVE CODE; I HAVE ONLY PROVED IT CORRECT, NOT TRIED IT.

    • Post Points: 25
  • 12-12-2008 10:34 AM In reply to

    Re: How to create a notification window like this

    Thank u so much guys!! it was very helpful

    • Post Points: 5
  • 12-16-2008 1:20 AM In reply to

    Re: How to create a notification window like this

    I have set the form's border to none  and added a BG image to it. Now how can I make it movable by clicking the form header?

     

    • Post Points: 25
  • 12-16-2008 3:25 AM In reply to

    Re: How to create a notification window like this

    Hi

    I think you put some control as Header right, because if you made the FormBorderstyle as none, the header will not be available. And here is some code, which I already posted, I made some tweaks. As I put an Image control in the Form, and I set the Dock property to Top

    Code

     Public mouse_offset As Point
        Private Sub PictureBox1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
            mouse_offset = New Point(-e.X, -e.Y)
        End Sub
    
        Private Sub PictureBox1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
            Dim mousepos As Point
            If e.Button = Windows.Forms.MouseButtons.Left Then
                mousepos = Control.MousePosition
                mousepos.Offset(mouse_offset.X, mouse_offset.Y)
                Location = mousepos
            End If
        End Sub
    

    Hope it will work :)

    Thanks

    Anuraj P
    http://www.dotnetthoughts.net

    THIS POSTING IS PROVIDED "AS IS" WITH NO WARRANTIES, AND CONFERS NO RIGHTS.
    BEWARE OF BUGS IN THE ABOVE CODE; I HAVE ONLY PROVED IT CORRECT, NOT TRIED IT.

    • Post Points: 25
  • 12-16-2008 8:04 AM In reply to

    Re: How to create a notification window like this

    This is littlebit old - http://blog.ninethsense.com/dotnet/move-a-control-with-mose-on-form/

    Better go with Anuraj's code.

    PraVeeN
    Microsoft MVP
    blog.ninethsense.com | kidoos.net

    • Post Points: 25
  • 12-16-2008 9:52 AM In reply to

    Re: How to create a notification window like this

    Thank guys!! It works like charm!!! Very hapy to get into .net after a long time :)

    • Post Points: 25
  • 01-29-2009 6:35 PM In reply to

    Re: How to create a notification window like this

    hey!

    I also need the NotificationWindow for my Project.

     

    I included the code from anuraj.

    it was very useful but I need a real notification window..  like msn pop ups in the right bottom corner.

    I know how to use it in vb.net with the power pack but i can't change the design of it.. 

    I need the code to use this form1 we created as the design...

     

    I hope you understood what i mean, and I hope you can help me!

    Thanks

    EsseX

    • Post Points: 25
  • 01-29-2009 11:17 PM In reply to

    Re: How to create a notification window like this

    Hi Buddy,

    I don't know any tool for Windows Forms. But if you are WPF, you can go for Microsoft Expression Blend, where you will be able to change the UI and place the controls as you wish, in design time.

    Thanks

    Anuraj P
    http://www.dotnetthoughts.net

    THIS POSTING IS PROVIDED "AS IS" WITH NO WARRANTIES, AND CONFERS NO RIGHTS.
    BEWARE OF BUGS IN THE ABOVE CODE; I HAVE ONLY PROVED IT CORRECT, NOT TRIED IT.

    • Post Points: 25
  • 01-29-2009 11:29 PM In reply to

    Re: How to create a notification window like this

    Hi EsseX

    Please check out http://www.codeplex.com/jata

    I have created a notification window like Gtalk does using advise from Anuraj! Check out and let uw know whther it helps.

     

    Shoban

    • Post Points: 5
  • 01-30-2009 5:12 AM In reply to

    Re: How to create a notification window like this

    Thank you for your quick answer.

    But i'm sry

    i ment i followed the construction from NinethSense

    and i copied this code from Anuraj

     

    but i can't follow other construction from him

     

    1) Goto the Form's Paint event.

    2) Create a Graphical path object.

    3) Add rectangles and lines

    4) Set the Form's region using the Graphical path.

     

    i hope you can help me

     

    Thank you!

    EsseX

    • Post Points: 25
  • 01-30-2009 5:17 AM In reply to

    Re: How to create a notification window like this

    Hi Essex

    Did you copied my code in a Windows form and tried? What was the result? Ninthsense is using very simple method, but require an Image.

    Let me know the exact issue. The second level code is for Dragging / Moving the window.

    Thanks

    Anuraj P
    http://www.dotnetthoughts.net

    THIS POSTING IS PROVIDED "AS IS" WITH NO WARRANTIES, AND CONFERS NO RIGHTS.
    BEWARE OF BUGS IN THE ABOVE CODE; I HAVE ONLY PROVED IT CORRECT, NOT TRIED IT.

    • Post Points: 25
Page 1 of 3 (37 items) 1 2 3 Next > | RSS
Pay $0.00 for Windows Server 2008 and SQL Server 2008 licenses.