 |
|
|
 |
|
 |
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(); }
|
| Sign In·View Thread·PermaLink | 3.14/5 (6 votes) |
|
|
|
 |
|
 |
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.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
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.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hye Nick...........
AWESOM ARTICLE man ..Thanks for making this difficult code so simple & understandable....
Looking forward to ur next post 
Cheerz !
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
 |
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
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
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.
|
| Sign In·View Thread·PermaLink | 2.00/5 (2 votes) |
|
|
|
 |
|
|
 |
|
 |
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
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
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
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
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
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
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
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
 |
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.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
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 "Content")> _ 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
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
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...
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
 |
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"; }
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
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
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
 |
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
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
 |
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 -
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
 |
I know it is possible...
Maybe you should look at this: http://www.vbforums.com/showthread.php?t=248176
Cheers, Nick
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |