| |

VerySource

 Forgot password?
 Register
Search
View: 1194|Reply: 12

In the program, how to dynamically remove the non-client area of ​​the dialog box? ? ?

[Copy link]

2

Threads

8

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-2-7 09:00:01
| Show all posts |Read mode
The dialog box has a non-client area during initialization. When a certain condition is met, how to remove the non-client area? ? ? ? Thank you! !!
Reply

Use magic Report

0

Threads

17

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-3-27 19:30:01
| Show all posts
SetWindowRgn
Reply

Use magic Report

2

Threads

8

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

 Author| Post time: 2020-3-29 18:30:01
| Show all posts
I want to be able to dynamically change the properties of the dialog, that is, change the Border property of the dialog from Resizing to Nono
Reply

Use magic Report

0

Threads

17

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-4-1 15:45:01
| Show all posts
That's not good, as for why, you can try and understand :)
Reply

Use magic Report

2

Threads

8

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

 Author| Post time: 2020-4-1 21:00:01
| Show all posts
I just don't know how to modify it dynamically?
Reply

Use magic Report

2

Threads

16

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 Korea, Republic of

Post time: 2020-4-3 18:00:02
| Show all posts
Try:
DWORD oldstyle = GetWindowLong ();
DWORD newStyle = WS_XXXX; set the style you need
SetWindowLong (olstyle | newstyle);
Reply

Use magic Report

0

Threads

59

Posts

43.00

Credits

Newbie

Rank: 1

Credits
43.00

 China

Post time: 2020-4-3 21:00:02
| Show all posts
Handling WM_NCCALCSIZE messages

void OnNcCalcSize (BOOL bCalcValidRects, NCCALCSIZE_PARAMS * lpncsp)
{
   if (bCalcValidRects)
   {
      int nCYCaption = GetSystemMetrics (SM_CYCAPTION);
      lpncsp-> rgrc [0] .top-= nCYCaption;
   }
   else
   {
      CDialog :: OnNcCalcSize (bCalcValidRects, lpncsp);
   }
}
Reply

Use magic Report

2

Threads

16

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-4-3 22:15:01
| Show all posts
Or, this method must be successful:
GetClientRect (CRect * rc);
GetWindowRect (CRect * rc);
SetWindowRgn (CRgn * rgn);
Reply

Use magic Report

0

Threads

59

Posts

43.00

Credits

Newbie

Rank: 1

Credits
43.00

 China

Post time: 2020-4-3 23:45:01
| Show all posts
For your convenience you can simply modify the window style

DWORD dwStyle = GetWindowLong (m_hWnd, GWL_STYLE);

dwStyle&= ~ WS_CAPTION;

SetWindowLong (m_hWnd, GWL_STYLE, dwStyle);
Reply

Use magic Report

2

Threads

8

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 United States

 Author| Post time: 2020-4-6 16:30:01
| Show all posts
Everyone's method is very good, thank you!
After removing the title bar, the form still has a client area and a non-client area (up, down, left, and right have 3 pixels respectively). I want to be able to dynamically change the dialog box to the right attribute, that is, the dialog box Changed the Border property from Resizing to Nono, so I can get the effect I want.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list