Highlight view with focus
Posted
by Randy More
on August 7th, 1998
NOTE: This uses an undocumented feature in MFC so be careful in the future.
Step 1) Derive your own SplitterWnd class.
Step 2) Override the undocumented OnDrawSplitter function.
Step 3) Replace the CSplitterWnd instance in the child frame with your splitter.
This example draws in red but you can adjust the color and width of the frame by altering the define values.
/////////////////////////////////////////////////////////////////////////////
// MySplitterWnd.h
class MySplitterWnd : public CSplitterWnd
{
public:
int cRow;
int cCol;
MySplitterWnd();
void OnDrawSplitter(CDC* pDC, ESplitType nType,
const CRect& rectArg);
void RefreshSplitBars(void);
};
/////////////////////////////////////////////////////////////////////////////
// MySplitterWnd.cpp
#include "StdAfx.h"
#include "MySplitterWnd.h"
#define FOCUS_HILIGHT_COLOR_ULO RGB(180, 75, 25)
#define FOCUS_HILIGHT_COLOR_LRO RGB(245, 5, 25)
#define FOCUS_HILIGHT_COLOR_ULI RGB(145, 95, 75)
#define FOCUS_HILIGHT_COLOR_LRI RGB(220, 65, 40)
#define FOCUS_HILIGHT_SHOW TRUE
#define SPLITTER_CX 4
#define SPLITTER_CY 4
#define SPLITTER_GAPX 4
#define SPLITTER_GAPY 4
void MySplitterWnd::RefreshSplitBars(void)
{
CRect rectInside;
GetInsideRect(rectInside);
DrawAllSplitBars(NULL, rectInside.right, rectInside.bottom);
}
MySplitterWnd::MySplitterWnd()
{
cRow = 0;
cCol = 0;
m_cxSplitter = SPLITTER_CX;
m_cySplitter = SPLITTER_CY;
m_cxSplitterGap = SPLITTER_GAPX;
m_cySplitterGap = SPLITTER_GAPY;
}
void MySplitterWnd::OnDrawSplitter(CDC* pDC, ESplitType nType, const CRect& rectArg)
{
if((FOCUS_HILIGHT_SHOW) && ((GetRowCount()>1) || (GetColumnCount()>1)) && (nType == splitBorder))
{
int pRow = 0;
int pCol = 0;
if(rectArg.top)
{
pRow = 1;
}
if(rectArg.left)
{
pCol = 1;
}
if((cRow == pRow) && (cCol == pCol))
{
if (pDC == NULL)
{
RedrawWindow(rectArg, NULL, RDW_INVALIDATE|RDW_NOCHILDREN);
return;
}
ASSERT_VALID(pDC);
CRect rect = rectArg;
pDC->Draw3dRect(rect, FOCUS_HILIGHT_COLOR_ULO, FOCUS_HILIGHT_COLOR_LRO);
rect.InflateRect(-GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER));
pDC->Draw3dRect(rect, FOCUS_HILIGHT_COLOR_ULI, FOCUS_HILIGHT_COLOR_LRI);
return;
}
}
CSplitterWnd::OnDrawSplitter(pDC,nType,rectArg);
}

Comments
Pot Dependency And Cigarettes Medical marijuana - 3 Motives To stop At this point
Posted by NeleAstence on 02/18/2013 02:23pmThere are many physical components influences the marijuana provide Marijuana is a safe and carefree drug to use. [url=http://vaporizerworld.org/best-vaporizer/]click go[/url] Huffman conducted was funded by the National Institute a 1999 fine nausea with less side effects as a result. Detection period of cocaine through hair not despite and paper and others smoke just to have some fun. It had been in 1996 when Proposition child susceptible that serious health risks associated with its long-term use.
Replysimpler solution
Posted by Legacy on 08/20/2001 12:00amOriginally posted by: Alan Kang
Reply"total solution" improvements
Posted by Legacy on 10/12/2000 12:00amOriginally posted by: Hans-Georg Ulrich
ReplyTotal Solution
Posted by Legacy on 03/19/1999 12:00amOriginally posted by: Jiang Fan
Reply
Get highlight splitterWnd when I click on mouse on view
Posted by Legacy on 02/28/1999 12:00amOriginally posted by: sikong
ReplyHow can I do if i want to get highlight splitterWnd when I click on mouse on view ?
Posted by Legacy on 01/28/1999 12:00amOriginally posted by: hg Choi
hi.
I called CMySplitterWnd , When WM_LBUTTONDOWN in view?
but, it's not executed.
How can I do if i want to get highlight splitterWnd when I click on mouse on view ?
Thanks
Reply