int CIBAGrid::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CBCGPGridCtrl::OnCreate(lpCreateStruct) == -1) return -1; SetReadOnly();//只读 SetWholeRowSel();//整行选中 SetSingleSel(FALSE);//单选 EnableHeader(TRUE, 0);//列表头使能 // Set grid colors CBCGPGridColors colors; colors.m_LeftOffsetColors.m_clrBackground = globalData.clrWindow; colors.m_OddColors.m_clrBackground = RGB(238, 246, 255);// 设置奇数行的背景色 //colors.m_SelColors.m_clrBackground = RGB(50, 50, 180); SetColorTheme(colors);//颜色调配器 SetScrollBarsStyle(CBCGPScrollBar::BCGP_SBSTYLE_VISUAL_MANAGER);//滚动栏样式 return 0; }
/** * @brief 创建列表网格 * @note * @param * @return */ void CGridCtrlList::CreateGrid(CRect& rc,CWnd* pParent) { Create (WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER , rc, pParent, (UINT)-1); // 禁止列排序 EnableHeader (FALSE, BCGP_GRID_HEADER_HIDE_ITEMS); EnableColumnAutoSize(FALSE); EnableDragHeaderItems(FALSE); SetReadOnly (); SetSingleSel(TRUE); SetWholeRowSel(TRUE); EnableDragSelection(FALSE); SetScrollBarsStyle(CBCGPScrollBar::BCGP_SBSTYLE_DEFAULT); ShowVertScrollBar(); BCGP_GRID_COLOR_DATA clrData; clrData = GetColorTheme(); //clrData.m_clrBackground = globalData.clrWindow; //::GetSysColor(COLOR_3DFACE); clrData.m_EvenColors.m_clrBackground = RGB(255,255,255); clrData.m_OddColors.m_clrBackground = RGB(250,253,253); SetColorTheme(clrData); AdjustLayout(); }