Home > Software engineering >  Unable to display grid lines ListCtrl list controls
Unable to display grid lines ListCtrl list controls

Time:10-05

Help you a great god, and I add the following code in the VS2010, the type of list is set to the Report, but the list control can't show the grid lines, what reason is this?

BOOL CListDlg: : OnInitDialog ()
{
CDialog: : OnInitDialog ();

//TODO: add additional initialization here
M_listCtrl2. SetExtendedStyle (LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);

//m_listCtrl2 SetBkColor (RGB (0, 0, 0));
M_listCtrl2. SetTextBkColor (RGB (255, 255, 255));//set the text background color
M_listCtrl2. SetTextColor (RGB (10, 10, 80));//set the text color
M_listCtrl2. DeleteAllItems ();//to empty
M_listCtrl2. InsertColumn (0, "number", LVCFMT_LEFT, 50);//add columns
M_listCtrl2. InsertColumn (1, "type", LVCFMT_LEFT, 45);
M_listCtrl2. InsertColumn (2, "value" CAD, LVCFMT_LEFT, 50);
M_listCtrl2. InsertColumn (3, "measured", LVCFMT_LEFT, 50);
M_listCtrl2. InsertColumn (4, "tolerance", LVCFMT_LEFT, 60).
M_listCtrl2. InsertColumn (5, "tolerance", LVCFMT_LEFT, 60).
M_listCtrl2. InsertColumn (6, "deviation", LVCFMT_LEFT, 60).
M_listCtrl2. InsertColumn (7, "state", LVCFMT_LEFT, 55).

M_listCtrl2. SetRedraw (FALSE);//prevent redraw
The UpdateData (FALSE);
M_nItem=0;

Return TRUE;//return TRUE unless you set the focus to a control
//exception: OCX property page should return FALSE
}

CodePudding user response:

M_ListCtrl. SetExtendedStyle (LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_HEADERDRAGDROP);
His look at the STYLE

CodePudding user response:

reference 1st floor like me so good and six response:
m_ListCtrl. SetExtendedStyle (LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_HEADERDRAGDROP);
Oneself see STYLE
STYLE is Report, yes

CodePudding user response:

You make the background color, text color, prevent redraw are commented out, give it a try

CodePudding user response:

M_myListCtrl. SetExtendedStyle (m_myListCtrl. GetExtendedStyle () | LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);

CodePudding user response:

M_listCtrl2. SetRedraw (FALSE);//prevent redraw
Whether the ban on updated SetRedraw suggested to update the data function

CodePudding user response:

M_myListCtrl. SetExtendedStyle (m_myListCtrl. GetExtendedStyle () | | XXX XXX);
  • Related