Example #1
0
void kwxBmpSwitcher::OnPaint(wxPaintEvent &WXUNUSED(event))
{
	wxPaintDC old_dc(this);

	int w,h;
	wxBitmap *pCurrent ;

	m_nCount = m_bmplist.GetCount() ;

	GetClientSize(&w,&h);

	/////////////////

	// Create a memory DC
	wxMemoryDC dc;
	dc.SelectObject(*membitmap);
	dc.SetBackground(*wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(),wxSOLID));
	dc.Clear();

	double  dx = 30.5,
        	dy = 30.5,
        	dr = 29.95;

    dc.SetPen( *wxBLACK_PEN );
    dc.SetBrush( *wxBLACK_BRUSH );

    dc.DrawCircle((int)dx, (int)dy, (int)dr);

	if (m_nCount == 1)
	{
		CBmpList::Node *node = m_bmplist.GetFirst();

		pCurrent = node->GetData() ;
	}
	else
	{
		if (m_nState >= m_nCount )
			m_nState = 0 ;

		CBmpList::Node *node = m_bmplist.Item(m_nState);
		pCurrent = node->GetData();
	}

    if (pCurrent->IsOk())
		dc.DrawBitmap(*pCurrent, 0, 0, TRUE);
	
	old_dc.Blit(0, 0, w, h, &dc, 0, 0);
}
Example #2
0
void kwxBmpSwitcher::OnPaint(wxPaintEvent &event)
{
	wxPaintDC old_dc(this);

	int w,h;
	wxBitmap *pCurrent ;

	m_nCount = m_bmplist.GetCount() ;

	GetClientSize(&w,&h);

	/////////////////

	// Create a memory DC
	wxMemoryDC dc;
	dc.SelectObject(*membitmap);
	dc.SetBackground(*wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(),wxSOLID));
	dc.Clear();

	if (m_nCount == 1)
	{
		CBmpList::Node *node = m_bmplist.GetFirst();

		pCurrent = node->GetData() ;

		dc.DrawBitmap(*pCurrent, 0, 0, TRUE);
	}
	else
	{
		if (m_nState >= m_nCount )
			m_nState = 0 ;

		CBmpList::Node *node = m_bmplist.Item(m_nState);
		pCurrent = node->GetData() ;

		dc.DrawBitmap(*pCurrent, 0, 0, TRUE);

	}
	
	old_dc.Blit(0, 0, w, h, &dc, 0, 0);
}