为了突破MFC限制,作了两天摸索结果。。以及他的掘墓人Fancy controls
2009-02-18 16:50
369 查看
/* void CRFAutoTesterView::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) { // TODO: Add your message handler code here and/or call default ASSERT(lpDrawItemStruct->CtlType == ODT_LISTBOX); LPCTSTR lpszText = (LPCTSTR) lpDrawItemStruct->itemData; ASSERT(lpszText != NULL); CDC dc; dc.Attach(lpDrawItemStruct->hDC); // Save these value to restore them when done drawing. COLORREF crOldTextColor = dc.GetTextColor(); COLORREF crOldBkColor = dc.GetBkColor(); // If this item is selected, set the background color // and the text color to appropriate values. Also, erase // rect by filling it with the background color. if ((lpDrawItemStruct->itemAction | ODA_SELECT) && (lpDrawItemStruct->itemState & ODS_SELECTED)) { // dc.SetTextColor(::GetSysColor(COLOR_HIGHLIGHTTEXT)); // dc.SetBkColor(::GetSysColor(COLOR_HIGHLIGHT)); //dc.FillSolidRect(&lpDrawItemStruct->rcItem, // ::GetSysColor(COLOR_HIGHLIGHT)); dc.SetTextColor(RGB(138, 43, 29)); //my set dc.SetBkColor(RGB(255, 255, 0)); dc.FillSolidRect(&lpDrawItemStruct->rcItem, RGB(255, 255, 0)); } else { dc.FillSolidRect(&lpDrawItemStruct->rcItem, crOldBkColor); } // If this item has the focus, draw a red frame around the // item's rect. if ((lpDrawItemStruct->itemAction | ODA_FOCUS) && (lpDrawItemStruct->itemState & ODS_FOCUS)) { CBrush br(RGB(255, 255, 0)); dc.FrameRect(&lpDrawItemStruct->rcItem, &br); } LOGFONT lf; dc.GetCurrentFont()->GetLogFont(&lf); CFont font, *pOldFont; lstrcpy(lf.lfFaceName,_T("System")); lf.lfHeight=15; // lf.lfWidth=0; lf.lfWeight=1000; font.CreateFontIndirect(&lf); pOldFont=dc.SelectObject(&font); // Draw the text. dc.SetTextColor(RGB(138,43,226)); UpdateData(TRUE); if (m_list_box!="") { dc.DrawText(lpszText,(int)_tcslen(lpszText),&lpDrawItemStruct->rcItem,DT_LEFT|DT_SINGLELINE|DT_VCENTER); } // Reset the background color and the text color back to their // original values. dc.SetBkColor(crOldBkColor); dc.Detach(); } *//* void CRFAutoTesterView::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) { // TODO: Add your message handler code here and/or call default ASSERT(lpMeasureItemStruct->CtlType == ODT_LISTBOX); LPCTSTR lpszText = (LPCTSTR) lpMeasureItemStruct->itemData; ASSERT(lpszText != NULL); CSize sz; CDC* pDC = GetDC(); sz = pDC->GetTextExtent(lpszText); ReleaseDC(pDC); lpMeasureItemStruct->itemHeight = 1.5*sz.cy; // CFormView::OnMeasureItem(nIDCtl, lpMeasureItemStruct); }*/
相关文章推荐
- 对MOSS 2007中People Picker返回的结果进行限制 以及关于People Picker的小结
- Excel LOOKUP的运用,以及突破IF嵌套的七层限制
- 修改ACE的Reactor模式示例中的参数后测试,依据测试结果,猜测Reactor似乎可以突破62个事件的限制。但是...
- 利用java调用百度API接口,解析返回的json数据,突破百度API接口调用结果的限制
- 突破常规限制运行Asp木马
- 各种数据库限制结果集行数总结
- 突破SecureCRT for Linux的30天使用限制
- select和poll程序测试以及结果分析
- 数据库限制结果集行数(可用于分页)
- 关于scanf的疑惑以及测试结果
- 如何突破mnesia中关于atom最大数值的限制
- Android 简单限制小数点后的位数以及只能以一个0开头
- winform程序限制多开以及FromMian 为主线程思路
- 如何突破局域网限制
- 网页的入度、出度以及Pagerank结果
- 突破空格的限制
- MFC中设置静态文本的字体颜色、背景透明以及解决字体重叠
- input文件上传,修改样式以及限制文件格式