Click here to Skip to main content
13,045,248 members (49,268 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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 1-Apr-13 1:57am
Does not work if i drag form and touch to sides.
Jack Han 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 1-Apr-13 12:09pm
Dou you have a caption bar? Did you overwrite the HitTest function?
cyber_ua 1-Apr-13 12:56pm
What is the HitTest function?
toATwork 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 2-Apr-13 7:12am
Does it need that determine cursor location?
What does if cursor touch sides (with form)?
cyber_ua 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 2-Apr-13 10:34am
This I have never seen before.
cyber_ua 2-Apr-13 10:38am
(int)0x00040000L == 0x40000
toATwork 2-Apr-13 10:45am
I was referring to the aero dock preview working on the top but not left or right
cyber_ua 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 2-Apr-13 10:49am
Is left+right enabled? Can you do it by keyboard:
cyber_ua 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 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 2-Apr-13 11:10am
If i use keyboard, it worked.
cyber_ua 2-Apr-13 11:20am
It is strangely, but and on my notebook work same.
toATwork 2-Apr-13 12:03pm
I am sorry but I do not have any further suggestions
cyber_ua 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 2-Apr-13 14:19pm
You are welcome. I hope you figure it out.
cyber_ua 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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 6 Apr 2013
Copyright © CodeProject, 1999-2017
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