예제 #1
0
//重画函数
void CDlgOptionItem::OnPaint()
{
	CPaintDC dc(this);

	//获取位置
	CRect rcRect;
	GetClientRect(&rcRect);

	//建立缓冲
	CDC BufferDC;
	CBitmap BufferBmp;
	BufferDC.CreateCompatibleDC(&dc);
	BufferBmp.CreateCompatibleBitmap(&dc,rcRect.Width(),rcRect.Height());
	BufferDC.SelectObject(&BufferBmp);

	//绘画背景
	COLORREF crBackGround=CSkinWndObject::m_SkinAttribute.m_crBackGround;
	BufferDC.FillSolidRect(0,0,rcRect.Width(),TITLE_HEIGHT,crBackGround);

	//绘画上框
	CBrush BackBrush(TITLE_GROUND_COLOR);
	CPen LinePen(PS_SOLID,1,CSkinWndObject::m_SkinAttribute.m_crInsideBorder);
	BufferDC.SelectObject(&LinePen);
	BufferDC.SelectObject(&BackBrush);
	BufferDC.RoundRect(0,0,rcRect.Width(),TITLE_HEIGHT+10,10,10);

	//绘画下框
	BufferDC.FillSolidRect(0,TITLE_HEIGHT,rcRect.Width(),rcRect.Height()-TITLE_HEIGHT,crBackGround);
	
	BufferDC.SelectObject(GetStockObject(NULL_BRUSH));
	BufferDC.RoundRect(0,0,rcRect.Width(),rcRect.Height(),10,10);

	//绘画标题
	LPCTSTR pszTitle=GetTitleText();
	CRect rcTitil(10,0,rcRect.Width()-20,TITLE_HEIGHT);
	BufferDC.SetBkMode(TRANSPARENT);
	BufferDC.SetTextColor(RGB(10,10,10));
	BufferDC.SelectObject(CSkinAttribute::m_DefaultFont);
	BufferDC.DrawText(pszTitle,lstrlen(pszTitle),rcTitil,DT_END_ELLIPSIS|DT_VCENTER|DT_SINGLELINE);

	//绘画界面
	dc.BitBlt(0,0,rcRect.Width(),rcRect.Height(),&BufferDC,0,0,SRCCOPY);

	//清理资源
	BufferDC.DeleteDC();
	LinePen.DeleteObject();
	BackBrush.DeleteObject();
	BufferBmp.DeleteObject();

	return;
}
예제 #2
0
void moEffectLayerTimelineCtrl::OnPaint( wxPaintEvent& event ) {

    wxBufferedPaintDC dc(this);

    int w,h;

    GetSize(&w,&h);

    wxBrush BackBrush( wxColour(70,70,70), wxSOLID );

    //draw background bitmap
    if (m_BackgroundImage.IsOk()) {
        dc.DrawBitmap( wxBitmap( m_BackgroundImage.Rescale(m_BackgroundImage.GetWidth(),h), -1 ), 0, 0, true );
        BackBrush.SetStipple( wxBitmap( m_BackgroundImage, -1 ) );
        BackBrush.SetStyle( wxSTIPPLE );
    }

    dc.SetBrush( BackBrush );
    dc.SetPen( wxPen( wxColour(75,75,75), 1, wxSOLID) );

    //background
    dc.DrawRectangle( 0, 0, GetSize().x, GetSize().y );



    //gauge
    //dc.SetBrush( wxBrush( wxColour(220,220,220), wxSOLID) );
    //dc.SetPen( wxPen( wxColour(140,140,140), 1, wxTRANSPARENT ) );
    //dc.DrawRectangle( 0, 0, SlidePosition(), GetSize().y );

    //ticks:
    dc.SetBrush( BackBrush );
    dc.SetPen( wxPen( wxColour(75,75,75), 1, wxSOLID) );

    int linedelta = m_MobDescriptor.GetState().GetEffectState().tempo.delta;

    for(int i =0; i<GetSize().x; i+= ( (GetSize().x / 40 ) * linedelta )) {
        dc.DrawLine( i, 0, i, GetSize().y );
    }

}
예제 #3
0
//重画消息
void CButtonBar::OnPaint()
{
	CPaintDC dc(this);

	//获取位置
	CRect rcRect;
	GetClientRect(&rcRect);

	//加载资源
	CImageHandle ImageHotHandle(&m_ImageHot);
	CImageHandle ImageActiveHandle(&m_ImageActive);
	CImageHandle ImageNormalHandle(&m_ImageNormal);
	CImageHandle m_ImageBackGroundHandle(&m_ImageBackGround);

	//建立缓冲
	CDC BufferDC;
	CBitmap BufferBmp;
	BufferDC.CreateCompatibleDC(&dc);
	BufferBmp.CreateCompatibleBitmap(&dc,rcRect.Width(),rcRect.Height());
	BufferDC.SelectObject(&BufferBmp);

	//绘画背景
	CBrush BackBrush(TITLE_GROUND_COLOR);
	CPen BorderPen(PS_SOLID,1,CSkinWndObject::m_SkinAttribute.m_crInsideBorder);
	CPen * pOldPen=BufferDC.SelectObject(&BorderPen);
	CBrush * pOldBrush=BufferDC.SelectObject(&BackBrush);
	BufferDC.FillSolidRect(&rcRect,CSkinWndObject::m_SkinAttribute.m_crBackGround);
	BufferDC.RoundRect(&rcRect,CPoint(10,10));
	m_ImageBackGround.BitBlt(BufferDC,1,rcRect.Height()-m_ImageBackGround.GetHeight()-3);
	BufferDC.SelectObject(pOldPen);
	BufferDC.SelectObject(pOldBrush);
	BackBrush.DeleteObject();
	BorderPen.DeleteObject();

	//绘画按钮
	BufferDC.SetBkMode(TRANSPARENT);
	BufferDC.SelectObject(&CSkinAttribute::m_DefaultFont);

	//绘画按钮
	CRect rcButton;
	CSkinImage * pSkinImage=NULL;
	for (INT_PTR i=0;i<m_OptionsItemPtr.GetCount();i++)
	{
		LPCTSTR pszButtonText=m_OptionsItemPtr[i]->GetButtonText();
		rcButton.SetRect(1,(int)(ITEM_HEIGHT*i+10+2*i),rcRect.Width(),(int)(ITEM_HEIGHT*(i+1)+10+2*i));
		if (i==m_nActiveItem) 
		{
			pSkinImage=&m_ImageActive;
			BufferDC.SetTextColor(RGB(0,0,0));
		}
		else if (i==m_nHotItem) 
		{
			pSkinImage=&m_ImageHot;
			BufferDC.SetTextColor(RGB(0,0,0));
		}
		else 
		{
			pSkinImage=&m_ImageNormal;
			BufferDC.SetTextColor(RGB(0,0,0));
		}
		pSkinImage->BitBlt(BufferDC,rcButton.left,rcButton.top,ITEM_WIDTH,ITEM_HEIGHT,0,0,SRCCOPY);
		BufferDC.DrawText(pszButtonText,lstrlen(pszButtonText),rcButton,DT_END_ELLIPSIS|DT_VCENTER|DT_CENTER|DT_SINGLELINE);
	}

	//绘画界面
	dc.BitBlt(0,0,rcRect.Width(),rcRect.Height(),&BufferDC,0,0,SRCCOPY);

	//清理资源
	BufferDC.DeleteDC();
	BufferBmp.DeleteObject();

	return;
}