Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# WinForm
I have winform with FormBorderStyle = None and I need add deployment form if he touch sides screen (it is easy) , but how add aero demo as form will be deploy, i can not.
Searched in functions Dwmapi.dll, but did not find.
Screenshot.
Posted 31-Mar-13 5:17am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Add the following to your Form:
protected override CreateParams CreateParams
{
   get
   {
      CreateParams cp = base.CreateParams;
      cp.Style |= 0x40000; //WS_SIZEBOX;
      return cp;
   }
}
 
though I usually use:
protected override CreateParams CreateParams
{
   get
   {
      CreateParams cp = base.CreateParams;
      {
         cp.Style |= 0x20000 | 0x80000 | 0x40000; //WS_MINIMIZEBOX | WS_SYSMENU | WS_SIZEBOX;
      }
      return cp;
   }
}
  Permalink  
Comments
cyber_ua at 1-Apr-13 1:57am
   
Does not work if i drag form and touch to sides.
Jack Han at 31-Jul-13 15:21pm
   
Well the borders are ok, but how do I get a control, a panel for a example, to behave as if it were a title bar? And this includes aerosnap? Aslo no aero borders but a custom form that can be resized and have aerosnap properites?
toATwork at 1-Apr-13 12:09pm
   
Dou you have a caption bar? Did you overwrite the HitTest function?
cyber_ua at 1-Apr-13 12:56pm
   
What is the HitTest function?
toATwork at 2-Apr-13 2:49am
   
It is used to determine where the mouse cursor is in the given Form, e.g. border, caption...
Check this out:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms645618%28v=vs.85%29.aspx
cyber_ua at 2-Apr-13 7:12am
   
Does it need that determine cursor location?
What does if cursor touch sides (with form)?
cyber_ua at 2-Apr-13 10:32am
   
If cp.Style = 0x00040000L;// WS_SIZEBOX; the window has a sizing border. Why does when i drag border to top demo show , but if i drag to left or right does not show demo?
toATwork at 2-Apr-13 10:34am
   
This I have never seen before.
cyber_ua at 2-Apr-13 10:38am
   
(int)0x00040000L == 0x40000
http://msdn.microsoft.com/en-us/library/ms632600.aspx
toATwork at 2-Apr-13 10:45am
   
I was referring to the aero dock preview working on the top but not left or right
cyber_ua at 2-Apr-13 10:44am
   
Added borders really help , but did not completely.
How is add demo to left and right borders?
Please help.
toATwork at 2-Apr-13 10:49am
   
Is left+right enabled? Can you do it by keyboard:
http://superuser.com/questions/285356/possible-to-snap-top-bottom-instead-of-just-left-right-in-windows-7
cyber_ua at 2-Apr-13 10:57am
   
Yes, because other programs is can, show demo with touch to left and right sides or i don't understand question !?
toATwork at 2-Apr-13 11:05am
   
Try to do it by keybord as described in the given link, e.g. left half snap (Windows + left)
cyber_ua at 2-Apr-13 11:10am
   
If i use keyboard, it worked.
cyber_ua at 2-Apr-13 11:20am
   
It is strangely, but and on my notebook work same.
toATwork at 2-Apr-13 12:03pm
   
I am sorry but I do not have any further suggestions
cyber_ua at 2-Apr-13 12:10pm
   
Thanks for help, and sorry if i wrote illiterate (I study English ).
P.s I have idea will see source code .net (class Form).
toATwork at 2-Apr-13 14:19pm
   
You are welcome. I hope you figure it out.
cyber_ua at 5-Apr-13 7:04am
   
I was wrong it did not should show demo when drag border to left or right.
But how is show demo when i drag form to sides , as when form dragged for title bar, if at does not exist title bar, instead of him my title bar?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

I found solution, need handle WM_NCHITTEST if cursor on title bar return HTCAPTION. Test code if all form title bar.
 
protected override void WndProc(ref Message message)
        {
            base.WndProc(ref message);
 
            if (message.Msg == WM_NCHITTEST )
                            message.Result = (IntPtr)HTCAPTION;
        }
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 587
1 Sergey Alexandrovich Kryukov 479
2 Maciej Los 305
3 Mathew Soji 195
4 Afzaal Ahmad Zeeshan 170
0 OriginalGriff 7,356
1 Sergey Alexandrovich Kryukov 6,777
2 DamithSL 5,461
3 Manas Bhardwaj 4,916
4 Maciej Los 4,475


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 6 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100