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

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

?? colourpopup.cpp

?? 一個基于PXA255的水情遙測、遙控系統現場服務器軟件
?? 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一区二区三区免费野_久草精品视频
首页国产丝袜综合| 欧美激情一区在线观看| 五月激情综合网| 日韩午夜在线影院| 韩国女主播一区二区三区| 亚洲婷婷在线视频| 中文字幕在线不卡| 懂色一区二区三区免费观看| 精品福利二区三区| 蜜桃久久精品一区二区| 日韩三级免费观看| 最近中文字幕一区二区三区| 日韩女优制服丝袜电影| 亚洲欧美日韩久久精品| 成人av电影免费观看| 亚洲精品中文字幕乱码三区| 色综合天天狠狠| 亚洲精品ww久久久久久p站 | xfplay精品久久| 国产成人高清视频| 亚洲毛片av在线| 制服丝袜日韩国产| 精品一区二区综合| 精品国产3级a| 成人av电影在线网| 国产福利一区在线观看| 欧美激情中文不卡| 久久久久综合网| 懂色av中文一区二区三区| 精品国偷自产国产一区| 91亚洲大成网污www| 国产永久精品大片wwwapp| 免费看日韩a级影片| 成人欧美一区二区三区在线播放| 国产91在线观看丝袜| 国产日韩欧美高清在线| 国产成人久久精品77777最新版本| 国产精品美女久久久久av爽李琼| 成人精品国产一区二区4080| 一区二区三区久久久| 666欧美在线视频| 国产精一区二区三区| 国产日韩欧美在线一区| 一本久久a久久精品亚洲| 亚洲免费观看高清完整版在线 | 91在线看国产| 一区二区三区在线不卡| 欧美一区二区视频在线观看2022 | 国内久久精品视频| 国产精品久久午夜夜伦鲁鲁| 欧美视频自拍偷拍| 蜜臀av国产精品久久久久| 国产精品毛片高清在线完整版| 99re免费视频精品全部| 亚洲激情图片一区| 欧美一二三在线| 久久99精品久久久久久国产越南 | 色婷婷精品久久二区二区蜜臂av | 国产亚洲人成网站| 日韩精品欧美精品| 7777精品伊人久久久大香线蕉超级流畅 | 国产视频一区二区在线观看| 99久久精品国产精品久久| 亚洲第一成人在线| 精品国产区一区| 国产精品996| 亚洲国产另类av| 欧美精品一区二区三区在线| 在线视频一区二区三| 美女精品自拍一二三四| 亚洲欧美另类久久久精品 | 国产传媒一区在线| 亚洲精品日日夜夜| 欧美大白屁股肥臀xxxxxx| av男人天堂一区| 午夜精品视频一区| 亚洲欧洲无码一区二区三区| 91精品欧美一区二区三区综合在| 麻豆国产欧美日韩综合精品二区 | 成人短视频下载| 国产成人鲁色资源国产91色综 | 青青国产91久久久久久 | 欧洲精品在线观看| 欧美影院一区二区| 欧美系列日韩一区| 精品国一区二区三区| 久久久久久久综合| 日本一区二区高清| 日韩高清不卡在线| 亚洲v中文字幕| 国产美女视频一区| 色哟哟国产精品免费观看| 国产精品色眯眯| 欧美激情资源网| 欧美一区二区女人| 精品国产三级电影在线观看| 中文字幕成人网| 国产永久精品大片wwwapp| 久久久精品免费免费| 一本久久a久久精品亚洲| 国产精品久久久久aaaa樱花| 精品国产人成亚洲区| 欧美在线你懂的| 国产精品综合久久| 免费成人av在线| 亚洲综合清纯丝袜自拍| 国产精品私人影院| 日韩欧美亚洲一区二区| 91丨九色porny丨蝌蚪| 国产在线日韩欧美| 免费成人美女在线观看.| 午夜不卡av免费| 一区二区三区久久久| 亚洲人成7777| 久久精品欧美一区二区三区不卡 | 制服丝袜一区二区三区| 在线看不卡av| 色综合天天综合网天天看片| 成人ar影院免费观看视频| 国产福利视频一区二区三区| 一区二区三区蜜桃| 亚洲一区二区三区爽爽爽爽爽 | ...xxx性欧美| 国产午夜精品在线观看| 久久色.com| 亚洲精品在线三区| 欧美精品一区二区三区久久久 | 国产在线播放一区| 黄色日韩网站视频| 激情五月婷婷综合| 国产一区二区三区在线观看免费视频| 奇米色一区二区三区四区| 亚洲一区二区视频在线观看| 一区二区三区美女| 一区二区免费在线| 91精品一区二区三区久久久久久| 成人av影院在线| 97超碰欧美中文字幕| 99久久精品国产一区二区三区| 紧缚奴在线一区二区三区| 国产伦理精品不卡| 国产成人av网站| 成人精品gif动图一区| 成人激情图片网| 色婷婷综合久久久| 欧美日韩国产高清一区二区三区 | 欧美日韩高清一区二区三区| 91视视频在线观看入口直接观看www| 国产黄色91视频| 93久久精品日日躁夜夜躁欧美| 99这里都是精品| 在线影视一区二区三区| 在线精品视频一区二区三四| 欧美精品在线观看一区二区| 91麻豆精品91久久久久同性| 欧美日免费三级在线| 日韩欧美第一区| 久久亚洲捆绑美女| 国产欧美中文在线| 国产精品每日更新在线播放网址| 亚洲欧美色一区| 久久一夜天堂av一区二区三区| 国产精品123区| 亚洲欧美日韩国产综合| 777a∨成人精品桃花网| 国产精品一二三四| 亚洲综合激情网| 日韩精品一区二区三区四区视频| 国产91高潮流白浆在线麻豆| 亚洲天堂2016| 在线观看三级视频欧美| 国产在线不卡一区| 亚洲一区二区三区精品在线| 精品久久五月天| 欧美亚洲高清一区| 高清成人在线观看| 免费观看在线综合| 久久九九久久九九| 亚洲午夜一区二区三区| 日韩欧美综合在线| 国产女同互慰高潮91漫画| 在线电影国产精品| 久久九九久精品国产免费直播| 精品国产一二三| 色综合欧美在线| 日日摸夜夜添夜夜添精品视频| 国产精品女同一区二区三区| 日韩视频免费观看高清完整版 | 国产网站一区二区| 亚洲日本乱码在线观看| 国产亚洲福利社区一区| 亚洲男人的天堂在线观看| 久久精品久久99精品久久| 成人一级片网址| 欧美日韩国产精选| 国产亚洲精品资源在线26u| 亚洲国产精品麻豆| 国产在线精品免费| 欧美色视频在线观看| 久久伊人蜜桃av一区二区|