 |
|
 |
If the slider form is visible and the app loses focus then when reactivating the app with the slider the slider form will not show again. Any thoughts on how to fix this? Again thanks for sharing!
Kevin S. Gallagher
Programming is an art form that fights back
|
|
|
|
 |
|
|
 |
|
 |
I want to design the slide form as per my need.
How to do it in a simple way?
Please update this project with solution and the comments of other user like smoothness of sliding.
That be a great thing for people like me who know less coding.
Thanks again!!
Regards,
RAhooLm
|
|
|
|
 |
|
 |
Thanks for this work. I needed the same thing.
|
|
|
|
 |
|
 |
First off, thanks for the great Control. There are a couple nitpicky issues I have though, and I was curious to get your input on them.
If you have the slide window all the way behind the owner window (fully collapsed) and open a normal dialog from the owner window, it seems that the owner gets sent to the back - and the slide window will be draw on top of the owner until the owner regains focus.
To fix this, I thought it would be as simple as calling Hide() once the window was collapsed, but here is where the "issue" comes in. It seems that Show() (once you want to expand the slide window again) brings the window into focus - and brings it to the front - and there is some flicker where you can see it on top of the owner window for a second before owner.BringToFront() is called.
I can't seem to find any documentation on how it would be possible to override the behavior of Show() in terms of disabling the bring to front action.
My other thought is to slide by resizing the width or height to 0, rather than actually moving the window. Everything would need to be anchored to the side that is sliding out (possibly at runtime in OnLoad()?) and not anchored to the side that the form is growing from, but other than that, it seems like this might be a fair solution.
Other than the listed tradeoffs, is there any reason why this would be a very bad idea?
|
|
|
|
 |
|
 |
a bit detailed... but here it is
The easiest workaround for this would be to add the following line in the SlideDialog Class Constructor...
public SlideDialog(Form poOwner, float pfStep)
{
InitializeComponent();
_oOwner = poOwner;
_fRatio = 0.0f;
SlideStep = pfStep;
if (poOwner != null)
Owner = poOwner.Owner;
poOwner.Paint += new PaintEventHandler(poOwner_Paint);
}
And then add the poOwner_Paint event procedure in the class:
private void poOwner.Paint(object sender, PaintEventArgs e)
{
// Makes sure the form is opened and not still opening before bringing it forward.
if((_bExpand) && (!timer1.Enabled))
this.BringToFront();
}
Finally The last thing you need to do is add the following bold lines in the event Timer_Tick procedure:
private void timer1_Tick(object sender, System.EventArgs e)
{
if (_bExpand)
{
_fRatio += _fStep;
_oOffset += _oStep;
if (_fRatio >= 1)
{
timer1.Stop();
this.BringToFront();
}
}
else
{
_fRatio -= _fStep;
_oOffset -= _oStep;
if (_fRatio <= 0)
{
timer1.Stop();
Hide();
}
}
SetLocation();
}
This will just ensure that your child forms will regain focus when the owner form does...
Just Take One..
|
|
|
|
 |
|
 |
I have added this on top of your stuff so that it does not flicker any more
public void Slide()
{
if (_oOwner != null)
_oOwner.TopMost =true;
if (!_bExpand)
Show();
_bExpand = !_bExpand;
timer1.Start();
if (_oOwner != null)
_oOwner.TopMost =false;
}
thanks
|
|
|
|
 |
|
 |
It's really good example to me. But I found one problem occurred when testing the demo. If the slideForm is closed by "Alt+F4", the application would crash. I have no idea to fix the problem and maybe there will be somebody could. please tell me, thx!!
|
|
|
|
 |
|
 |
When the user presses Alt+F4 it causes the window to be closed and disposed immediately. Then, when the program attempts to access the form (to slide it back, or show it again, or whatever) it raises an ObjectDisposedException. What you need to do is override the OnFormClosing method and if the e.CloseReason is CloseReason.UserClosing then set e.Cancel to true and then hide the form using the normal method.
|
|
|
|
 |
|
 |
Hi,
I have a form 'A' that owns a child SliderWindow, the slider window slides nicely outwards from whichever side i choose. Once the form 'A' becomes owned in an MDI environment, the slider window starts in an arbitrary location and its size is distorted (the window is wider). I've tried different parent form styles (e.g. tool window, dialog..) and different window startup locations (e.g. parent center, window center..). The problem above is incountered in VB.NET, i have not tried C# but i assume the behaviour is the same. I can not find any workarounds. Any hints, pointers or suggestions re: where to look, so i may try and correct this problem by myself? ofcourse i will send you the fix when i have it.
Thank you for a great piece of code!
Mamacita
Been tryin to reach ya.
|
|
|
|
 |
|
 |
Hi,
really cool code, works fine and it's easy to use.
But i missed a solution file where the two projects are nested with project references.
Have a nice day.
.:Greets from Jerry Maguire:.
|
|
|
|
 |
|
 |
Hi,
When I've done the article and the zip to the code project, I've a little trouble with my zip utility, and no time to fix it.
Ths solution of the project is not, in my mind, the major file in this project! ;o)
Sincerely
Christophe
|
|
|
|
 |
|
 |
Hi,
you're right, the solution is not the major file in your project, but it's nice to have such a file. There are so much articles here, if you must create a solution with all references set, you have to do a great job, just to watch the code in action.
.:Greets from Jerry Maguire:.
|
|
|
|
 |
|
 |
This is really cool! I have been trying to create an Apple OS X "drawer" style control and yours is much better!
Is there a way to keep the slide form in the same (or adjacent) plane?
Example. Run the demo, pop open the slide, then bring another app to the foreground. It is possible to "split" the two forms with another app's window.
Thanks!
-jlw
|
|
|
|
 |
|
 |
Hi,
I've found this bug, but I have no time to correct it now. If I can, I would update this article very soon.
But is someone want to correct is himself, send me a mail, so I can update with his solution.
Sincerely
|
|
|
|
 |
|
 |
Hi,
I manage to solve this by overriding the WndProc. (Of course at the 'base' form).
private const int WM_NCACTIVATE = 0x0086;
[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")]
protected override void WndProc(ref Message m)
{
switch(m.Msg)
{
case WM_NCACTIVATE:
if((m.WParam != IntPtr.Zero) && (m.HWnd == this.Handle))
_oSlideForm.BringToFront();
break;
default:
break;
}
base.WndProc (ref m);
}
There still could be some bugs with this - I will be glad if someone find these
|
|
|
|
 |
|
 |
if you want to have access to the 'base' form use this messages
private const int WM_ACTIVATEAPP = 0x001C;
case WM_ACTIVATEAPP:
if((m.WParam != IntPtr.Zero) && (m.HWnd == this.Handle))
_oSlideForm.BringToFront();
break;
but there still is a problem with this situation:
there is parent form A which create the B (our 'base' form), and there is this C form.
when this B form override WndProc and catch this WM_ACTIVEAPP, there is also catched A form message - why this is like that, how to avoid this ??
In this situation A form obtain focus and this C form is bring to front -> pure solution, not well enough... I still search for something better, maybe this handle check m.HWnd == this.Handle doesn't work ??
|
|
|
|
 |
|
 |
I didn't notice in your code where the timer interval can be set (I was looking at SlideDialog.cs). In fact, I didn't notice in the code where you are setting the interval for timer1.
Interesting effect. What in the world did you ever need it for?
Marc
Help! I'm an AI running around in someone's f*cked up universe simulator. Sensitivity and ethnic diversity means celebrating difference, not hiding from it. - Christian Graus Every line of code is a liability - Taka Muraoka
|
|
|
|
 |
|
 |
so much of it is used in multimedia applications, but can suit any other category as you the author may wish!
shagwell bayyeebey!
|
|
|
|
 |