Click here to Skip to main content
11,802,389 members (30,356 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C#
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.
Posted 31-Mar-13 4:17am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Add the following to your Form:
protected override CreateParams CreateParams
      CreateParams cp = base.CreateParams;
      cp.Style |= 0x40000; //WS_SIZEBOX;
      return cp;

though I usually use:
protected override CreateParams CreateParams
      CreateParams cp = base.CreateParams;
         cp.Style |= 0x20000 | 0x80000 | 0x40000; //WS_MINIMIZEBOX | WS_SYSMENU | WS_SIZEBOX;
      return cp;
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:
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
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:
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
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;

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

  Print Answers RSS
0 OriginalGriff 475
1 KrunalRohit 366
2 F-ES Sitecore 295
3 Afzaal Ahmad Zeeshan 230
4 CHill60 220
0 OriginalGriff 2,950
1 Maciej Los 1,910
2 KrunalRohit 1,862
3 CPallini 1,645
4 Richard MacCutchan 1,157

Advertise | Privacy | Mobile
Web03 | 2.8.151002.1 | Last Updated 6 Apr 2013
Copyright © CodeProject, 1999-2015
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