 |
|
 |
The code references:
using Rilling.Common.UI.Controls;
Where do I find this?
|
|
|
|
 |
|
|
 |
|
 |
Hello,
I had a question, when I set the forms Opacity to less than 100% the left and bottom edges are not drawn.
Did anyone has solved this or could point to the section of code that needs to be modified?
Thx
|
|
|
|
 |
|
 |
Yes,I have the problem too.
Coulde anyone sove this problem?
Very Thanks!
|
|
|
|
 |
|
 |
There is memory leak in method WmNCPaint in class BalloonWindow:
instead of writing
private void WmNCPaint(ref System.Windows.Forms.Message m)
{
using(Graphics g = Graphics.FromHdc(GetWindowDC(this.Handle)))
{
OnNCPaint(g);
}
}
must write
private void WmNCPaint(ref System.Windows.Forms.Message m)
{
IntPtr hDC = GetWindowDC(this.Handle);
using(Graphics g = Graphics.FromHdc(hDC))
{
OnNCPaint(g);
}
ReleaseDC(this.Handle, hDC);
}
|
|
|
|
 |
|
 |
ReleaseDC(this.Handle,hDC);
why did you mean by ReleaseDC ???
|
|
|
|
 |
|
 |
I didn't write the "Memory leak bug", but I know he's right.
If you call GetWindowDC, you need call ReleaseDC when you are finshed using it, it says so in MSDN documentation under remarks: http://msdn.microsoft.com/en-us/library/ms534830(VS.85).aspx[^]
It says: "After painting is complete, the ReleaseDC function must be called to release the device context. Not releasing the window device context has serious effects on painting requested by applications."
But really great work, man!
Best regards,
Christian
|
|
|
|
 |
|
 |
No he is not right:
Look at my post for ore details why it is not a memory leak.
Post
You have, what I would term, a very formal turn of phrase not seen in these isles since the old King passed from this world to the next. martin_hughes on VDK
|
|
|
|
 |
|
 |
BTW, here is the API declaration:
[DllImport("User32.dll")]
static extern int ReleaseDC(IntPtr hwnd, IntPtr hDC);
Best regards,
Christian
|
|
|
|
 |
|
 |
No it is not a memory leak nd you should not call RealeaseDC.
IntPtr hDC = GetWindowDC(this.Handle);
using(Graphics g = Graphics.FromHdc(hDC))
{
OnNCPaint(g);
}
The line Graphics.FromHdc(hDC) associates the DC handle with the graphics object. Also see the we use the Graphics object within the using block. So at the end of the using block the Graphics object is disposed. When the graphics object is disposed the hDC object associated with the Graphics object gets released.If you call ReleaseDC there will be a double release of the hDC.
You have, what I would term, a very formal turn of phrase not seen in these isles since the old King passed from this world to the next. martin_hughes on VDK
|
|
|
|
 |
|
 |
Hey, haven't downloaded yet, just wondering if the large icon and black square for closing are the only ones that can be used, or can smaller icons and xp-style close boxes available?
|
|
|
|
 |
|
 |
I am using the control for quite some time now, but I still got two bugs:
- When designing the window and using it afterwards, some controls get cut-off
- When showing the balloon, my form looses focus
Anyone found these too and has a bugfix or workaround?
WM.
What about weapons of mass-construction?
|
|
|
|
 |
|
 |
I found a solution to the focus bug:
[DllImport("user32")]
private static extern long SetWindowLong(long hWnd,long index, long newLong);
[DllImport("user32")]
private static extern long GetWindowLong(long hWnd,long index);
private const long WS_EX_NOACTIVATE = 0x8000000;
private const long GWL_EXSTYLE = -20;
SetWindowLong(this.Handle.ToInt64(),GWL_EXSTYLE,GetWindowLong(
this.Handle.ToInt64(),GWL_EXSTYLE) | WS_EX_NOACTIVATE);
Add the declarations to the class and the SetWindowLong call to the constructor and you don't loose focus of your parent form.
WM.
What about weapons of mass-construction?
|
|
|
|
 |
|
 |
Hahahahahahahaha.
All you had to do is to set the BalloonWindow Property TopMost = false in the Visual Studio Designer.
|
|
|
|
 |
|
 |
I have a MainForm with a Panel1. My project also has a UserControl1. When a nav button is clicked in the MainForm the Usercontrol1 is loaded into the MainForm.Panel1. All that is working beautifully.
I went into the user controls and added a label1 and a button1. When the button1 is clicked the Balloon shows up, but it is not anchoring to the label like it should be! It is way off the screen. I put a breakpoint on Label1 and the Label1.Location property is set to {1,1} which is obviously wrong - it should be {333,500}.
Is there something I can override so I can get the location of the Label1 after the usercontrol has been added to the MainForm.Panel1 ?
|
|
|
|
 |
|
 |
I selected "browse" from the icon combo box, and the program hung. I'm running Win2000 SP3, .Net Framework 1.1
Being in a minority of one, doesn't make you insane George Orwell However, in my case it does
|
|
|
|
 |
|
 |
Guys,
When i inherited the BalloonHelp control and tried to open design mode the form simply
disappeared. I'm sure i'm not the only one that noticed that.
Anyway, the problem lies in the BalloonHelp trying to hook the keyboard/mouse in Design mode.
The fix is very easy, simply check if the form is in Design mode or not :
[BalloonHelp.cs : protected override void OnLoad(System.EventArgs e)]
if (this.DesignMode == false)
{
...
}
Place this line around the CloseOnKeyPress line and the HookCurrentThread one.
I lub this control
|
|
|
|
 |
|
 |
Amazing
Nader
|
|
|
|
 |
|
 |
Hello,
I enjoyed the article!
I had a question, say I had an Icon in the System Tray. How could I get the balloon window to pop up from the icon in system tray?
What I would like to accomplish is something similar to the Windows Update in Windows 2000. When Windows finds an update, it puts the little icon in the system tray and pops up a little balloon window that informs the user that updates are ready to be downloaded. The balloon window does not take focus away from the application, but still appears on top of the application.
Would I be able to do this with the balloon window or with a tool tip?
Thanks!
|
|
|
|
 |
|
 |
you can use the windows api to make the icon and then attatch a tooltip made by windows
__________________________________________
Let's push Satan
|
|
|
|
 |
|
 |
I am new to C# and just getting to grips with the syntax!! However I have made some amendments to the code to track the ballon with the control it is centered into. This was borrowed from Peter Rilling's balloon window project.
I have no idea about the rules for making or suggesting changes? I would also like to change the the code so that if the parent control is moved to a location that would normally make the balloon draw in a different orientation, the balloon will automatically redraw/move.....
below BalloonWindow.cs changes
// Copyright 2001, Joshua Heyer
// Copyright 2002, Rama Krishna (C# version)
private EventHandler __layoutTrackHandler = null;
private EventHandler __visibleHandler = null;
public BalloonWindow()
{
this.__layoutTrackHandler= new EventHandler(TrackLayoutHandler);
this.__visibleHandler = new EventHandler(VisibleHandler);
}
private void VisibleHandler(object sender, EventArgs e)
{
bool visible = ((Control)sender).Visible;
if(m_Control != null)
{
if(visible)
{
this.Visible = true;
RegisterLayoutTracking();
}
else
{
this.Visible = false;
UnregisterLayoutTracking();
}
}
}
private void TrackLayoutHandler(object sender, EventArgs e)
{
this.AnchorPoint = AnchorPointFromControl(m_Control);
}
private void RegisterLayoutTracking()
{
Control cur = m_Control;
do
{
cur.Move += __layoutTrackHandler;
cur.Resize += __layoutTrackHandler;
cur.VisibleChanged += __visibleHandler;
if(cur == m_Control.Parent) break;
} while((cur = m_Control.Parent) != null);
Form form = m_Control.FindForm();
form.Move += __layoutTrackHandler;
form.Resize += __layoutTrackHandler;
form.VisibleChanged += __visibleHandler;
}
private void UnregisterLayoutTracking()
{
Control cur = m_Control;
// Unregister all necessary event handlers.
do
{
cur.Move -= __layoutTrackHandler;
cur.Resize -= __layoutTrackHandler;
if(cur == m_Control.Parent) break;
} while((cur = m_Control.Parent) != null);
Form form = m_Control.FindForm();
form.Move -= __layoutTrackHandler;
form.Resize -= __layoutTrackHandler;
}
|
|
|
|
 |
|
 |
Where must I declare m_Control?
Thomas Bock
|
|
|
|
 |
|
 |
Module level variable
Control m_Control;
public void ShowBalloon(Control anchorControl)
{
this.AnchorPoint = AnchorPointFromControl(anchorControl);
m_Control = anchorControl;
this.Show();
}
|
|
|
|
 |
|
 |
I did it follows as your codes and there was no error ,but the balloon window still did not move when i move the form or control.It looks like did not effected.Is there anything need i do even more?
|
|
|
|
 |
|
 |
Great Article and great code.
But just one question, what OS's or Internet Explorer versions are required to run the balloon windows?
David Kean
|
|
|
|
 |