亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? colourpopup.cpp

?? WinCE開發技巧與實例的配套源碼
?? CPP
?? 第 1 頁 / 共 3 頁
字號:

    return TRUE;
}

// Works out an appropriate size and position of this window
void CColourPopup::SetWindowSize()
{
    CSize TextSize;

    // If we are showing a custom or default text area, get the font and text size.
    if (m_strCustomText.GetLength() || m_strDefaultText.GetLength())
    {
        CClientDC dc(this);
        CFont* pOldFont = (CFont*) dc.SelectObject(&m_Font);

        // Get the size of the custom text (if there IS custom text)
        TextSize = CSize(0,0);
        if (m_strCustomText.GetLength())
            TextSize = dc.GetTextExtent(m_strCustomText);

        // Get the size of the default text (if there IS default text)
        if (m_strDefaultText.GetLength())
        {
            CSize DefaultSize = dc.GetTextExtent(m_strDefaultText);
            if (DefaultSize.cx > TextSize.cx) TextSize.cx = DefaultSize.cx;
            if (DefaultSize.cy > TextSize.cy) TextSize.cy = DefaultSize.cy;
        }

        dc.SelectObject(pOldFont);
        TextSize += CSize(2*m_nMargin,2*m_nMargin);

        // Add even more space to draw the horizontal line
        TextSize.cy += 2*m_nMargin + 2;
    }

    // Get the number of columns and rows
    //m_nNumColumns = (int) sqrt((double)m_nNumColours);    // for a square window (yuk)
    m_nNumColumns = 8;
    m_nNumRows = m_nNumColours / m_nNumColumns;
    if (m_nNumColours % m_nNumColumns) m_nNumRows++;

    // Get the current window position, and set the new size
    CRect rect;
    GetWindowRect(rect);

    m_WindowRect.SetRect(rect.left, rect.top, 
                         rect.left + m_nNumColumns*m_nBoxSize + 2*m_nMargin,
                         rect.top  + m_nNumRows*m_nBoxSize + 2*m_nMargin);

    // if custom text, then expand window if necessary, and set text width as
    // window width
    if (m_strDefaultText.GetLength()) 
    {
        if (TextSize.cx > m_WindowRect.Width())
            m_WindowRect.right = m_WindowRect.left + TextSize.cx;
        TextSize.cx = m_WindowRect.Width()-2*m_nMargin;

        // Work out the text area
        m_DefaultTextRect.SetRect(m_nMargin, m_nMargin, 
                                  m_nMargin+TextSize.cx, 2*m_nMargin+TextSize.cy);
        m_WindowRect.bottom += m_DefaultTextRect.Height() + 2*m_nMargin;
    }

    // if custom text, then expand window if necessary, and set text width as
    // window width
    if (m_strCustomText.GetLength()) 
    {
        if (TextSize.cx > m_WindowRect.Width())
            m_WindowRect.right = m_WindowRect.left + TextSize.cx;
        TextSize.cx = m_WindowRect.Width()-2*m_nMargin;

        // Work out the text area
        m_CustomTextRect.SetRect(m_nMargin, m_WindowRect.Height(), 
                                 m_nMargin+TextSize.cx, 
                                 m_WindowRect.Height()+m_nMargin+TextSize.cy);
        m_WindowRect.bottom += m_CustomTextRect.Height() + 2*m_nMargin;
   }

    // Need to check it'll fit on screen: Too far right?
    CSize ScreenSize(::GetSystemMetrics(SM_CXSCREEN), ::GetSystemMetrics(SM_CYSCREEN));
    if (m_WindowRect.right > ScreenSize.cx)
        m_WindowRect.OffsetRect(-(m_WindowRect.right - ScreenSize.cx), 0);

    // Too far left?
    if (m_WindowRect.left < 0)
        m_WindowRect.OffsetRect( -m_WindowRect.left, 0);

    // Bottom falling out of screen?
    if (m_WindowRect.bottom > ScreenSize.cy)
    {
        CRect ParentRect;
        m_pParent->GetWindowRect(ParentRect);
        m_WindowRect.OffsetRect(0, -(ParentRect.Height() + m_WindowRect.Height()));
    }

    // Set the window size and position
    MoveWindow(m_WindowRect, TRUE);
}


#ifndef _WIN32_WCE


// CColourPopup::CreateToolTips
//
//		Tooltips are only available in the Desktop version
//
void CColourPopup::CreateToolTips()
{
    // Create the tool tip
    if (!m_ToolTip.Create(this)) return;

    // Add a tool for each cell
    for (int i = 0; i < m_nNumColours; i++)
    {
        CRect rect;
        if (!GetCellRect(i, rect)) continue;
            m_ToolTip.AddTool(this, GetColourName(i), rect, 1);
    }
}

#endif


void CColourPopup::ChangeSelection(int nIndex)
{
    CClientDC dc(this);        // device context for drawing

    if (nIndex > m_nNumColours)
        nIndex = CUSTOM_BOX_VALUE; 

    if ((m_nCurrentSel >= 0 && m_nCurrentSel < m_nNumColours) ||
        m_nCurrentSel == CUSTOM_BOX_VALUE || m_nCurrentSel == DEFAULT_BOX_VALUE)
    {
        // Set Current selection as invalid and redraw old selection (this way
        // the old selection will be drawn unselected)
        int OldSel = m_nCurrentSel;
        m_nCurrentSel = INVALID_COLOUR;
        DrawCell(&dc, OldSel);
    }

    // Set the current selection as row/col and draw (it will be drawn selected)
    m_nCurrentSel = nIndex;
    DrawCell(&dc, m_nCurrentSel);

    // Store the current colour
    if (m_nCurrentSel == CUSTOM_BOX_VALUE)
        m_pParent->SendMessage(CPN_SELCHANGE, (WPARAM) m_crInitialColour, 0);
    else if (m_nCurrentSel == DEFAULT_BOX_VALUE)
    {
        m_crColour = CLR_DEFAULT;
        m_pParent->SendMessage(CPN_SELCHANGE, (WPARAM) CLR_DEFAULT, 0);
    }
    else
    {
        m_crColour = GetColour(m_nCurrentSel);
        m_pParent->SendMessage(CPN_SELCHANGE, (WPARAM) m_crColour, 0);
    }
}



void CColourPopup::EndSelection(int nMessage)
{
    ReleaseCapture();

#ifndef _WIN32_WCE

	//
	// This code is removed from the CE version, especially for PocketPC 2002 since
	// MFC does not directly support the CColorDialog. It is there, but you have to
	// explicitly link in commdlg.lib and use the ChooseColor API in commdlg.h
	// The result is not very nice: you get a dialog similar to this control, but
	// a VERY UGLY one. It does not seem to conform to PocketPC 2002 specs.
	//

    // If custom text selected, perform a custom colour selection
    if (nMessage != CPN_SELENDCANCEL && m_nCurrentSel == CUSTOM_BOX_VALUE)
    {
        m_bChildWindowVisible = TRUE;

        CColorDialog dlg(m_crInitialColour, CC_FULLOPEN | CC_ANYCOLOR, this);

        if (dlg.DoModal() == IDOK)
            m_crColour = dlg.GetColor();
        else
            nMessage = CPN_SELENDCANCEL;

        m_bChildWindowVisible = FALSE;
    } 
#endif


    if (nMessage == CPN_SELENDCANCEL)
        m_crColour = m_crInitialColour;

    m_pParent->SendMessage(nMessage, (WPARAM) m_crColour, 0);
    
    // Kill focus bug fixed by Martin Wawrusch
    if (!m_bChildWindowVisible)
        DestroyWindow();
}

void CColourPopup::DrawCell(CDC* pDC, int nIndex)
{
    // For the Custom Text area
    if (m_strCustomText.GetLength() && nIndex == CUSTOM_BOX_VALUE)
    {
        // The extent of the actual text button
        CRect TextButtonRect = m_CustomTextRect;
        TextButtonRect.top += 2*m_nMargin;

        // Fill background
        pDC->FillSolidRect(TextButtonRect, ::GetSysColor(COLOR_3DFACE));

        // Draw horizontal line
        pDC->FillSolidRect(m_CustomTextRect.left+2*m_nMargin, m_CustomTextRect.top,
                           m_CustomTextRect.Width()-4*m_nMargin, 1, ::GetSysColor(COLOR_3DSHADOW));
        pDC->FillSolidRect(m_CustomTextRect.left+2*m_nMargin, m_CustomTextRect.top+1,
                           m_CustomTextRect.Width()-4*m_nMargin, 1, ::GetSysColor(COLOR_3DHILIGHT));

        TextButtonRect.DeflateRect(1,1);

        // fill background
        if (m_nChosenColourSel == nIndex && m_nCurrentSel != nIndex)
            pDC->FillSolidRect(TextButtonRect, ::GetSysColor(COLOR_3DLIGHT));
        else
            pDC->FillSolidRect(TextButtonRect, ::GetSysColor(COLOR_3DFACE));

        // Draw button
        if (m_nCurrentSel == nIndex) 
            pDC->DrawEdge(TextButtonRect, BDR_RAISEDINNER, BF_RECT);
        else if (m_nChosenColourSel == nIndex)
            pDC->DrawEdge(TextButtonRect, BDR_SUNKENOUTER, BF_RECT);

        // Draw custom text
        CFont *pOldFont = (CFont*) pDC->SelectObject(&m_Font);
        pDC->SetBkMode(TRANSPARENT);
        pDC->DrawText(m_strCustomText, TextButtonRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
        pDC->SelectObject(pOldFont);

        return;
    }        

    // For the Default Text area
    if (m_strDefaultText.GetLength() && nIndex == DEFAULT_BOX_VALUE)
    {
        // Fill background
        pDC->FillSolidRect(m_DefaultTextRect, ::GetSysColor(COLOR_3DFACE));

        // The extent of the actual text button
        CRect TextButtonRect = m_DefaultTextRect;
        TextButtonRect.DeflateRect(1,1);

        // fill background
        if (m_nChosenColourSel == nIndex && m_nCurrentSel != nIndex)
            pDC->FillSolidRect(TextButtonRect, ::GetSysColor(COLOR_3DLIGHT));
        else
            pDC->FillSolidRect(TextButtonRect, ::GetSysColor(COLOR_3DFACE));

        // Draw thin line around text
        CRect LineRect = TextButtonRect;
        LineRect.DeflateRect(2*m_nMargin,2*m_nMargin);
        CPen pen(PS_SOLID, 1, ::GetSysColor(COLOR_3DSHADOW));
        CPen* pOldPen = pDC->SelectObject(&pen);
        pDC->SelectStockObject(NULL_BRUSH);
        pDC->Rectangle(LineRect);
        pDC->SelectObject(pOldPen);

        // Draw button
        if (m_nCurrentSel == nIndex) 
            pDC->DrawEdge(TextButtonRect, BDR_RAISEDINNER, BF_RECT);
        else if (m_nChosenColourSel == nIndex)
            pDC->DrawEdge(TextButtonRect, BDR_SUNKENOUTER, BF_RECT);

        // Draw custom text
        CFont *pOldFont = (CFont*) pDC->SelectObject(&m_Font);
        pDC->SetBkMode(TRANSPARENT);
        pDC->DrawText(m_strDefaultText, TextButtonRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
        pDC->SelectObject(pOldFont);

        return;
    }        

    CRect rect;
    if (!GetCellRect(nIndex, rect)) return;

    // Select and realize the palette
    CPalette* pOldPalette = NULL;
    if (pDC->GetDeviceCaps(RASTERCAPS) & RC_PALETTE)
    {
        pOldPalette = pDC->SelectPalette(&m_Palette, FALSE);
        pDC->RealizePalette();
    }

    // fill background
    if (m_nChosenColourSel == nIndex && m_nCurrentSel != nIndex)
        pDC->FillSolidRect(rect, ::GetSysColor(COLOR_3DHILIGHT));
    else
        pDC->FillSolidRect(rect, ::GetSysColor(COLOR_3DFACE));

    // Draw button
    if (m_nCurrentSel == nIndex) 
        pDC->DrawEdge(rect, BDR_RAISEDINNER, BF_RECT);
    else if (m_nChosenColourSel == nIndex)
        pDC->DrawEdge(rect, BDR_SUNKENOUTER, BF_RECT);

    CBrush brush(PALETTERGB(GetRValue(GetColour(nIndex)), 
                            GetGValue(GetColour(nIndex)), 
                            GetBValue(GetColour(nIndex)) ));
    CPen   pen;
    pen.CreatePen(PS_SOLID, 1, ::GetSysColor(COLOR_3DSHADOW));

    CBrush* pOldBrush = (CBrush*) pDC->SelectObject(&brush);
    CPen*   pOldPen   = (CPen*)   pDC->SelectObject(&pen);

    // Draw the cell colour
    rect.DeflateRect(m_nMargin+1, m_nMargin+1);
    pDC->Rectangle(rect);

    // restore DC and cleanup
    pDC->SelectObject(pOldBrush);
    pDC->SelectObject(pOldPen);
    brush.DeleteObject();
    pen.DeleteObject();

    if (pOldPalette && pDC->GetDeviceCaps(RASTERCAPS) & RC_PALETTE)
        pDC->SelectPalette(pOldPalette, FALSE);
}

BOOL CColourPopup::OnQueryNewPalette() 
{
    Invalidate();    
    return CWnd::OnQueryNewPalette();
}

void CColourPopup::OnPaletteChanged(CWnd* pFocusWnd) 
{
    CWnd::OnPaletteChanged(pFocusWnd);

    if (pFocusWnd->GetSafeHwnd() != GetSafeHwnd())
        Invalidate();
}

void CColourPopup::OnKillFocus(CWnd* pNewWnd) 
{
	CWnd::OnKillFocus(pNewWnd);

    ReleaseCapture();
    //DestroyWindow(); - causes crash when Custom colour dialog appears.
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区免费网站| 99久久久精品免费观看国产蜜| 麻豆精品视频在线观看视频| 99精品视频在线播放观看| 日韩欧美国产成人一区二区| 亚洲免费观看高清完整| 国产伦精品一区二区三区视频青涩 | 中文字幕一区日韩精品欧美| 视频一区二区欧美| 色婷婷av一区| 国产精品超碰97尤物18| 久久成人综合网| 666欧美在线视频| 亚洲一区在线视频| 波多野结衣的一区二区三区| 精品美女一区二区三区| 三级影片在线观看欧美日韩一区二区| 成人短视频下载| 久久精品亚洲精品国产欧美kt∨ | 精品一区二区三区在线观看国产 | 日韩精品一区二区三区swag| 亚洲高清不卡在线观看| 色综合视频在线观看| 日韩美女精品在线| av在线综合网| 中文字幕中文在线不卡住| 国产成人精品亚洲777人妖| 日韩精品一区二| 麻豆国产精品官网| 精品国产一二三区| 国产乱人伦偷精品视频免下载| 欧美大尺度电影在线| 美女www一区二区| 精品成人在线观看| 国产乱人伦精品一区二区在线观看| 精品国产乱码久久久久久图片| 久久超碰97中文字幕| 日韩一级大片在线| 久久超碰97人人做人人爱| 久久免费视频色| 成人av在线一区二区三区| 日韩毛片精品高清免费| 在线看国产一区| 婷婷丁香久久五月婷婷| 欧美刺激午夜性久久久久久久| 国产一二三精品| 中文字幕日韩一区二区| 91蝌蚪porny成人天涯| 一区二区三区在线观看欧美| 欧美精品v国产精品v日韩精品| 日本亚洲天堂网| 精品日韩一区二区| 成人av午夜影院| 亚洲电影视频在线| 日韩写真欧美这视频| 国产乱码精品一区二区三区忘忧草| 亚洲国产精品成人综合色在线婷婷| 国产iv一区二区三区| 亚洲摸摸操操av| 日韩西西人体444www| 国模套图日韩精品一区二区| 亚洲日本欧美天堂| 7777精品伊人久久久大香线蕉的| 国产久卡久卡久卡久卡视频精品| 国产精品午夜免费| 欧美三级日韩三级国产三级| 国产一区二区福利视频| 亚洲一区在线看| 国产亚洲美州欧州综合国| 色婷婷国产精品久久包臀| 日本成人中文字幕在线视频| 国产精品毛片无遮挡高清| 欧美精品一卡二卡| 成人激情免费电影网址| 日本成人中文字幕| 亚洲欧美国产高清| 亚洲精品一区二区精华| 欧美综合在线视频| 国产乱码精品一区二区三| 亚洲成av人影院| 中文字幕欧美区| 日韩一区二区视频| 色噜噜狠狠成人网p站| 国产乱理伦片在线观看夜一区| 亚洲综合激情网| 综合在线观看色| 久久免费美女视频| 日韩精品一区二区三区蜜臀| 精品视频免费看| 波多野结衣精品在线| 国产黄色精品网站| 麻豆精品精品国产自在97香蕉 | 欧美亚洲日本一区| 成人sese在线| 国产精品18久久久久久久久久久久| 日韩国产欧美三级| 亚洲444eee在线观看| 亚洲日本一区二区| 日韩一区在线看| 国产精品天天摸av网| 久久久99久久| 精品日韩99亚洲| 欧美不卡一二三| 日韩午夜精品电影| 欧美一区二区视频在线观看2022| 欧美日韩在线精品一区二区三区激情| 成人福利视频在线看| 国产成人av福利| 国产老妇另类xxxxx| 国产高清久久久| 国产黑丝在线一区二区三区| 国产美女久久久久| 国产成人午夜电影网| 国产精品18久久久久| 国产aⅴ精品一区二区三区色成熟| 卡一卡二国产精品| 精品制服美女丁香| 国产乱一区二区| 国产成人在线电影| www.欧美色图| 在线观看免费视频综合| 欧美日韩在线免费视频| 日韩西西人体444www| 久久综合久久综合九色| 久久久久久久精| 国产精品久久久久久久久晋中| 亚洲欧美中日韩| 一区二区三区视频在线看| 亚洲国产视频在线| 视频一区二区三区中文字幕| 久久精品国产精品亚洲精品 | 国产精品色噜噜| 国产精品久久久久一区| 亚洲精品国产成人久久av盗摄| 一区二区在线观看免费视频播放| 亚洲一区二区影院| 麻豆久久久久久久| 成人午夜视频网站| 欧美情侣在线播放| 国产午夜久久久久| 一区2区3区在线看| 久久66热偷产精品| 91在线小视频| 91精品国产综合久久福利软件| 国产丝袜美腿一区二区三区| 亚洲免费伊人电影| 久久精品国产第一区二区三区| 东方欧美亚洲色图在线| 欧美性大战久久久久久久蜜臀 | 国产在线精品不卡| 一本色道a无线码一区v| 日韩午夜激情av| 亚洲免费大片在线观看| 美女视频免费一区| 色综合中文字幕国产| 亚洲一区二区三区免费视频| 黄色日韩三级电影| 欧美中文一区二区三区| 国产日韩欧美综合一区| 亚洲成av人片在www色猫咪| 精品一区二区久久| 欧美少妇性性性| 国产精品无人区| 久久精品二区亚洲w码| 一本色道综合亚洲| 欧美韩国日本不卡| 久久国产精品第一页| 欧美午夜精品久久久久久超碰| 久久久影视传媒| 日韩av一区二区三区| jizzjizzjizz欧美| 久久久久国产免费免费| 日本视频免费一区| 欧美中文字幕亚洲一区二区va在线| 国产婷婷色一区二区三区在线| 石原莉奈在线亚洲三区| 欧美在线你懂得| 自拍偷在线精品自拍偷无码专区| 国产一区二区在线观看视频| 欧美福利视频导航| 亚洲电影激情视频网站| 97精品国产97久久久久久久久久久久| 精品国产一区二区三区四区四 | 欧美久久久久久久久久| 亚洲视频在线观看一区| www.亚洲人| 日本一区二区免费在线观看视频 | 久久一日本道色综合| 另类综合日韩欧美亚洲| 日韩午夜在线播放| 日本不卡123| 91精品国产欧美一区二区18| 亚洲国产美女搞黄色| 日本国产一区二区| 伊人婷婷欧美激情| 色狠狠一区二区三区香蕉| 亚洲日本中文字幕区| 在线观看日韩av先锋影音电影院| 亚洲色图欧洲色图婷婷| 在线免费观看日韩欧美|