void CTradeGridBase::FillHeader(ITradeTable* pTradeTable) { if (pTradeTable) { m_pTradeTable = pTradeTable; int iCount = m_pTradeTable->GetCount(); SetColumnCount(iCount); SetRowCount(1); SetFixedRowCount(1); SetFixedTextColor(m_crWindowText); SetFixedBkColor(m_cr3DFace); SetTextColor(m_crWindowText); SetGridBkColor(0xFFFFFF); SetTextBkColor(m_crWindowColour); //SetAutoSizeStyle(GVS_DEFAULT); CClientDC dc(this); short tmLen = (short)dc.GetTextExtent("0").cx; for (int i = 0; i < iCount; i++) { ITradeColumn* pItem = m_pTradeTable->GetItems(i); if (pItem) { SetItemData(0, i, (LPARAM)pItem); CString sTmp = pItem->GetDispName(); int nLen = sTmp.GetLength(); SetItemText(0, i, pItem->GetDispName()); SetColumnWidth(i, nLen * tmLen); } } } }
BOOL MyListCtrl::init() { //Create Image list. m_ImageListThumb.DeleteImageList(); m_IconWidth=2; m_IconHeight=27; m_ImageListThumb.Create(m_IconWidth, m_IconHeight, ILC_COLOR24, 0, 1); SetImageList(&m_ImageListThumb, LVSIL_SMALL); m_ShowIcons=FALSE; Arrange(LVSCW_AUTOSIZE); //LVSCW_AUTOSIZE FreeListItems(); // For the resize problem...... m_iNumberOfColumns=2; m_iColumnWidthArray[0]=60; m_iColumnWidthArray[1]=40; m_iColumnWidthArray[2]=110; m_iColumnWidthArray[3]=100; InsertColumn(0,"Name",LVCFMT_LEFT,m_iColumnWidthArray[0]); InsertColumn(1,"Address",LVCFMT_LEFT,m_iColumnWidthArray[1]); // nice flat list- SetExtendedStyle(LVS_EX_GRIDLINES | LVS_EX_FLATSB | LVS_EX_FULLROWSELECT ); // // Setting the header INFO // // Loading header images.. m_HeaderImages.DeleteImageList(); m_HeaderImages.Create(IDB_HEADER, 9*2, 1, RGB(255,255,255)); CHeaderCtrl* pHeader=GetHeaderCtrl(); if(pHeader) { pHeader->SetImageList(&m_HeaderImages); for (int i=0; i < pHeader->GetItemCount(); i++) { SetHeaderIcon(i,-1); } SetBkColor(RGB(255,255,255)); SetTextBkColor(RGB(255,255,255)); SetTextColor(RGB(0,0,0)); SetHeaderIcon(0,0); m_iCurrentSortColumn=0; } ResizeColumns(); return TRUE; }
void CLogListCtrl::SetColors() { m_crWindow = ::GetSysColor(COLOR_WINDOW); m_crWindowTextBk = m_crWindow; SetBkColor(m_crWindow); SetTextBkColor(m_crWindowTextBk); }
void CHappyGoDlg::SetColor(COLORREF bkcr, COLORREF textcr, COLORREF focusbkcr, COLORREF focustextcr) { m_bkColor = bkcr; m_TextColor = textcr; m_FocusbkColor = focusbkcr; m_FocusTextColor = focustextcr; SetBkColor(m_bkColor); SetTextBkColor(m_bkColor); SetTextColor(m_TextColor); }
void CHappyGoDlg::LoadSkin(void) { SetBkColor(CGameImageLink::m_ListResource.m_crBkColor); SetTextBkColor(CGameImageLink::m_ListResource.m_crBkColor); SetTextColor(CGameImageLink::m_ListResource.m_crNormalTxColor); SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_ONECLICKACTIVATE|LVS_EX_INFOTIP); SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE,LVS_EX_FULLROWSELECT,LVS_EX_FULLROWSELECT); //设置图片 if (m_UserStateList.GetSafeHandle()==NULL) { m_UserStateList.DeleteImageList(); //装载位图 BITMAP BmpInfo; CGameImage UserStateBmp; //CBitmap NewUserStateBmp; AfxSetResourceHandle(GetModuleHandle(FACE_DLL_NAME)); UserStateBmp.SetLoadInfo(".\\image\\user_state.bmp",true); AfxSetResourceHandle(GetModuleHandle(NULL)); //UserStateBmp.GetBitmap(&BmpInfo); BmpInfo.bmWidth=UserStateBmp.GetWidth(); BmpInfo.bmHeight=UserStateBmp.GetHeight(); //建立位图 CDC TargetDC, * pDC=GetDC(); TargetDC.CreateCompatibleDC(pDC); if (m_NewUserStateBmp.m_hObject != NULL) { m_NewUserStateBmp.DeleteObject(); } m_NewUserStateBmp.CreateCompatibleBitmap(pDC,BmpInfo.bmWidth,BmpInfo.bmHeight); CBitmap * pOldBmp=TargetDC.SelectObject(&m_NewUserStateBmp); TargetDC.FillSolidRect(0,0,BmpInfo.bmWidth,BmpInfo.bmHeight,CGameImageLink::m_ListResource.m_crBkColor); AFCStretchImage(&TargetDC,0,0,BmpInfo.bmWidth,BmpInfo.bmHeight,UserStateBmp,0,0,BmpInfo.bmWidth,BmpInfo.bmHeight,RGB(255,255,255)); TargetDC.SelectObject(pOldBmp); TargetDC.DeleteDC(); //建立资源列 m_UserStateList.Create(USER_STATE_WIDTH,USER_STATE_HEIGHT,ILC_COLOR16,0,0); m_UserStateList.Add(&m_NewUserStateBmp,RGB(0,0,255)); //清理资源 UserStateBmp.Detach(); //NewUserStateBmp.Detach(); ReleaseDC(pDC); } SetImageList(&m_UserStateList,LVSIL_SMALL); }
//初始化列表 bool CUserListView::InitUserListView() { //加载背景图 if (m_StatusImage.GetSafeHandle()==NULL) { CBitmap Image; BITMAP ImageInfo; Image.LoadBitmap(IDB_USER_STATUS); Image.GetBitmap(&ImageInfo); m_StatusImage.Create(IMGAE_SPACE,ImageInfo.bmHeight,ILC_COLOR16|ILC_MASK,0,0); m_StatusImage.Add(&Image,RGB(255,0,255)); } SetImageList(&m_StatusImage,LVSIL_SMALL); //设置颜色 SetTextColor(RGB(10,10,10)); SetBkColor(RGB(230,249,255)); SetTextBkColor(RGB(230,249,255)); return true; }
void CMyCListCtrl::MyInit() { //用于设置每行的开头产生图标 // m_imagelist.Create(16,16,TRUE,2,2); // m_imagelist.Add(AfxGetApp()->LoadIcon(IDI_ICON4)); // SetImageList(&m_imagelist,LVSIL_SMALL); #if 0 //设置字体 m_font.CreateFont(16, 0,0,0,FW_NORMAL, 0,0,0, DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial"); SetFont(&m_font); #endif SMT_SetListFormat(); SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES); SetBkColor(0xF0FFFF); SetTextColor(0x0F0F0F); SetTextBkColor(0xFFFF00); }
//绑定消息 void CCompanionListCtrl::PreSubclassWindow() { //加载背景图 if (m_ImageList.GetSafeHandle()==NULL) { CBitmap Image; Image.LoadBitmap(IDB_LIST_IMAGE); m_ImageList.Create(24,16,ILC_COLOR16|ILC_MASK,0,0); m_ImageList.Add(&Image,RGB(255,0,255)); } SetImageList(&m_ImageList,LVSIL_SMALL); //设置颜色 SetTextColor(RGB(10,10,10)); SetBkColor(RGB(245,255,205)); SetTextBkColor(RGB(245,255,205)); //加入列表 InsertColumn(0,TEXT("关系名"),LVCFMT_LEFT,100); InsertColumn(1,TEXT("游戏 ID"),LVCFMT_LEFT,80); InsertColumn(2,TEXT("备注信息"),LVCFMT_LEFT,200); __super::PreSubclassWindow(); }
//初始化列表 bool CUserListView::InitUserListView() { //加载背景图 if (m_StatusImage.GetSafeHandle()==NULL) { CBitmap Image; BITMAP ImageInfo; AfxSetResourceHandle(GetModuleHandle(GAMEFRAMEWORK_EXPORTS_NAME)); Image.LoadBitmap(IDB_USER_STATUS); AfxSetResourceHandle(GetModuleHandle(NULL)); Image.GetBitmap(&ImageInfo); m_StatusImage.Create(IMGAE_SPACE,ImageInfo.bmHeight,ILC_COLOR16|ILC_MASK,0,0); m_StatusImage.Add(&Image,RGB(255,0,255)); } SetImageList(&m_StatusImage,LVSIL_SMALL); //设置颜色 SetTextColor(RGB(52,87,130)); //SetBkColor(RGB(217,242,255)); //SetTextBkColor(RGB(217,242,255)); SetBkColor(RGB(165,189,213)); SetTextBkColor(RGB(165,189,213)); //命令行处理 WORD wGameType=GAME_GENRE_SCORE; LPCTSTR lpszCmdLine=AfxGetApp()->m_lpCmdLine; if (lpszCmdLine[0]!=0) { //提出 TOKEN int nStringLength=0; CString strRoomToken; LPCTSTR pszRoomToken=TEXT("/ServerType:"); LPCTSTR lpszBeginString=lpszCmdLine; while (true) { LPCTSTR lpszEndString=_tcschr(lpszBeginString,TEXT(' ')); nStringLength=(lpszEndString==NULL)?lstrlen(lpszBeginString):(int)(lpszEndString-lpszBeginString); //判断标识 const int nTokenLength=lstrlen(pszRoomToken); if ((nStringLength>=nTokenLength)&&(memcmp(lpszBeginString,pszRoomToken,nTokenLength*sizeof(TCHAR))==0)) { CopyMemory(strRoomToken.GetBufferSetLength(nStringLength-nTokenLength),lpszBeginString+nTokenLength, (nStringLength-nTokenLength)*sizeof(TCHAR)); strRoomToken.ReleaseBuffer(); wGameType=(WORD)atol(strRoomToken); break; } //设置变量 if (lpszEndString==NULL) break; lpszBeginString=(lpszEndString+1); } } //插入列表 m_wColumnCount=15; InsertColumn(0,TEXT(""),LVCFMT_LEFT,32); InsertColumn(1,TEXT(""),LVCFMT_LEFT,32); InsertColumn(2,TEXT(""),LVCFMT_LEFT,32); InsertColumn(3,TEXT("用户名"),LVCFMT_LEFT,115); InsertColumn(4,TEXT("昵称"),LVCFMT_LEFT,115); InsertColumn(5,TEXT("游戏点券"),LVCFMT_LEFT,60); InsertColumn(6,TEXT("用户等级"),LVCFMT_LEFT,85); InsertColumn(7,TEXT("积分"),LVCFMT_LEFT,50); InsertColumn(8,TEXT("总局"),LVCFMT_LEFT,60); InsertColumn(9,TEXT("胜局"),LVCFMT_LEFT,60); InsertColumn(10,TEXT("输局"),LVCFMT_LEFT,60); InsertColumn(11,TEXT("和局"),LVCFMT_LEFT,60); InsertColumn(12,TEXT("逃局"),LVCFMT_LEFT,60); InsertColumn(13,TEXT("胜率"),LVCFMT_LEFT,60); InsertColumn(14,TEXT("逃率"),LVCFMT_LEFT,60); m_wDataDescribe[3]=DTP_USER_ACCOUNTS; m_wDataDescribe[4]=DTP_USER_NAME; m_wDataDescribe[5]=DTP_USER_POINT; m_wDataDescribe[6]=DTP_GAME_LEVEL; m_wDataDescribe[7]=DTP_USER_SCORE; m_wDataDescribe[8]=DTP_USER_PLAY_COUNT; m_wDataDescribe[9]=DTP_USER_WIN; m_wDataDescribe[10]=DTP_USER_LOST; m_wDataDescribe[11]=DTP_USER_DRAW; m_wDataDescribe[12]=DTP_USER_FLEE; m_wDataDescribe[13]=DTP_WIN_RATE; m_wDataDescribe[14]=DTP_FLEE_RATE; m_GameRankManagerHelper.CreateInstance(); return true; }