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

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


Raised Window Border

Chet Murphy -- cmurphy@modelworks.com
Tuesday, April 02, 1996

Environment: VC++ 4.1, Windows 95

I want to have a CTreeCtrl with a raised border like the one used by 
VC++ 4.1 project window.  Here is what I've tried:

1 - Use the WS_THICKFRAME style when I create the CTreeCtrl but this 
does not produce quite the same raised border (it's missing the 
top-left inside dark line) and lets the user resize the ctrl which I do 
not want.

2 - Implemented CMiniFrameWnd window around the CTreeCtrl with a 
MFS_4THICKFRAME style, but this too does not create the correct raised 
border.

3- Implemented OnNcPaint() and OnNcCalcSize() for my subclass of 
CTreeCtrl.  This code comes close (it's a little thin) to producing the 
correct raised border but does not allow scroll bars.  This code is 
shown below:

void CProjectView::OnNcPaint() 
{
	CWindowDC dc(this);
	CRect rect;
	GetWindowRect(&rect);
	rect.OffsetRect(-rect.left, -rect.top);

	dc.Draw3dRect(rect, afxData.clrBtnHilite, 
afxData.clrWindowFrame);

	if (afxData.bWin4)
	{
		rect.InflateRect(-CX_BORDER, -CY_BORDER);
		dc.Draw3dRect(rect, afxData.clrBtnFace, 
afxData.clrBtnFace);
		rect.InflateRect(-CX_BORDER, -CY_BORDER);
		dc.Draw3dRect(rect, afxData.clrWindowFrame , 
afxData.clrBtnShadow);
	}
}

void CProjectView::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS 
FAR* lpncsp) 
{
	if (afxData.bWin4)
	{
		::InflateRect(lpncsp->rgrc,
			-(CX_BORDER * 3), -(CY_BORDER * 3));
	}
	else
	{
		::InflateRect(lpncsp->rgrc,
			-CX_BORDER, -CY_BORDER);
	}
}

Any suggestions?

--Chet Murphy
ModelWorks Software
cmurphy@modelworks.com
http://www.modelworks.com/express




Joseph Koral -- jkoral@ftp.com
Thursday, April 04, 1996

[Mini-digest: 2 responses]

Chet Murphy wrote:

>> I want to have a CTreeCtrl with a raised border like the one used by=20
>> VC++ 4.1 project window.  Here is what I've tried:
>>
>> 1 - Use the WS_THICKFRAME style when I create the CTreeCtrl but this=20
>> does not produce quite the same raised border (it's missing the=20
>> top-left inside dark line) and lets the user resize the ctrl which I =
do=20
>> not want.
>>=20
>> 2 - Implemented CMiniFrameWnd window around the CTreeCtrl with a=20
>> MFS_4THICKFRAME style, but this too does not create the correct =
raised=20
>> border.
>>=20
>> 3- Implemented OnNcPaint() and OnNcCalcSize() for my subclass of=20
>> CTreeCtrl.  This code comes close (it's a little thin) to producing =
the=20
>> correct raised border but does not allow scroll bars. =20
>>
>> Any suggestions?

Yes, just add the WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE extended styles =
to the tree control and you will get the effect you are looking for.

- Joseph
-----From: "LeRoy  J. Baxter" 

looks to me like a combination of Client Edge and Modal Frame - both
settable in the Resource Editor




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