本文整理汇总了C++中GetStyle函数的典型用法代码示例。如果您正苦于以下问题:C++ GetStyle函数的具体用法?C++ GetStyle怎么用?C++ GetStyle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetStyle函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: DrawItem
void CUploadListCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
if (!theApp.emuledlg->IsRunning())
return;
if (!lpDrawItemStruct->itemData)
return;
CDC* odc = CDC::FromHandle(lpDrawItemStruct->hDC);
BOOL bCtrlFocused = ((GetFocus() == this) || (GetStyle() & LVS_SHOWSELALWAYS));
if (lpDrawItemStruct->itemState & ODS_SELECTED) {
if (bCtrlFocused)
odc->SetBkColor(m_crHighlight);
else
odc->SetBkColor(m_crNoHighlight);
}
else
odc->SetBkColor(GetBkColor());
const CUpDownClient* client = (CUpDownClient*)lpDrawItemStruct->itemData;
CMemDC dc(odc, &lpDrawItemStruct->rcItem);
CFont* pOldFont = dc.SelectObject(GetFont());
CRect cur_rec(lpDrawItemStruct->rcItem);
COLORREF crOldTextColor = dc.SetTextColor((lpDrawItemStruct->itemState & ODS_SELECTED) ? m_crHighlightText : m_crWindowText);
if (client->GetSlotNumber() > theApp.uploadqueue->GetActiveUploadsCount()) {
dc.SetTextColor(::GetSysColor(COLOR_GRAYTEXT));
}
int iOldBkMode;
if (m_crWindowTextBk == CLR_NONE){
DefWindowProc(WM_ERASEBKGND, (WPARAM)(HDC)dc, 0);
iOldBkMode = dc.SetBkMode(TRANSPARENT);
}
else
iOldBkMode = OPAQUE;
CKnownFile* file = theApp.sharedfiles->GetFileByID(client->GetUploadFileID());
CHeaderCtrl *pHeaderCtrl = GetHeaderCtrl();
int iCount = pHeaderCtrl->GetItemCount();
cur_rec.right = cur_rec.left - 8;
cur_rec.left += 4;
CString Sbuffer;
for (int iCurrent = 0; iCurrent < iCount; iCurrent++)
{
int iColumn = pHeaderCtrl->OrderToIndex(iCurrent);
if (!IsColumnHidden(iColumn))
{
cur_rec.right += GetColumnWidth(iColumn);
switch (iColumn)
{
case 0:{
uint8 image;
if (client->IsFriend())
image = 4;
else if (client->GetClientSoft() == SO_EDONKEYHYBRID){
if (client->credits->GetScoreRatio(client->GetIP()) > 1)
image = 8;
else
image = 7;
}
else if (client->GetClientSoft() == SO_MLDONKEY){
if (client->credits->GetScoreRatio(client->GetIP()) > 1)
image = 6;
else
image = 5;
}
else if (client->GetClientSoft() == SO_SHAREAZA){
if(client->credits->GetScoreRatio(client->GetIP()) > 1)
image = 10;
else
image = 9;
}
else if (client->GetClientSoft() == SO_AMULE){
if(client->credits->GetScoreRatio(client->GetIP()) > 1)
image = 12;
else
image = 11;
}
else if (client->GetClientSoft() == SO_LPHANT){
if(client->credits->GetScoreRatio(client->GetIP()) > 1)
image = 14;
else
image = 13;
}
else if (client->ExtProtocolAvailable()){
if(client->credits->GetScoreRatio(client->GetIP()) > 1)
image = 3;
else
image = 1;
}
else{
if (client->credits->GetScoreRatio(client->GetIP()) > 1)
image = 2;
else
image = 0;
}
uint32 nOverlayImage = 0;
if ((client->Credits() && client->Credits()->GetCurrentIdentState(client->GetIP()) == IS_IDENTIFIED))
nOverlayImage |= 1;
if (client->IsObfuscatedConnectionEstablished())
nOverlayImage |= 2;
int iIconPosY = (cur_rec.Height() > 16) ? ((cur_rec.Height() - 16) / 2) : 1;
//.........这里部分代码省略.........
开发者ID:acat,项目名称:emule,代码行数:101,代码来源:UploadListCtrl.cpp
示例2: do_open_image
/** Load image from disk, update imgr and imgf
* @return true on success
*/
static bool do_open_image(char const* filename) {
// MessageBox(NULL, filename, "opening image", 0);
if (imgf!=NULL) {
if (imgr!=NULL) { delete imgr; imgr=NULL; }
delete imgf; imgf=NULL;
if (filename2!=NULL) filename2[0]='-'; /* mark file closed */
}
// !! free
// !! check for errors
// !! generalize
SimBuffer::B loadHints;
#if 0
Image::Loader::reader_t reader=in_bmp_loader.checker(
"BM\0\0\0\0" "\0\0\0\0"
"\0\0\0\0" "\0\0\0\0", "", opt);
FILE *f=fopen(filename, "rb");
if (f==NULL) return false;
Image::Sampled *img=reader((Image::filep_t)f, loadHints);
fclose(f);
#endif
init_loader();
SamImageLoad args;
args.filename=filename;
args.loadHints=&loadHints;
Image::Sampled *img=(Image::Sampled*)do_samfun((SamArgs::samfun_t)do_image_load, &args);
if (img==NULL) return false;
// Image::load(filename, loadHints);
imgr=new WinImageRGB(CopyableAdapter(*img));
// Image::Sampled *imgrgb=img->toRGB(8);
// imgr=new WinImageRGB(img->getWd(), img->getHt());
// imgr->fill(0,0,(char)255);
// imgr->fromPPM8(imgrgb->getRowbeg());
assert(imgr!=NULL); /* `operator new' never returns NULL */
// HDC hdc_main=GetDC(hwnd_main);
imgf=new WinFastImage(hwnd_main, imgr->getHbitmap());
wd_last=imgf->getWd(); ht_last=imgf->getHt();
// ReleaseDC(hwnd_main, hdc_main);
slen_t len=strlen(filename);
if (filename2!=NULL) delete [] filename2;
strcpy(filename2=new char[len+3], ": ");
strcpy(filename2+2, filename);
SetWindowText(hwnd_main, filename2);
SetWindowLong(hwnd_main, GWL_STYLE, GetWindowLong(hwnd_main, GWL_STYLE)&~WS_THICKFRAME);
/* ^^^ The Win32 API way to say hwnd_main.setResizable(false); :-) */
InvalidateRect(hwnd_main, NULL, TRUE);
#if 0
LONG fr_wd, fr_ht;
getFrameSize(hwnd_main, fr_wd, fr_ht);
// !! handle minimum window size
SetWindowPos(hwnd_main, NULL, 0, 0, fr_wd+imgf->getWd(), fr_ht+imgf->getHt(), SWP_NOCOPYBITS|SWP_NOMOVE|SWP_NOOWNERZORDER|SWP_NOZORDER);
GdiFlush();
{ /* Dat: strange, two iterations of getFrameSize + SetWindowPos is needed !! still bad */
getFrameSize(hwnd_main, fr_wd, fr_ht);
SetWindowPos(hwnd_main, NULL, 0, 0, fr_wd+imgf->getWd(), fr_ht+imgf->getHt(), SWP_NOCOPYBITS|SWP_NOMOVE|SWP_NOOWNERZORDER|SWP_NOZORDER);
}
BOOL CYourWndOrDialog::ResizeClient (int nWidth, int nHeight, BOOL bRedraw) {
RECT rcWnd;
GetClientRect (&rcWnd);
if(nWidth != -1)
rcWnd.right = nWidth;
if(nHeight != -1)
rcWnd.bottom = nHeight;
if(!::AdjustWindowRectEx(&rcWnd,
GetStyle(),
(!(GetStyle() & WS_CHILD)
&& GetMenu() != NULL)), GetExStyle()))
return FALSE;
UINT uFlags = SWP_NOZORDER | SWP_NOMOVE;
if(!bRedraw)
uFlags |= SWP_NOREDRAW;
return SetWindowPos(NULL,
0, 0,
rcWnd.right - rcWnd.left,
rcWnd.bottom - rcWnd.top,
uFlags);
} // CYourWndOrDialog::ResizeClient
开发者ID:endriff,项目名称:sam2p,代码行数:84,代码来源:vcsam2p.cpp
示例3: OnPaint
void CKofBCGPFontComboBox::OnPaint()
{
if ((GetStyle () & 0x0003L) == CBS_SIMPLE)
{
Default ();
return;
}
if (!m_bVisualManagerStyle && !m_bOnGlass)
{
Default ();
return;
}
CPaintDC dc(this); // device context for painting
BYTE alpha = 0;
if (m_bOnGlass)
{
alpha = 255;
}
CBCGPMemDC memDC (dc, this, alpha);
CDC* pDC = &memDC.GetDC ();
CRect rectClient;
GetClientRect (rectClient);
CBCGPDrawManager dm (*pDC);
dm.DrawRect (rectClient, globalData.clrWindow, (COLORREF)-1);
// 得注释掉这句话
// SendMessage (WM_PRINTCLIENT, (WPARAM) pDC->GetSafeHdc (), (LPARAM) PRF_CLIENT);
const int cxDropDown = ::GetSystemMetrics (SM_CXVSCROLL) + 4;
int nCurSel = GetCurSel();
if (CB_ERR != nCurSel)
{
if (m_Images.GetSafeHandle () == NULL)
{
CBCGPLocalResource locaRes;
m_Images.Create (IDB_BCGBARRES_FONT, nImageWidth, 0, RGB (255, 255, 255));
}
CFont fontSelected;
CFont* pOldFont = NULL;
CRect rc(rectClient);
rc.right -= cxDropDown;
CBCGPFontDesc* pDesc = (CBCGPFontDesc*)GetItemDataPtr(nCurSel);
if (pDesc != NULL)
{
if (pDesc->m_nType & (DEVICE_FONTTYPE | TRUETYPE_FONTTYPE))
{
CPoint ptImage (rc.left + 3, rc.top + (rc.Height () - nImageHeight) / 2);
m_Images.Draw (pDC, pDesc->GetImageIndex (), ptImage, ILD_NORMAL);
}
rc.left += nImageWidth + 9;
if (m_bDrawUsingFont && pDesc->m_nCharSet != SYMBOL_CHARSET)
{
LOGFONT lf;
globalData.fontRegular.GetLogFont (&lf);
lstrcpy (lf.lfFaceName, pDesc->m_strName);
if (pDesc->m_nCharSet != DEFAULT_CHARSET)
{
lf.lfCharSet = pDesc->m_nCharSet;
}
if (lf.lfHeight < 0)
{
lf.lfHeight -= 4;
}
else
{
lf.lfHeight += 4;
}
fontSelected.CreateFontIndirect (&lf);
pOldFont = pDC->SelectObject (&fontSelected);
}
}
CString strText;
GetLBText (nCurSel, strText);
pDC->DrawText (strText, rc, DT_SINGLELINE | DT_VCENTER);
if (pOldFont != NULL)
{
pDC->SelectObject (pOldFont);
}
}
m_rectBtn = rectClient;
m_rectBtn.left = m_rectBtn.right - cxDropDown;
m_rectBtn.DeflateRect (2, 2);
CBCGPDrawOnGlass dog (m_bOnGlass);
//.........这里部分代码省略.........
开发者ID:kaffeel,项目名称:coolformat3.2,代码行数:101,代码来源:KofBCGPFontComboBox.cpp
示例4: GetParamNode
wxObject *wxChoicebookXmlHandler::DoCreateResource()
{
if (m_class == wxT("choicebookpage"))
{
wxXmlNode *n = GetParamNode(wxT("object"));
if ( !n )
n = GetParamNode(wxT("object_ref"));
if (n)
{
bool old_ins = m_isInside;
m_isInside = false;
wxObject *item = CreateResFromNode(n, m_choicebook, NULL);
m_isInside = old_ins;
wxWindow *wnd = wxDynamicCast(item, wxWindow);
if (wnd)
{
m_choicebook->AddPage(wnd, GetText(wxT("label")),
GetBool(wxT("selected")));
if ( HasParam(wxT("bitmap")) )
{
wxBitmap bmp = GetBitmap(wxT("bitmap"), wxART_OTHER);
wxImageList *imgList = m_choicebook->GetImageList();
if ( imgList == NULL )
{
imgList = new wxImageList( bmp.GetWidth(), bmp.GetHeight() );
m_choicebook->AssignImageList( imgList );
}
int imgIndex = imgList->Add(bmp);
m_choicebook->SetPageImage(m_choicebook->GetPageCount()-1, imgIndex );
}
}
else
wxLogError(wxT("Error in resource."));
return wnd;
}
else
{
wxLogError(wxT("Error in resource: no control within choicebook's <page> tag."));
return NULL;
}
}
else
{
XRC_MAKE_INSTANCE(nb, wxChoicebook)
nb->Create(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle(wxT("style")),
GetName());
wxChoicebook *old_par = m_choicebook;
m_choicebook = nb;
bool old_ins = m_isInside;
m_isInside = true;
CreateChildren(m_choicebook, true/*only this handler*/);
m_isInside = old_ins;
m_choicebook = old_par;
return nb;
}
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:66,代码来源:xh_choicbk.cpp
示例5: GetInPlaceActiveItem
//*************************************************************************************
void CBCGPFrameWnd::RecalcLayout (BOOL bNotify)
{
if (m_bInRecalcLayout)
return;
m_bInRecalcLayout = TRUE;
BOOL bWasOleInPlaceActive = m_Impl.m_bIsOleInPlaceActive;
m_Impl.m_bIsOleInPlaceActive = FALSE;
COleClientItem* pActiveItem = GetInPlaceActiveItem ();
if (pActiveItem != NULL && pActiveItem->m_pInPlaceFrame != NULL &&
pActiveItem->GetItemState () == COleClientItem::activeUIState)
{
m_Impl.m_bIsOleInPlaceActive = TRUE;
m_Impl.m_bHadCaption = (GetStyle () & WS_CAPTION) != 0;
}
if (!m_bIsMinimized)
{
CView* pView = GetActiveView ();
if (m_dockManager.IsPrintPreviewValid () ||
m_pNotifyHook != NULL)
{
if (pView != NULL && pView->IsKindOf (RUNTIME_CLASS (CBCGPPrintPreviewView)))
{
m_dockManager.RecalcLayout (bNotify);
CRect rectClient = m_dockManager.GetClientAreaBounds ();
pView->SetWindowPos (NULL, rectClient.left, rectClient.top,
rectClient.Width (), rectClient.Height (),
SWP_NOZORDER | SWP_NOACTIVATE);
}
else
{
if (bNotify && m_pNotifyHook != NULL)
{
ActiveItemRecalcLayout ();
}
else
{
m_bInRecalcLayout = FALSE;
CFrameWnd::RecalcLayout (bNotify);
AdjustClientArea ();
}
}
}
else
{
m_dockManager.RecalcLayout (bNotify);
AdjustClientArea ();
}
}
m_bInRecalcLayout = FALSE;
if (bWasOleInPlaceActive != m_Impl.m_bIsOleInPlaceActive)
{
if (!m_Impl.m_bHadCaption)
{
if (m_Impl.m_bIsOleInPlaceActive)
{
ModifyStyle (0, WS_CAPTION);
}
else
{
ModifyStyle (WS_CAPTION, 0);
}
}
m_Impl.OnChangeVisualManager ();
SetWindowPos (NULL, -1, -1, -1, -1,
SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_FRAMECHANGED);
}
}
开发者ID:cugxiangzhenwei,项目名称:WorkPlatForm,代码行数:79,代码来源:BCGPFrameWnd.cpp
示例6: CalcPositionFromClientRect
bool CWidget::CalcPositionFromClientRect(RECT *pRect) const
{
if (m_hwnd==nullptr)
return false;
return ::AdjustWindowRectEx(pRect,GetStyle(),FALSE,GetExStyle())!=FALSE;
}
开发者ID:nexus7ici,项目名称:TSTask,代码行数:6,代码来源:Widget.cpp
示例7: _
wxString wxNativeFontInfo::ToUserString() const
{
wxString desc;
// first put the adjectives, if any - this is English-centric, of course,
// but what else can we do?
if ( GetUnderlined() )
{
desc << _("underlined");
}
if ( GetStrikethrough() )
{
desc << _(" strikethrough");
}
switch ( GetWeight() )
{
default:
wxFAIL_MSG( wxT("unknown font weight") );
wxFALLTHROUGH;
case wxFONTWEIGHT_NORMAL:
break;
case wxFONTWEIGHT_THIN:
desc << _(" thin");
break;
case wxFONTWEIGHT_EXTRALIGHT:
desc << _(" extra light");
break;
case wxFONTWEIGHT_LIGHT:
desc << _(" light");
break;
case wxFONTWEIGHT_MEDIUM:
desc << _(" medium");
break;
case wxFONTWEIGHT_SEMIBOLD:
desc << _(" semi bold");
break;
case wxFONTWEIGHT_BOLD:
desc << _(" bold");
break;
case wxFONTWEIGHT_EXTRABOLD:
desc << _(" extra bold");
break;
case wxFONTWEIGHT_HEAVY:
desc << _(" heavy");
break;
case wxFONTWEIGHT_EXTRAHEAVY:
desc << _(" extra heavy");
break;
}
switch ( GetStyle() )
{
default:
wxFAIL_MSG( wxT("unknown font style") );
wxFALLTHROUGH;
case wxFONTSTYLE_NORMAL:
break;
// we don't distinguish between the two for now anyhow...
case wxFONTSTYLE_ITALIC:
case wxFONTSTYLE_SLANT:
desc << _(" italic");
break;
}
wxString face = GetFaceName();
if ( !face.empty() )
{
if (face.Contains(' ') || face.Contains(';') || face.Contains(','))
{
face.Replace("'", "");
// eventually remove quote characters: most systems do not
// allow them in a facename anyway so this usually does nothing
// make it possible for FromUserString() function to understand
// that the different words which compose this facename are
// not different adjectives or other data but rather all parts
// of the facename
desc << wxT(" '") << face << wxT("'");
}
else
desc << wxT(' ') << face;
}
else // no face name specified
{
// use the family
wxString familyStr;
//.........这里部分代码省略.........
开发者ID:catalinr,项目名称:wxWidgets,代码行数:101,代码来源:fontcmn.cpp
示例8: return
UINT CIconButtonCtrl::OnGetDlgCode()
{
return ( GetStyle() & BS_DEFPUSHBUTTON ) ? DLGC_DEFPUSHBUTTON : DLGC_UNDEFPUSHBUTTON;
}
开发者ID:GetEnvy,项目名称:Envy,代码行数:4,代码来源:CtrlIconButton.cpp
示例9: sizeof
void CXTPSkinObjectTab::DrawTabText(CDC* pDC, CRect& rcItem, int iItem, int iCount, BOOL bSelected)
{
CTabCtrl* pTabCtrl = (CTabCtrl*)this;
CString strCaption;
LPTSTR pszText = strCaption.GetBuffer(256);
pszText[0] = 0;
TC_ITEM tci;
tci.mask = TCIF_TEXT;
tci.pszText = pszText;
tci.cchTextMax = 255;
BOOL bResult = pTabCtrl->GetItem(iItem, &tci);
strCaption.ReleaseBuffer();
#ifdef _UNICODE
if (!bResult)
{
char tText[256];
tText[0] = 0;
TC_ITEMA tcia;
::ZeroMemory(&tcia, sizeof(TC_ITEMA));
tcia.mask = TCIF_TEXT;
// Get the header item text and format
tcia.pszText = tText;
tcia.cchTextMax = 255;
::SendMessage(pTabCtrl->m_hWnd, TCM_GETITEMA, iItem, (LPARAM)&tcia);
strCaption = tText;
}
#else
if (!bResult)
return;
#endif
if (strCaption.GetLength() == 0)
return;
pDC->SetTextColor(GetColor(COLOR_BTNTEXT));
// Set the font for the tab label.
DWORD dwStyle = GetStyle();
CXTPSkinManagerClass* pClass = GetSkinClass();
int nStateId = bSelected ? TIS_SELECTED: m_nHotItem == iItem ? TIS_HOT : TIS_NORMAL;
int nPartId = iItem == 0 ? TABP_TOPTABITEMLEFTEDGE :
iItem == iCount - 1 && !bSelected ? TABP_TOPTABITEMRIGHTEDGE : TABP_TOPTABITEM;
// Draw the tab label.
if (IsHorz(dwStyle))
{
UINT dsFlags = DT_SINGLELINE | DT_VCENTER | DT_CENTER | DT_END_ELLIPSIS;
if (SendMessage(WM_QUERYUISTATE) & UISF_HIDEACCEL)
{
dsFlags |= DT_HIDEPREFIX;
}
if (!(GetStyle() & TCS_BUTTONS))
{
rcItem.top += bSelected ? -2 : 1;
rcItem.right -= iItem == 0 ? 3 : 0;
}
else
{
rcItem.top += bSelected ? 0 : -1;
}
pClass->DrawThemeText(pDC, nPartId, nStateId, strCaption, dsFlags, &rcItem);
}
else
{
CSize sz = pDC->GetTextExtent(strCaption);
rcItem.left = rcItem.right-(rcItem.Width()-sz.cy + 1)/ 2;
rcItem.top = rcItem.top+(rcItem.Height()-sz.cx + 1)/ 2;
pClass->DrawThemeText(pDC, nPartId, nStateId, strCaption, DT_SINGLELINE | DT_NOCLIP, &rcItem);
}
}
开发者ID:killbug2004,项目名称:ghost2013,代码行数:85,代码来源:XTPSkinObjectTab.cpp
示例10: rcItem
void
MFCSimpleTypeView::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
int m_bClientWidthSel = TRUE;
int m_cxClient = 0;
int m_cxStateImageOffset = 0;
COLORREF m_clrText = ::GetSysColor(COLOR_WINDOWTEXT);
COLORREF m_clrTextBk = ::GetSysColor(COLOR_WINDOW);
COLORREF m_clrBkgnd = ::GetSysColor(COLOR_WINDOW);
CListCtrl& listCtrl=GetListCtrl();
CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
CRect rcItem(lpDrawItemStruct->rcItem);
UINT uiFlags = ILD_TRANSPARENT;
CImageList* pImageList;
int nItem = lpDrawItemStruct->itemID;
BOOL bFocus = (GetFocus() == this);
COLORREF clrTextSave, clrBkSave;
COLORREF clrImage = m_clrBkgnd;
static _TCHAR szBuff[MAX_PATH];
LPCTSTR pszText;
StabEnt *itemSym = SymForItem(nItem);
// get item data
LV_ITEM lvi;
lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
lvi.iItem = nItem;
lvi.iSubItem = 0;
lvi.pszText = szBuff;
lvi.cchTextMax = sizeof(szBuff);
lvi.stateMask = 0xFFFF; // get all state flags
listCtrl.GetItem(&lvi);
BOOL bSelected = (bFocus || (GetStyle() & LVS_SHOWSELALWAYS)) && lvi.state & LVIS_SELECTED;
bSelected = bSelected || (lvi.state & LVIS_DROPHILITED);
// set colors if item is selected
CRect rcAllLabels;
listCtrl.GetItemRect(nItem, rcAllLabels, LVIR_BOUNDS);
CRect rcLabel;
listCtrl.GetItemRect(nItem, rcLabel, LVIR_BOUNDS);
// listCtrl.GetItemRect(nItem, rcLabel, LVIR_LABEL);
rcAllLabels.left = rcLabel.left;
if (m_bClientWidthSel && rcAllLabels.right<m_cxClient)
rcAllLabels.right = m_cxClient;
if (bSelected) {
clrTextSave = pDC->SetTextColor(::GetSysColor(COLOR_HIGHLIGHTTEXT));
clrBkSave = pDC->SetBkColor(::GetSysColor(COLOR_HIGHLIGHT));
pDC->FillRect(rcAllLabels, &CBrush(::GetSysColor(COLOR_HIGHLIGHT)));
}
else
pDC->FillRect(rcAllLabels, &CBrush(m_clrTextBk));
// set color and mask for the icon
if (lvi.state & LVIS_CUT) {
clrImage = m_clrBkgnd;
uiFlags |= ILD_BLEND50;
} else if (bSelected) {
clrImage = ::GetSysColor(COLOR_HIGHLIGHT);
uiFlags |= ILD_BLEND50;
}
// draw state icon
UINT nStateImageMask = lvi.state & LVIS_STATEIMAGEMASK;
if (nStateImageMask) {
int nImage = (nStateImageMask>>12) - 1;
pImageList = listCtrl.GetImageList(LVSIL_STATE);
if (pImageList) {
pImageList->Draw(pDC, nImage,
CPoint(rcItem.left, rcItem.top), ILD_TRANSPARENT);
}
}
// draw normal and overlay icon
/*
CRect rcIcon;
ListCtrl.GetItemRect(nItem, rcIcon, LVIR_ICON);
pImageList = listCtrl.GetImageList(LVSIL_SMALL);
if (pImageList) {
UINT nOvlImageMask=lvi.state & LVIS_OVERLAYMASK;
if (rcItem.left<rcItem.right-1) {
ImageList_DrawEx(pImageList->m_hImageList, lvi.iImage,
pDC->m_hDC,rcIcon.left,rcIcon.top, 16, 16,
m_clrBkgnd, clrImage, uiFlags | nOvlImageMask);
}
}
*/
// draw item label
//.........这里部分代码省略.........
开发者ID:dakyri,项目名称:qua,代码行数:101,代码来源:MFCSimpleTypeView.cpp
示例11: GetPos
void CSliderCtrlEx::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
{
int loopMax = colorList.GetSize(); // number of color ranges to process
LPNMCUSTOMDRAW lpCustDraw = (LPNMCUSTOMDRAW)pNMHDR;
////////////////////////////////////////////////////////////////////////////////
// OnCustomDraw() is called at many different stages during the painting process
// of the control. We only care about the PREPAINT state or the ITEMPREPAINT
// state and not always then.
//
// If we want to be notified about subcontrol painting, we have to say so when
// we get the initial PREPAINT message.
////////////////////////////////////////////////////////////////////////////////
if(lpCustDraw->dwDrawStage == CDDS_PREPAINT)
{
// should we report slider's position?
int curVal = GetPos();
if((m_Callback != NULL) && (curVal != m_oldPosition))
{
m_oldPosition = curVal;
m_Callback(m_p2Object, m_data1, curVal, m_IsDragging);
}
// If we don't have any special coloring to do, skip all the silliness...
if(loopMax <= 0)
{
*pResult = CDRF_DODEFAULT;
}
else
{
// We want to be informed when each part of the control is being
// processed so we can intercept the channel drawing.
*pResult = CDRF_NOTIFYITEMDRAW; // send messages for each piece-part
}
return;
}
///////////////////////////////////////////////////////////////////////////////
// A slider (track control) is drawn in several steps:
// 1. Erase
// 2. Tics
// 3. Channel
// 4. Thumb
//
// It would be nice to capture when the background has been painted and
// before the other sub-pieces have been painted. Then we could just
// substitute our own painting routine. But this doesn't seem to be
// available.
//
// So this routine captures the tics by inserting operations before
// painting the thumb.
//
// Look at the help on NMCUSTOMDRAW for complete details, but the pNMHDR
// pointer looks at a structure like:
//
// typedef struct tagNMCUSTOMDRAWINFO {
// NMHDR hdr;
// DWORD dwDrawStage; // This indicates what stage of the drawing process is involved
// HDC hdc; // graphics context of the control (or sub-component)
// RECT rc;
// DWORD dwItemSpec; // This is the particular piece-part of the slider involved
// UINT uItemState;
// LPARAM lItemlParam;
// } NMCUSTOMDRAW
//
// The stages include CDDS_PREPAINT, which is just before painting of the entire
// control. However, unless the *pResult parameter is set to CDRF_NOTIFYITEMDRAW,
// we will get notification for the control as a whole, not for each piece-part.
// So the first thing to do is set *pResult. Thereafter, we must intercept
// the sub-parts.
//
// We don't care about painting the background (we will re-paint later on). We
// don't care about PREPAINT on the CHANNEL or the TICS since we will overwrite
// everything when we get to the THUMB.
/////////////////////////////////////////////////////////////////////////////////
if((lpCustDraw->dwDrawStage == CDDS_ITEMPREPAINT) && (lpCustDraw->dwItemSpec != TBCD_THUMB))
{
*pResult = CDRF_DODEFAULT;
return;
}
// get channel orientation
BOOL IsVertical = (TBS_VERT & GetStyle()) ? TRUE : FALSE;
// Get the coordinates of the control's window
CRect crect;
GetClientRect(crect); // client coordinates (top = left = 0, bottom = height, right = width)
// Much of this is "paraphrased" from Nic Wilson's work -- see the header file
//////////////////////////////////////////////////////////////////////////////////
// This bit does the tics marks transparently.
// Create a memory dc to hold a copy of the oldbitmap data that includes the tics,
// because when we add the background in we will lose the tic marks.
///////////////////////////////////////////////////////////////////////////////////
CDC *pDC = CDC::FromHandle(lpCustDraw->hdc);
CDC SaveCDC;
CBitmap SaveCBmp;
//.........这里部分代码省略.........
开发者ID:zekoman,项目名称:tibiaauto,代码行数:101,代码来源:SliderCtrlEx.cpp
示例12: rcItem
void CListCtrlEx::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
CRect rcItem(lpDrawItemStruct->rcItem);
UINT uiFlags = ILD_TRANSPARENT;
CImageList* pImageList;
int nItem = lpDrawItemStruct->itemID;
BOOL bFocus = (GetFocus() == this);
COLORREF clrTextSave, clrBkSave;
COLORREF clrImage = m_clrBkgnd;
static _TCHAR szBuff[MAX_PATH];
LPCTSTR pszText;
// get item data
LV_ITEM lvi;
lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
lvi.iItem = nItem;
lvi.iSubItem = 0;
lvi.pszText = szBuff;
lvi.cchTextMax = sizeof(szBuff);
lvi.stateMask = 0xFFFF; // get all state flags
GetItem(&lvi);
BOOL bSelected = (bFocus || (GetStyle() & LVS_SHOWSELALWAYS)) && lvi.state & LVIS_SELECTED;
bSelected = bSelected || (lvi.state & LVIS_DROPHILITED);
// set colors if item is selected
CRect rcAllLabels;
GetItemRect(nItem, rcAllLabels, LVIR_BOUNDS);
CRect rcLabel;
GetItemRect(nItem, rcLabel, LVIR_LABEL);
rcAllLabels.left = rcLabel.left;
if (m_bClientWidthSel && rcAllLabels.right<m_cxClient)
rcAllLabels.right = m_cxClient;
// @@
clrTextSave = pDC->SetTextColor(colTextColor[0]);
if (bSelected)
{
//@@
//clrTextSave = pDC->SetTextColor(::GetSysColor(COLOR_HIGHLIGHTTEXT));
clrBkSave = pDC->SetBkColor(::GetSysColor(COLOR_HIGHLIGHT));
pDC->FillRect(rcAllLabels, &CBrush(::GetSysColor(COLOR_HIGHLIGHT)));
}
else
pDC->FillRect(rcAllLabels, &CBrush(m_clrTextBk));
// set color and mask for the icon
if (lvi.state & LVIS_CUT)
{
clrImage = m_clrBkgnd;
uiFlags |= ILD_BLEND50;
}
else if (bSelected)
{
clrImage = ::GetSysColor(COLOR_HIGHLIGHT);
uiFlags |= ILD_BLEND50;
}
// draw state icon
UINT nStateImageMask = lvi.state & LVIS_STATEIMAGEMASK;
if (nStateImageMask)
{
int nImage = (nStateImageMask>>12) - 1;
pImageList = GetImageList(LVSIL_STATE);
if (pImageList)
{
pImageList->Draw(pDC, nImage,
CPoint(rcItem.left, rcItem.top), ILD_TRANSPARENT);
}
}
// draw normal and overlay icon
CRect rcIcon;
GetItemRect(nItem, rcIcon, LVIR_ICON);
pImageList = GetImageList(LVSIL_SMALL);
if (pImageList)
{
UINT nOvlImageMask=lvi.state & LVIS_OVERLAYMASK;
if (rcItem.left<rcItem.right-1)
{
ImageList_DrawEx(pImageList->m_hImageList, lvi.iImage,
pDC->m_hDC,rcIcon.left,rcIcon.top, 16, 16,
m_clrBkgnd, clrImage, uiFlags | nOvlImageMask);
}
}
// draw item label
GetItemRect(nItem, rcItem, LVIR_LABEL);
//.........这里部分代码省略.........
开发者ID:bugou,项目名称:test,代码行数:101,代码来源:ListCtrlEx.cpp
示例13: return
BOOL CXTPSkinObjectFrame::HasCaption() const
{
return (GetStyle() & WS_CAPTION) == WS_CAPTION;
}
开发者ID:ylyking,项目名称:ThisIsASoftRenderer,代码行数:4,代码来源:XTPSkinObjectFrame.cpp
示例14: GetLong
wxObject *wxRadioBoxXmlHandler::DoCreateResource()
{
if ( m_class == wxT("wxRadioBox"))
{
// find the selection
long selection = GetLong( wxT("selection"), -1 );
// need to build the list of strings from children
m_insideBox = true;
CreateChildrenPrivately( NULL, GetParamNode(wxT("content")));
XRC_MAKE_INSTANCE(control, wxRadioBox)
control->Create(m_parentAsWindow,
GetID(),
GetText(wxT("label")),
GetPosition(), GetSize(),
m_labels,
GetLong(wxT("dimension"), 1),
GetStyle(),
wxDefaultValidator,
GetName());
if (selection != -1)
control->SetSelection(selection);
SetupWindow(control);
const unsigned count = m_labels.size();
for( unsigned i = 0; i < count; i++ )
{
#if wxUSE_TOOLTIPS
if ( !m_tooltips[i].empty() )
control->SetItemToolTip(i, m_tooltips[i]);
#endif // wxUSE_TOOLTIPS
#if wxUSE_HELP
if ( m_helptextSpecified[i] )
control->SetItemHelpText(i, m_helptexts[i]);
#endif // wxUSE_HELP
if ( !m_isShown[i] )
control->Show(i, false);
if ( !m_isEnabled[i] )
control->Enable(i, false);
}
// forget information about the items of this radiobox, we should start
// afresh for the next one
m_labels.clear();
#if wxUSE_TOOLTIPS
m_tooltips.clear();
#endif // wxUSE_TOOLTIPS
#if wxUSE_HELP
m_helptexts.clear();
m_helptextSpecified.clear();
#endif // wxUSE_HELP
m_isShown.clear();
m_isEnabled.clear();
return control;
}
else // inside the radiobox element
{
// we handle handle <item>Label</item> constructs here, and the item
// tag can have tooltip, helptext, enabled and hidden attributes
wxString label = GetNodeContent(m_node);
wxString tooltip;
m_node->GetAttribute(wxT("tooltip"), &tooltip);
wxString helptext;
bool hasHelptext = m_node->GetAttribute(wxT("helptext"), &helptext);
if (m_resource->GetFlags() & wxXRC_USE_LOCALE)
{
label = wxGetTranslation(label, m_resource->GetDomain());
if ( !tooltip.empty() )
tooltip = wxGetTranslation(tooltip, m_resource->GetDomain());
if ( hasHelptext )
helptext = wxGetTranslation(helptext, m_resource->GetDomain());
}
m_labels.push_back(label);
#if wxUSE_TOOLTIPS
m_tooltips.push_back(tooltip);
#endif // wxUSE_TOOLTIPS
#if wxUSE_HELP
m_helptexts.push_back(helptext);
m_helptextSpecified.push_back(hasHelptext);
#endif // wxUSE_HELP
m_isEnabled.push_back(GetBoolAttr("enabled", 1));
m_isShown.push_back(!GetBoolAttr("hidden", 0));
return NULL;
}
//.........这里部分代码省略.........
开发者ID:CyberIntelMafia,项目名称:clamav-devel,代码行数:101,代码来源:xh_radbx.cpp
示例15: dc
void CPartialGroupBox::OnPaint(HDC /*hDC*/)
{
CPaintDC dc(m_hWnd);
//paint groupbox manually
CRect controlrect;
GetClientRect(controlrect);
//::MapWindowPoints(HWND_DESKTOP, GetParent(), (LPPOINT)(LPRECT)controlrect, (sizeof(RECT)/sizeof(POINT)));
CFontHandle font = GetFont();
dc.SelectFont(font);
dc.SetMapMode(MM_TEXT);
dc.SelectBrush(GetSysColorBrush(COLOR_BTNFACE));
TCHAR grptext[MAX_PATH];
GetWindowText(grptext,MAX_PATH);
CRect fontsizerect(0,0,0,0);
dc.DrawText(grptext,-1,fontsizerect,DT_SINGLELINE|DT_LEFT|DT_CALCRECT);
CRect framerect(controlrect);
framerect.top += (fontsizerect.Height())/2;
long Style = GetStyle();
if((Style & 0xF000) == BS_FLAT)
{
dc.Draw3dRect(framerect,RGB(0,0,0),RGB(0,0,0));
framerect.DeflateRect(1,1);
dc.Draw3dRect(framerect,RGB(255,255,255),RGB(255,255,255));
}
else
{
Draw3dLine(dc,framerect,GetSysColor(COLOR_3DSHADOW),GetSysColor(COLOR_3DHILIGHT));
framerect.DeflateRect(1,1);
Draw3dLine(dc,framerect,GetSysColor(COLOR_3DHILIGHT),GetSysColor(COLOR_3DSHADOW));
}
if(_tcslen(grptext))
{
CRect fontrect(controlrect);
fontrect.bottom = controlrect.top+fontsizerect.Height();
if((Style & 0xF00) == BS_RIGHT)
{
fontrect.right -= 6;
fontrect.left = fontrect.right - fontsizerect.Width();
}
else if((Style & 0xF00) == BS_CENTER)
{
fontrect.left += (controlrect.Width()-fontsizerect.Width())/2;
fontrect.right = fontrect.left + fontsizerect.Width();
}
else //BS_LEFT or default
{
fontrect.left += 6;
fontrect.right = fontrect.left + fontsizerect.Width();
}
fontrect.InflateRect(2,0);
dc.FillRect(fontrect,GetSysColor(COLOR_BTNFACE));
fontrect.DeflateRect(2,0);
//Draw Caption
dc.SetBkMode(OPAQUE);
dc.SetBkColor(GetSysColor(COLOR_BTNFACE));
dc.DrawText(grptext,-1,fontrect,DT_SINGLELINE|DT_LEFT);
}
}
开发者ID:NexusTools,项目名称:P64-J,代码行数:71,代码来源:PartialGroupBox.cpp
示例16: GetMDIFrame
void CMDIChildWnd::ActivateFrame(int nCmdShow)
{
BOOL bVisibleThen = (GetStyle() & WS_VISIBLE) != 0;
CMDIFrameWnd* pFrameWnd = GetMDIFrame();
ASSERT_VALID(pFrameWnd);
// determine default show command
if (nCmdShow == -1)
{
// get maximized state of frame window (previously active child)
BOOL bMaximized;
pFrameWnd->MDIGetActive(&bMaximized);
// convert show command based on current style
DWORD dwStyle = GetStyle();
if (bMaximized || (dwStyle & WS_MAXIMIZE))
nCmdShow = SW_SHOWMAXIMIZED;
else if (dwStyle & WS_MINIMIZE)
nCmdShow = SW_SHOWMINIMIZED;
}
// finally, show the window
CFrameWnd::ActivateFrame(nCmdShow);
// update the Window menu to reflect new child window
CMDIFrameWnd* pFrame = GetMDIFrame();
::SendMessage(pFrame->m_hWndMDIClient, WM_MDIREFRESHMENU, 0, 0);
// Note: Update the m_bPseudoInactive flag. This is used to handle the
// last MDI child getting hidden. Windows provides no way to deactivate
// an MDI child window.
BOOL bVisibleNow = (GetStyle() & WS_VISIBLE) != 0;
if (bVisibleNow == bVisibleThen)
return;
if (!bVisibleNow)
{
// get current active window according to Windows MDI
HWND hWnd = (HWND)::SendMessage(pFrameWnd->m_hWndMDIClient,
WM_MDIGETACTIVE, 0, 0);
if (hWnd != m_hWnd)
{
// not active any more -- window must have been deactivated
ASSERT(!m_bPseudoInactive);
return;
}
// check next window
ASSERT(hWnd != NULL);
pFrameWnd->MDINext();
// see if it has been deactivated now...
hWnd = (HWND)::SendMessage(pFrameWnd->m_hWndMDIClient,
WM_MDIGETACTIVE, 0, 0);
if (hWnd == m_hWnd)
{
// still active -- fake deactivate it
ASSERT(hWnd != NULL);
OnMDIActivate(FALSE, NULL, this);
m_bPseudoInactive = TRUE; // so MDIGetActive returns NULL
}
}
else if (m_bPseudoInactive)
{
// if state transitioned from not visible to visible, but
// was pseudo deactivated -- send activate notify now
OnMDIActivate(TRUE, this, NULL);
ASSERT(!m_bPseudoInactive); // should get set in OnMDIActivate!
}
}
开发者ID:VectorDM,项目名称:VC98,代码行数:71,代码来源:WINMDI.CPP
示例17: GetClientRect
void CTextProgressCtrl::OnPaint()
{
if (m_nMin >= m_nMax)
return;
COLORREF crBarColour, crBgColour;
crBarColour = (m_crBarClr == CLR_DEFAULT)? ::GetSysColor(COLOR_HIGHLIGHT) : m_crBarClr;
crBgColour = (m_crBgClr == CLR_DEFAULT)? ::GetSysColor(COLOR_WINDOW) : m_crBgClr;
CRect LeftRect, RightRect, ClientRect;
GetClientRect(ClientRect);
double Fraction = (double)(m_nPos - m_nMin) / ((double)(m_nMax - m_nMin));
CPaintDC PaintDC(this); // device context for painting
CMemDC dc(&PaintDC);
//CPaintDC dc(this); // device context for painting (if not double buffering)
dc.SelectObject(GetParent()->GetFont()); // pja July 1, 2001
// Draw Bar
LeftRect = RightRect = ClientRect;
#ifdef PBS_VERTICAL
DWORD dwStyle = GetStyle();
if (dwStyle & PBS_VERTICAL)
{
LeftRect.top = LeftRect.bottom - (int)((LeftRect.bottom - LeftRect.top)*Fraction);
RightRect.bottom = LeftRect.top;
}
else
#endif
{
LeftRect.right = LeftRect.left + (int)((LeftRect.right - LeftRect.left)*Fraction);
RightRect.left = LeftRect.right;
}
dc.FillSolidRect(LeftRect, crBarColour);
dc.FillSolidRect(RightRect, crBgColour);
// Draw Text if not vertical
if (m_bShowText
#ifdef PBS_VERTICAL
&& (dwStyle & PBS_VERTICAL) == 0
#endif
)
{
CString str;
if (m_strText.GetLength())
str = m_strText;
else
str.Format("%d%%", (int)(Fraction*100.0));
dc.SetBkMode(TRANSPARENT);
DWORD dwTextStyle = DT_CENTER | DT_VCENTER | DT_SINGLELINE;
// If we are drawing vertical, then create a new verticla font
// based on the current font (only works with TrueType fonts)
CFont font, *pOldFont = NULL;
#ifdef PBS_VERTICAL
if (dwStyle & PBS_VERTICAL)
{
LOGFONT lf;
GetFont()->GetLogFont(&lf);
lf.lfEscapement = lf.lfOrientation = 900;
font.CreateFontIndirect(&lf);
pOldFont = (CFont*) dc.SelectObject(&font);
dwTextStyle = DT_VCENTER|DT_CENTER|DT_SINGLELINE;
}
#endif
CRgn rgn;
rgn.CreateRectRgn(LeftRect.left, LeftRect.top, LeftRect.right, LeftRect.bottom);
dc.SelectClipRgn(&rgn);
dc.SetTextColor(m_crTextClr == CLR_DEFAULT ? crBgColour : m_crTextClr);
dc.DrawText(str, ClientRect, dwTextStyle);
rgn.DeleteObject();
rgn.CreateRectRgn(RightRect.left, RightRect.top, RightRect.right, RightRect.bottom);
dc.SelectClipRgn(&rgn);
dc.SetTextColor(m_crTextClr == CLR_DEFAULT ? crBarColour : m_crTextClr);
dc.DrawText(str, ClientRect, dwTextStyle);
if (pOldFont)
{
dc.SelectObject(pOldFont);
font.DeleteObject();
}
}
}
开发者ID:vicentdsmin,项目名称:myie,代码行数:92,代码来源:TextProgressCtrl.cpp
示例18: ReportError
wxObject *wxBitmapComboBoxXmlHandler::DoCreateResource()
{
if (m_class == wxT("ownerdrawnitem"))
{
if ( !m_combobox )
{
ReportError("ownerdrawnitem only allowed within a wxBitmapComboBox");
return NULL;
}
m_combobox->Append(GetText(wxT("text")),
GetBitmap(wxT("bitmap")));
return m_combobox;
}
else /*if( m_class == wxT("wxBitmapComboBox"))*/
{
// find the selection
long selection = GetLong( wxT("selection"), -1 );
XRC_MAKE_INSTANCE(control, wxBitmapComboBox)
control->Create(m_parentAsWindow,
GetID(),
GetText(wxT("value")),
GetPositio
|
请发表评论