Software focuses on general application software development. We provide complete solution for developers. No matter you want to develop a simple database
workflow application, or an large flow/diagram based system, our product will provide a complete solution for you. Our product had been used by hundreds of top companies around the world!
"100% source code provided! Free you from not daring to use components because of unable to master the key technology of components!"
GetWindowRect, SubclassWindow, GetWindowLong, SetWindowLong,
Drawing, VC++, source code
Download demo project - 56 Kb
Download source files - 37 Kb
I think that the
default look of common
is not cool enough (for the year 2000) when the control
is used with scrolling tabs:
class uses my CLBSpinButtonCtrl class (see "Owner
drawn spin button control with autodisabling
arrow buttons" article) and completly
draw itself to look
Beside that, my
class has "autoraising items" feature. It means, that
when mouse is over inactive item, that item is
drawn higher then
other inactive items and its right border became darker.
This feature also persist when
tab control is used in stacked mode:
and LBTabCtrl.cpp to your project.
Create a new
class derived from
and add it to project.
LBTabCtrl.h file in the header file of just created
Add a member
variable to that
common tab control
good place to do this - in the virtual member
BOOL bResult =CPropertySheet::OnInitDialog();
CTabCtrl *pTab =GetTabControl();
After that you
can use that
class everywhere as usual
CLBTabDemoPropSheet sheet("Any Title");
Certainly you also can subclass any
which does not lives within
is owner drawn tab control.
To make its job this control handles the following
It also overrides
virtual member functions of
is a possibility to switch off /on the "autoraising
items" feature of
CLBTabCtrl, using its
public member function [
autoraising items work
Only handling of
does the trick. When the mouse enters the
and in that moment I use
API to be notified with
message, when the mouse leaves tab control. This
API,declared in "Commctrl.h", tries to use the window
manager's implementation of
if it is present(for Win98/NT), otherwise it emulates
stTRACKMOUSEEVENT.cbSize = sizeof(stTRACKMOUSEEVENT);
After that used
approach is straightforward:
handler I invalidate the item which is under mouse
to draw it as
raised and also invalidate item which was raised
before as normal (unraised).
handler I invalidate item which was raised before
draw it as normal (unraised).
CLBSpinButtonCtrl is involved
substitutes the common up-down control which used within
scrolling mode. It is done in the virtual member
There I look for msctls_updown32 control and if it is
present, modify its size, position and subclass it to
which have autodisabling arrow buttons.
CWnd* pWnd = GetWindow(GW_CHILD);
Handling the TCN_SELCHANGING
and TCN_SELCHANGE messages
These messages are
handled as reflected notification messages. After my
handlers do the job, the parent window also get a chance
to handle it.
control (and its parent) handles
message, the system will send to it
messages. Since at that moment I still don't know which
item has become active, and can not properly
draw items, I have
to avoid these
messages to get rid of flickering.
control do not receive
messages if it is invisible, so I temporary set the
appropriate visible bits off and the
control thinks it is
visible even though it is not.
DWORD dwStyle = ::GetWindowLong(m_hWnd,GWL_STYLE);
if (dwStyle & WS_VISIBLE)
::SetWindowLong(m_hWnd, GWL_STYLE, (dwStyle & ~ WS_VISIBLE));
I set visible bits
back on in
handler, when it is good time to redraw
Handling the WM_PAINT message
First of all to
get rid of flickering I'm drawing to memory DC (dc).
So I have to create compatible memory DC and select
bitmap into it.
After that I
check if current repaint has happened due to
autoraised item. If so, I repaint only raised item.
Otherwise I repaint parts of border of
which overlapped by update region. After that I draw
all inactive items which intersects the update
region. And in the last turn the active item is
drawn, in case if it also intersects the update
drawing of items
I've used virtual member function DrawItem of
virtual member function DrawItemRect, added to
At the final
step I copy the resulting bitmap from memory DC to
the screen, using
These files may be
redistributed unmodified by any means providing
it is not sold for profit without the authors written
consent, and providing that the authors name and all
copyright notices remains intact. This code may be used
in compiled form in any way you wish with the following
source code is used in any commercial product
then a statement along the lines of "Portions Copyright
(C) 1999 Oleg Lobach" must be included in the startup
banner, "About" box or printed
source code may not be compiled into a
standalone library and sold for profit. In any other
cases the code is free to whoever wants it anyway!
This software is
provided "as is" without express or implied warranty.The
author accepts no liability for any damages to your
computer or data these products may cause.