当前位置: 首页>>代码示例>>C++>>正文


C++ Color::SetFromCOLORREF方法代码示例

本文整理汇总了C++中gdiplus::Color::SetFromCOLORREF方法的典型用法代码示例。如果您正苦于以下问题:C++ Color::SetFromCOLORREF方法的具体用法?C++ Color::SetFromCOLORREF怎么用?C++ Color::SetFromCOLORREF使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gdiplus::Color的用法示例。


在下文中一共展示了Color::SetFromCOLORREF方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnEraseBkgnd

BOOL CImgStatic::OnEraseBkgnd(CDC *pDC)
{
  if (m_bZooming)
    return TRUE;
  
  if (m_bImageLoaded) {
    RECT rc;
    GetClientRect(&rc);

    // Get Gdiplus graphics object
    Gdiplus::Graphics grp(pDC->GetSafeHdc());

    // Clear rectangle
    Gdiplus::Color gdipColor;
    gdipColor.SetFromCOLORREF(GetSysColor(COLOR_3DFACE));

    Gdiplus::SolidBrush brush(gdipColor);
    grp.FillRectangle(&brush, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top);
    grp.Flush();

    return TRUE;
  } else {
    return CStatic::OnEraseBkgnd(pDC);
  }
}
开发者ID:soundsrc,项目名称:pwsafe,代码行数:25,代码来源:ImgStatic.cpp

示例2: f

static void DrawFrame2(Graphics &g, RectI r)
{
    g.SetCompositingQuality(CompositingQualityHighQuality);
    g.SetSmoothingMode(SmoothingModeAntiAlias);
    g.SetPageUnit(UnitPixel);

    Font f(L"Impact", 40, FontStyleRegular);
    CalcLettersLayout(g, &f, r.dx);

    Gdiplus::Color bgCol;
    bgCol.SetFromCOLORREF(WIN_BG_COLOR);
    SolidBrush bgBrush(bgCol);
    Rect r2(r.ToGdipRect());
    r2.Inflate(1, 1);
    g.FillRectangle(&bgBrush, r2);

    Font f2(L"Impact", 16, FontStyleRegular);
    DrawSumatraLetters(g, &f, &f2, 18.f);

    if (gShowOptions)
        return;

    REAL msgY = (REAL)(r.dy / 2);
    if (gMsg)
        msgY += DrawMessage(g, gMsg, msgY, (REAL)r.dx, gMsgColor) + 5;
    if (gMsgError)
        DrawMessage(g, gMsgError, msgY, (REAL)r.dx, COLOR_MSG_FAILED);
}
开发者ID:phishbulb,项目名称:sumatrapdf,代码行数:28,代码来源:Installer.cpp

示例3:

void CSettingsRevisionGraphColors::ApplyColor
    ( CMFCColorButton& button
    , CColors::GDIPlusColorTable table
    , int index)
{
    COLORREF value = button.GetColor() == -1
                   ? button.GetAutomaticColor()
                   : button.GetColor();

    Gdiplus::Color temp;
    temp.SetFromCOLORREF (value);
    m_Colors.SetColor (table, index, (temp.GetValue() & 0xffffff) + 0xff000000);
}
开发者ID:svn2github,项目名称:tortoisesvn,代码行数:13,代码来源:SettingsRevGraphColors.cpp

示例4: ClearImage

void CImgStatic::ClearImage()
{
  // Get rid of image and return it back to empty CStatic control
  FreeStream();

  RECT rc;
  GetClientRect(&rc);
  Gdiplus::Graphics grp(GetDC()->GetSafeHdc());

  // Clear rectangle
  Gdiplus::Color gdipColor;
  gdipColor.SetFromCOLORREF(GetSysColor(COLOR_3DFACE));

  Gdiplus::SolidBrush brush(gdipColor);
  grp.FillRectangle(&brush, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top);
  grp.Flush();
}
开发者ID:soundsrc,项目名称:pwsafe,代码行数:17,代码来源:ImgStatic.cpp

示例5: Draw

void SelectionHandler::Draw(CDC& offscreenDC)
{
  if (m_selectionState == selstateNoSelection) return;

  COORD coordStart;
  COORD coordEnd;
  SHORT maxX = (m_consoleParams->dwBufferColumns > 0) ?
    static_cast<SHORT>(m_consoleParams->dwBufferColumns - 1) :
    static_cast<SHORT>(m_consoleParams->dwColumns - 1);

  GetSelectionCoordinates(coordStart, coordEnd);

  SMALL_RECT& srWindow = m_consoleInfo->csbi.srWindow;

  if(   coordEnd.Y < srWindow.Top    ||
      coordStart.Y > srWindow.Bottom ) return;

  INT nXStart = (static_cast<INT>(coordStart.X) - static_cast<INT>(srWindow.Left)) * m_nCharWidth  + m_nVInsideBorder;
  INT nYStart = (static_cast<INT>(coordStart.Y) - static_cast<INT>(srWindow.Top) ) * m_nCharHeight + m_nHInsideBorder;
  INT nXEnd   = (static_cast<INT>(  coordEnd.X) - static_cast<INT>(srWindow.Left)) * m_nCharWidth  + m_nVInsideBorder;
  INT nYEnd   = (static_cast<INT>(  coordEnd.Y) - static_cast<INT>(srWindow.Top) ) * m_nCharHeight + m_nHInsideBorder;
  INT nXmin   = (static_cast<INT>(0)            - static_cast<INT>(srWindow.Left)) * m_nCharWidth  + m_nVInsideBorder;
  INT nXmax   = (static_cast<INT>(maxX)         - static_cast<INT>(srWindow.Left)) * m_nCharWidth  + m_nVInsideBorder;

  Gdiplus::Graphics gr(offscreenDC);

  Gdiplus::Color selectionColor;
  selectionColor.SetFromCOLORREF(g_settingsHandler->GetAppearanceSettings().stylesSettings.crSelectionColor);
  Gdiplus::Pen        pen  (selectionColor);
  Gdiplus::SolidBrush brush(Gdiplus::Color(64,  selectionColor.GetR(), selectionColor.GetG(), selectionColor.GetB()));
  Gdiplus::GraphicsPath gp;

  if( nYStart == nYEnd )
  {
    Gdiplus::Rect rect(
      nXStart,
      nYStart,
      (nXEnd - nXStart) + m_nCharWidth,
      m_nCharHeight);
    gp.AddRectangle(rect);
  }
  else
  {
    /*
           2_________3
    0______|         |
    |      1     5___|
    |____________|   4
    7            6
    */

    Gdiplus::Point points[8];

    points[0].X = nXmin;
    points[0].Y = nYStart + m_nCharHeight;

    points[1].X = nXStart;
    points[1].Y = points[0].Y;

    points[2].X = points[1].X;
    points[2].Y = nYStart;

    points[3].X = nXmax + m_nCharWidth;
    points[3].Y = points[2].Y;

    points[4].X = points[3].X;
    points[4].Y = nYEnd;

    points[5].X = nXEnd + m_nCharWidth;
    points[5].Y = points[4].Y;

    points[6].X = points[5].X;
    points[6].Y = nYEnd + m_nCharHeight;

    points[7].X = points[0].X;
    points[7].Y = points[6].Y;

    gp.AddPolygon(points, 8);
  }

  gr.FillPath(&brush, &gp);
  gr.DrawPath(&pen, &gp);
}
开发者ID:GlassBil,项目名称:console,代码行数:83,代码来源:SelectionHandler.cpp

示例6: paint

void uie_albumart::paint(HDC hdc)
{
    RECT wndrect_temp;
    if(GetClientRect(m_hWnd,&wndrect_temp))
    {
        Graphics gfx(hdc);
        Rect wndrect(
            wndrect_temp.left,
            wndrect_temp.top,
            wndrect_temp.right-wndrect_temp.left,
            wndrect_temp.bottom-wndrect_temp.top
            );

        Color bg;
        bg.SetFromCOLORREF((m_config.bg_enabled)
                           ?m_config.bgcol
                           :GetSysColor(COLOR_3DFACE));

        bool noimage = m_bufnew.is_empty();
        bool image_changed = !m_image_file_exists || m_bmpnew.is_valid();
        bool size_changed = m_bufnew.is_valid()
            ? (m_bufnew->GetWidth() != wndrect.Width || m_bufnew->GetHeight() != wndrect.Height)
            : true;
        if (noimage || image_changed || size_changed || m_config_changed || m_dragging)
        {
            if (!m_dragging)
            {
                m_pan_dx = m_pan_dy = 0;
            }
            else
            {
                m_bmpnew = m_bmp;
            }

            if (size_changed || noimage)
            {
                // create bitmaps with new size
                m_animating = false;
                m_bufold.release();
                m_bufanim.release();

                m_bufold = new Bitmap(wndrect.Width,wndrect.Height,&gfx);
                m_bufnew = new Bitmap(wndrect.Width,wndrect.Height,&gfx);

                // make sure currently displayed image is redrawn
                // during the resize
                m_bmpnew = m_bmp;
            }
            if (m_config.animtime == 0)
                m_bufanim.release();
            else if (m_bufanim.is_empty())
                m_bufanim=new Bitmap(wndrect.Width,wndrect.Height,&gfx);

            m_config_changed = false;

            Bitmap *temp = m_bufold.detach();
            m_bufold.set(m_bufnew.detach());
            m_bufnew.set(temp);

            Graphics bufgfx(m_bufnew.get_ptr());
            bufgfx.Clear(bg);

            if (m_bmpnew.is_valid())
            {
                // adjust for padding
                if(m_config.padding > 0)
                {
                    wndrect.Height-=2*m_config.padding;
                    wndrect.Width-=2*m_config.padding;
                    wndrect.X+=m_config.padding;
                    wndrect.Y+=m_config.padding;
                }

                Size bmp_dim(m_bmpnew->GetWidth(), m_bmpnew->GetHeight());

                // rectangle that will be drawn on the screen
                RectF rect(wndrect.X, wndrect.Y, bmp_dim.Width, bmp_dim.Height);

                // shrink album art
                if (m_config.shrinkalbum)
                {
                    if (bmp_dim.Width > wndrect.Width)
                        rect.Width = wndrect.Width;

                    if (bmp_dim.Height > wndrect.Height)
                        rect.Height = wndrect.Height;
                }

                // expand album art
                if (m_config.expandalbum)
                {
                    if (bmp_dim.Width < wndrect.Width)
                        rect.Width = wndrect.Width;

                    if (bmp_dim.Height < wndrect.Height)
                        rect.Height = wndrect.Height;
                }

                // correct aspect ratio
                if (m_config.aspectratio)
//.........这里部分代码省略.........
开发者ID:Duny,项目名称:foo_uie_albumart_mod,代码行数:101,代码来源:uie_albumart.cpp


注:本文中的gdiplus::Color::SetFromCOLORREF方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。