Solved

Border around CListCtrl object?

Posted on 1998-11-21
3
1,469 Views
Last Modified: 2013-11-20
If I add a List Control to my dialog app using the dialog editor, it has a beveled edge around it so the list appears to be sunken in.  When I create a CListCtrl object manually (not with the dialog editor), it just has a thin black border around it.  How can I get the same type of border?
0
Comment
Question by:duncan2
3 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 50 total points
ID: 1325114
Turn off WS_BORDER in the window style. Turn on WS_EX_CLIENTEDGE instead.

  listCtrl->ModifyStyle(WS_BORDER, 0);
  listCtrl->ModifyStyleEx(0, WS_EX_CLIENTEDGE);


0
 
LVL 2

Expert Comment

by:wyy_cq
ID: 1325115
LONG SetWindowLong( HWND hWnd, // handle of window
                    int nIndex,  // offset of value to set
                    LONG dwNewLong )// new value
or CWindow::SetWindowLong(...)
can help you.

set the parameter of nIndex = GWL_EXSTYLE or =GWL_STYLE.
and set the parameter of dwNewLong to the new style .

before you set the new style , you need to get the old style and add to new style flag to it with "OR" .
GetWindowLong(...,GWL_EXSTYLE,...)
GetWindowLong(...,GWL_STYLE,...) can get the current style of the window.
0
 

Author Comment

by:duncan2
ID: 1325116
The WS_EX_CLIENTEDGE style almost works.  When the dialog first appears, the list control has no edge at all.  Then if I adjust the width of the headers, suddenly the edge changes and looks good.  Any more ideas?

0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now