 |
|

|
Hello all
Because this control has not been updated quite a while and still contains a lot of bugs, I decided to fix them myself. I released an improved version of this control in a new article:
Notification Window[^]
regards,
Simon
|
|
|
|

|
this control is lacking of the controls property, how can I do?
PopupNotifier1.controls ?????
i would like to add a panel ,for add other controls
|
|
|
|

|
Just that, what would be the best way to display multiple popups at the same time?
|
|
|
|

|
Hello
I am trying to close the popup through the Close event and calling the Dispose method on the PopupNotifier. However it does not close the popup, is there anything wrong I am trying to do here? please advise on this, below is the code I am working with.
PopupNotifier pn;
void popUp()
{
pn = new PopupNotifier();
pn.BodyColor = System.Drawing.Color.Beige;
pn.BorderColor = System.Drawing.Color.Black;
pn.ButtonHoverColor = System.Drawing.Color.LightGoldenrodYellow;
pn.ContentColor = System.Drawing.Color.Black;
pn.ContentFont = new System.Drawing.Font("Tahoma", 8F);
pn.ContentText = "You\'ve got mail... (I always wanted to say that !)";
pn.HeaderColor = System.Drawing.Color.Black;
pn.ImagePosition = new System.Drawing.Point(12, 21);
pn.ImageSize = new System.Drawing.Size(24, 24);
pn.LinkHoverColor = System.Drawing.Color.DarkSlateGray;
pn.OptionsMenu = null;
pn.Size = new System.Drawing.Size(400, 100);
pn.TextPadding = new System.Windows.Forms.Padding(10);
pn.TitleColor = System.Drawing.Color.Black;
pn.TitleFont = new System.Drawing.Font("Trebuchet MS", 9.75F, System.Drawing.FontStyle.Bold);
pn.TitleText = "Office 2003 anyone ?";
pn.ShowDelay = 5000;
pn.OptionsButton = true;
pn.ShowGrip = true;
pn.Click += new PopupNotifier.ClickEventHandler(pn_Click);
pn.Close += new PopupNotifier.CloseEventHandler(pn_Close);
pn.Disposed += new EventHandler(pn_Disposed);
pn.Popup();
}
void pn_Disposed(object sender, EventArgs e)
{
MessageBox.Show("Closing");
}
void pn_Close()
{
pn.Dispose();
}
|
|
|
|

|
me too
i adi that hide it
PopupNotifier.vb : Sub Hide()
Sub Hide()
tmWait.Stop()
tmAnimation.Start()
End Sub
in form
Private Sub PopupNotifier1_Close() Handles PopupNotifier1.Close
PopupNotifier1.Hide()
End Sub
|
|
|
|

|
Can you post the final .dll file here or make clear how to close the popup using the close button..
|
|
|
|

|
you have to catch those events ...
Dim pop As New PopupNotifier
pop.Popup()
AddHandler pop.Click, AddressOf popclick
AddHandler pop.Close, AddressOf popclose
Public Sub popclick()
'
End Sub
Public Sub popclose()
me.close (maybe ?)
End Sub
|
|
|
|

|
Hello I am a new to Visual Studio and C# as well. I am having hard time in trying to use this. I would really appreciate if someone explains to me how I can make this code to work in an example?
I would like to create an example notification using the PopupNotifier that is similar to the first example above.
Please help.
|
|
|
|

|
Just to update I am now okay with this, as I was able to create an example working very nicely. Only one issue left and I have posted a new thread with the issue for clsoing the popu when the lose button is pressed.
|
|
|
|

|
Would you post your sourcecode here?
I try to convert sourcecode to c# but it won't work.
It popup error when I drop this componet to windows form.
Thank you.
|
|
|
|

|
Hye Nick...........
AWESOM ARTICLE man ..Thanks for making this difficult code so simple & understandable....
Looking forward to ur next post
Cheerz !
|
|
|
|

|
Keep the good work
can u inculde a right to left order in the project....
|
|
|
|

|
I will design a new version of this tool (among other things for Office 2007...) stay tuned !
http://www.blueactivity.com
http://www.blueactivity.com
|
|
|
|

|
Hi Nick,
yes please , a new version that would be grand !
Not that I would not like the current version - no it is sufficient for my needs in the moment. It will be a real quality eye candy for my application. However I would not disregard a newer version with perhaps some text formatting capabilites.
Keep on Your good work!
Semmel
|
|
|
|

|
Link for download ?
|
|
|
|

|
Is it done yet? (I think I heard that before! "are we there yet?!" LOL!)
Btw, this control works great except while threading. Keep up the great job but please post a solution for using this great class in a managed thread.
|
|
|
|

|
The function GetLighterTransparentColor is not used.
|
|
|
|

|
Just an FYI. In the Sub New function the .FormBorderStyle is being set twice.
Sub New()
With fPopup
.TopMost = False
-----> .FormBorderStyle = System.Windows.Forms.FormBorderStyle.None <-----
.StartPosition = System.Windows.Forms.FormStartPosition.Manual
.FormBorderStyle = Windows.Forms.FormBorderStyle.None
.ShowInTaskbar = False
End With
tmAnimation.Interval = 50
End Sub
|
|
|
|

|
Can we use this project for .Net 2003 version.
If we open the project we are getting the following error
"The selected file is a visual studio solution file,but was created with a newer version of visual studio and cannot be opened.
gayathri
|
|
|
|

|
I implemented the PopupNotifierCollection to manage multiple stacking popups. The only problem I see is that the Opacity level of the popup windows are different. The bottom most popup is transparent, and the top most one is fully solid.
It may have to do with the animation. Did anyone correct this? It would be nice to have a setting for the maximum opacity too.
-Frank
|
|
|
|

|
I think I figured it out. You need to take the offset into account in this Function:
Private Function GetOpacityBasedOnPosition() As Double
Dim iCentPourcent As Integer = fPopup.Height
Dim iCurrentlyShown As Integer = Screen.PrimaryScreen.WorkingArea.Height - fPopup.Top - iOffset
Dim dPourcentOpacity As Double = iCentPourcent / 100 * iCurrentlyShown
Return (dPourcentOpacity / 100) - 0.05
End Function
-Frank
|
|
|
|

|
Is it possible to share the source with me ?
Thanks in advance !
|
|
|
|
|

|
I got it to run correctly, but how can I add more than one contex line item? I want to create two lines/links that both take seperate actions on their click events... I am finding it hard to change the way it looks, I tried adding labels to popupnotifierform.vb but it does not carry over to the actual popup. I am decent enough with VB but have not tried creating my own component. I was expecting just a form I could change the design of that would pop up.
Thanks on the code though - gives me a place to learn.
|
|
|
|

|
In fact, I've not been using other controls on that form. The form is a placeholder.
Its content is only painted and is not "existing".
You can see for instance in PopupNotifierRenderersOffice2003.vb
Protected Overrides Sub OnRenderContent(ByVal e As PopupNotifierRenderArgs)
If Not e.Parent.Image Is Nothing Then
e.Graphics.DrawImage(e.Parent.Image, e.Parent.ImagePosition.X, e.Parent.ImagePosition.Y, e.Parent.ImageSize.Width, e.Parent.ImageSize.Height)
End If
e.Parent.Form.HeightOfTitle = e.Graphics.MeasureString("A", e.Parent.TitleFont).Height
Dim iTitleOrigin As Integer
If Not e.Parent.Image Is Nothing Then
iTitleOrigin = e.Parent.ImagePosition.X + e.Parent.ImageSize.Width + e.Parent.TextPadding.Left
Else
iTitleOrigin = e.Parent.TextPadding.Left
End If
If e.Parent.Form.MouseIsOnTextLink Then
e.Parent.Form.Cursor = Cursors.Hand
e.Graphics.DrawString(e.Parent.ContentText, New Font(SystemFonts.DialogFont, FontStyle.Underline), New SolidBrush(Color.Black), e.Parent.Form.RectText)
Else
e.Parent.Form.Cursor = Cursors.Default
e.Graphics.DrawString(e.Parent.ContentText, New Font(SystemFonts.DialogFont, FontStyle.Regular), New SolidBrush(Color.Black), e.Parent.Form.RectText)
End If
e.Graphics.DrawString(e.Parent.TitleText, New Font(SystemFonts.DialogFont, FontStyle.Bold), New SolidBrush(Color.Black), iTitleOrigin, e.Parent.TextPadding.Top + e.Parent.HeaderHeight)
End Sub
There is a call to e.Graphics.Drawstring to print the text link and there is a variable that is set by PopupNotifier to define whether we are on the link with the mouse or not. If you just want to have another link, you need to double that feature.
If e.Parent.Form.MouseIsOnSecondTextLink Then
e.Parent.Form.Cursor = Cursors.Hand
e.Graphics.DrawString(e.Parent.SecondContentText, New Font(SystemFonts.DialogFont, FontStyle.Underline), New SolidBrush(Color.Black), e.Parent.Form.RectSecondText)
Else
e.Parent.Form.Cursor = Cursors.Default
e.Graphics.DrawString(e.Parent.SecondContentText, New Font(SystemFonts.DialogFont, FontStyle.Regular), New SolidBrush(Color.Black), e.Parent.Form.SecondRectText)
End If
then in PopupNotifier.vb:
Private sText2 As String
_
Property SecondContentText() As String
Get
Return sText2
End Get
Set(ByVal value As String)
sText2 = value
End Set
End Property
And then for PopupNotifierForm.vb:
Public ReadOnly Property SecondRectText() As RectangleF
Get
If Not Parent.Image Is Nothing Then
Return New RectangleF(Parent.ImagePosition.X + Parent.ImageSize.Width + Parent.TextPadding.Left, Parent.TextPadding.Top + Parent.TextPadding.Top + HeightOfTitle + Parent.HeaderHeight + RectText.Height, Me.Width - Parent.ImageSize.Width - Parent.ImagePosition.X - 16 - 5 - Parent.TextPadding.Left - Parent.TextPadding.Right, Me.Height - Parent.HeaderHeight - Parent.TextPadding.Top - Parent.TextPadding.Top - Parent.TextPadding.Bottom - HeightOfTitle - 1)
Else
Return New RectangleF(Parent.TextPadding.Left, Parent.TextPadding.Top + Parent.TextPadding.Top + HeightOfTitle + Parent.HeaderHeight + RectText.Height , Me.Width - 16 - 5 - Parent.TextPadding.Left - Parent.TextPadding.Right, Me.Height - Parent.HeaderHeight - Parent.TextPadding.Top - Parent.TextPadding.Top - Parent.TextPadding.Bottom - HeightOfTitle - 1)
End If
End Get
End Property
Then alors in the mouse_move event
If SecondRectText.Contains(e.X, e.Y) Then
bMouseOnLink2 = True
Else
bMouseOnLink2 = False
End If
And that should pretty much do the trick
|
|
|
|

|
Thanks, you showed me what to look for to add things. I eventually had to make a couple functions to get the width and height of the text in pixels to set the hover actions (the first link takes up the whole rectangle on the hover action).
I also had to modify the click() function to execute different functions for each link.
The only thing I am stuck on now is how to show the options arrow. Right now if i click under the X I get the context menu, but there is no down arrow to show the user there is a button there...
|
|
|
|

|
You could have pasted your code here, atleast for the pixcel thing and for click functionality
would have helped me a lot
(even tried to mail you but CODEPROJECT says your email is not verified so mailing failed )
while(1){
$source = "open";
}
|
|
|
|

|
Hi ..
i have converted this into C# .. but facing 1 problem..
In vb.net he has used like this in PopupNotifier.vb file.
Private WithEvents fPopup As New PopupNotifierForm(Me)
The C# equivalent to "Me" in VB is "THIS".
But u cant get a pointer to "this" keyword IN A CLASS IN C#.
private PopupNotifierForm fPopup = new PopupNotifierForm(this); // gives compile error.
Please help...
thanks
Jay
MCAD.NET
|
|
|
|

|
With C#, you have to initialize it in the constructor.
public PopupNotifier()
{
//InitializeComponent();
fPopup = new PopupNotifier(this);
...
}
don't waste your time, or time will waste you
|
|
|
|

|
In outlook, the popup kan be moved around with the "grip". Can this be done with this borderless form too? Or do i need to look for another solution?
- don't waste your time, or time will waste you -
|
|
|
|

|
I know it is possible...
Maybe you should look at this:
http://www.vbforums.com/showthread.php?t=248176
Cheers,
Nick
|
|
|
|

|
Owkey, this worked. I programmed this in Win XP.
Is it guaranteed to work in Vista as well?
-- modified at 12:10 Wednesday 21st March, 2007
don't waste your time, or time will waste you
|
|
|
|

|
Is there a way to get that envelope-image out of your resources? I was able to save it through "PopupNotifier1.Image.Save("c:\test.bmp", System.Drawing.Imaging.ImageFormat.Bmp)", but that's not the way i want it. I'm wondering if i can find the file itself somewhere in the project ...
- don't waste your time, or time will waste you -
|
|
|
|

|
You can actually look on the web (where the image had originally be found). It's part (or was) of an icon collection reproducing Vista for Windows XP.
I don't know if you can extract it, I don't think so.
Cheers,
Nick
|
|
|
|

|
Great, thanks, didn't know that this was a Vista image.
BTW: I found that icon collection you were talking about: take a look here[^]
-- modified at 11:21 Wednesday 21st March, 2007
don't waste your time, or time will waste you
|
|
|
|

|
Hi, I am using this for a project, but I cant figure out how to actually change the source code so that I can change the way that the popup looks.
I have got it working by copying the PopupNotifier.dll from the demo files to my project directory but I cant seem to figure out how to do it through the source code files. Do I need to edit the source files and then somehow create a dll from these?
Any help is apprieciated!!
|
|
|
|

|
I am actually trying to make the background of the popup window transparent so that I can display my own popup image inside it with text on top, but no luck as of yet.
Please help!!!!!!!!
-------------
Thanks Carl
|
|
|
|

|
You do need to recompile the source code if you want to change the inner workings of the popup. But you can change it's still by changing the properties of the object you created from the dll included in the project.
Cheers,
Nick
|
|
|
|

|
Hi,
I have only been able to make the popup work in form load. If I place them elsewhere, it does not work.
This is the code I am using that works 100% OK in Load but not in other methods (button click, timed loop, etc). Is there some trick to getting this to work?
PopupNotifier pnot = new PopupNotifier();
pnot.TitleText = "Test ToastMe Click";
pnot.ContentText = "Test Content";
pnot.Popup();
pnot.Dispose();
Thanks,
-Andrew
|
|
|
|

|
The problem I guess I am really having is getting this to run in a timed loop.
If I call the method (CheckOnce()) to create and display all popups from inside of the below while loop. The method is executed, but no popups are displayed. I have tried to run the popups as a seperate thread, and as begin invoke -ed, but no success. Does anybody know what am I missing here?
private void CheckingLoop()
{
while (!blStopFlag)
{
if (!blIsCheckingActive)
{
colPopups.Clear();
NotificationItems.Clear();
//BeginInvokeWrapper();
//tWorker = new Thread(new ThreadStart(CheckOnce));
//tWorker.Start();
CheckOnce();
Thread.Sleep(intPollingIntervalSeconds * 1000);
}
else
{
Thread.Sleep(intPollingIntervalSeconds * 1000);
}
}
}
|
|
|
|

|
Hi,
Judging from the screen shots, you have designed a very neat control. However, I cannot run the source codes because I don't have VS 2005 installed on my machine. Can you please port the code to VS .NET because I have a feeling this is the sample code I need for the job assignment.
I cannot trace the code unless I can run and build the project. Please help
Thanks and regards,
Connie
|
|
|
|

|
Hi Connie
Judging from your question, you are a new programmer.
VS.NET comes in 3 versions 2002,2003and 2005 (and soon 2007)
So Think youhave to be more specific.
Why don't you get 2005? It is free from Microsoft
Here is the download link:
http://msdn.microsoft.com/vstudio/express/vb/[^]
|
|
|
|

|
Hi Nick,
I use C# and VS.NET 2003 at work. I will play with code in VS 2005 and try to port it to C#.
Thanks and regards,
Connie Leung
|
|
|
|

|
First of all congratulations on such a cool looking message box!
I just wondered if you can set the hyperlink message line to do something (like link to a web page or something for example) and if so how?
Also is it possible to add Yes or No buttons for example 'Are you sure you want to delete this Item? Yes or No'
Thanks
Dave Swift;)
|
|
|
|

|
Thanks,
In fact the link is not really a link, but it fires the event Click(), which of course is usable, either by using
AddHandler myPopup.Click, AddressOf myClickingSub
or by adding the
Private Sub myPopup_Click() Handles myPopup.Click
End Sub
Now you can of course modify the concept to add two buttons, but this needs to be done directly in the component.
Cheers,
Nick
|
|
|
|

|
Hi all,
I have a timer running every minute. A new notifier should then be displayed every minute. Is this possible? Does someone have an example? Many thanks!
|
|
|
|

|
Hi,
The popup works very well also with some approvements like the popup collection. But there is one problem I'm not able to solve.
Whenever a popup appears I'm losing the focus on the active window. I already tried the option "TopMost = False", but this is not very good as I want to have it always on top until the timer expired or the popup has been clicked.
I hope you can help me with this problem.
Best Regards
Calis
|
|
|
|

|
Hi again,
I found something how to solve the problem but I need help implementing it, hope somebody know
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
With these functions it's possible to make the window TopMost without losing the focus. Now the problem is, that this function doesn't raise the PAINT() Event in the PopupNotifierForm-Class, means, the Form won't get visible. Do you have any suggestions how to solve that? I really hope so, as I don't have any ideas anymore
Calis
|
|
|
|

|
Try this:
Add this code to PopupNotifierForm
Protected Overrides ReadOnly Property ShowWithoutActivation() As Boolean
Get
Return True
End Get
End Property
And this to PopupNotifier
Declare Auto Function SetWindowPos Lib "user32" (ByVal hWnd As IntPtr, _
ByVal hWndInsertAfter As IntPtr, _
ByVal X As Integer, _
ByVal Y As Integer, _
ByVal cx As Integer, _
ByVal cy As Integer, _
ByVal uFlags As UInteger) As Boolean
ReadOnly HWND_BOTTOM As New IntPtr(1)
ReadOnly HWND_NOTOPMOST As New IntPtr(-2)
ReadOnly HWND_TOP As New IntPtr(0)
ReadOnly HWND_TOPMOST As New IntPtr(-1)
ReadOnly SWP_NOSIZE As UInteger = 1
ReadOnly SWP_NOMOVE As UInteger = 2
ReadOnly SWP_NOACTIVATE As UInteger = 16 '0x0010;
...
fPopup.Show()
Dim bRet As Boolean = SetWindowPos(fPopup.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE + SWP_NOACTIVATE)
|
|
|
|
 |