15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


16 to 32 conversion problems

Philip Beck -- splinta@cix.compulink.co.uk
Tuesday, November 26, 1996

Environment: Windows 95, VC++ 4.0

Hi,

I'm converting an SDI app from (mfc 2/16) to (mfc 4/32).

In the 16 bit version the view was exactly the same size as the frame 
which was a fixed size of 200 pixels across. And the view completely 
displayed a bitmap of the same size - so that the bitmap was 100% of what 
the user saw - no frame border or title bar.

In the 32 bit version I can't quite get the same result. There is either 
a thick 3d edge on the frame or a thin ugly edge with the right and 
bottom edges being a white space of 2 pixels.

I remember reading something about this about a year ago but I just can't 
find where I read it...

I have MSDN.

Phil.




Charles N. Johnson -- charlej9@mail.idt.net
Wednesday, November 27, 1996

Phil: to resize your frame to precisely encompass your view add the
following handler to your view class (I happen to have used a class derived
from a CFormView):

void CWinPGPView::OnInitialUpdate() 
{
	CFormView::OnInitialUpdate();
	
	// TODO: Add your specialized code here and/or call the base class

	// get a pointer to the frame for this view
	CFrameWnd* pMainFrame = GetParentFrame();

	// The MainFrame has already been created, so now 
	// ask it to recalculate the layout size as our view is created.
	pMainFrame->RecalcLayout();

	// now resize our parent frame to fit the recalculated size.
	// The first ResizeParentToFit call expands the frame to the size
	// that causes the scroll bars to be removed, then the second 
	// ResizeParentToFit call causes the frame to shrink back to the
	// exact size needed to fit the view without scroll bars appearing.
	// It is important to do both, since doing only the first may
	// resize the window to over fill the screen, and then the user
	// could not manually resize the view, since she could no longer
	// reach the frame.
	ResizeParentToFit(FALSE);
	ResizeParentToFit(TRUE);

}


----------
> From: Philip Beck 
> To: mfc-l@netcom.com
> Cc: splinta@cix.compulink.co.uk
> Subject: 16 to 32 conversion problems
> Date: Tuesday, November 26, 1996 8:00 AM
> 
> Environment: Windows 95, VC++ 4.0
> 
> Hi,
> 
> I'm converting an SDI app from (mfc 2/16) to (mfc 4/32).
> 
> In the 16 bit version the view was exactly the same size as the frame 
> which was a fixed size of 200 pixels across. And the view completely 
> displayed a bitmap of the same size - so that the bitmap was 100% of what

> the user saw - no frame border or title bar.
> 
> In the 32 bit version I can't quite get the same result. There is either 
> a thick 3d edge on the frame or a thin ugly edge with the right and 
> bottom edges being a white space of 2 pixels.
> 
> I remember reading something about this about a year ago but I just can't

> find where I read it...
> 
> I have MSDN.
> 
> Phil.
> 



Dong Chen -- d_chen@ix.netcom.com
Thursday, November 28, 1996

At 02:46 PM 11/26/96 GMT0, you wrote:
>Environment: Windows 95, VC++ 4.0
>
>Hi,
>
>I'm converting an SDI app from (mfc 2/16) to (mfc 4/32).
>
>In the 16 bit version the view was exactly the same size as the frame 
>which was a fixed size of 200 pixels across. And the view completely 
>displayed a bitmap of the same size - so that the bitmap was 100% of what 
>the user saw - no frame border or title bar.
>
>In the 32 bit version I can't quite get the same result. There is either 
>a thick 3d edge on the frame or a thin ugly edge with the right and 
>bottom edges being a white space of 2 pixels.
>
>I remember reading something about this about a year ago but I just can't 
>find where I read it...
>
>I have MSDN.
>
>Phil.
>
>

I think this is a feature of Windows 95 3D look border. When you use
WS_THICKFRAME style for your window, you will get the 3D border of 4 pixels.
If you use WS_BORDER style, you won't get the thick border, the border is
now 3 pixels but the extra 2 pixels (one on each side) will contribute to
the client area. That's what you described as the thin ugly edge. So, you
need to shrink your window. Another thing you can try is to remove the
extended style: WS_EX_CLIENTEDGE or WS_EX_WINDOWEDGE. But I've never done
this before.
Hope this helps.





| Вернуться в корень Архива |