Click here to Skip to main content
15,895,084 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionDevice Context. Pin
voorugonda prashanth4-Jul-06 23:11
voorugonda prashanth4-Jul-06 23:11 
AnswerRe: Device Context. Pin
Sarath C4-Jul-06 23:34
Sarath C4-Jul-06 23:34 
GeneralRe: Device Context. Pin
voorugonda prashanth4-Jul-06 23:40
voorugonda prashanth4-Jul-06 23:40 
GeneralRe: Device Context. Pin
Hamid_RT4-Jul-06 23:53
Hamid_RT4-Jul-06 23:53 
QuestionButton problem Pin
ashish dogra4-Jul-06 22:46
ashish dogra4-Jul-06 22:46 
AnswerRe: Button problem Pin
Hamid_RT4-Jul-06 22:50
Hamid_RT4-Jul-06 22:50 
GeneralRe: Button problem Pin
ashish dogra4-Jul-06 22:55
ashish dogra4-Jul-06 22:55 
GeneralRe: Button problem Pin
Hamid_RT4-Jul-06 23:05
Hamid_RT4-Jul-06 23:05 
set OwnerDraw from Button to true in property window and include AtlImage.h

class CMyButton : public CButton
{
public:
	CMyButton();
	virtual ~CMyButton();
protected:
	virtual void DrawItem( LPDRAWITEMSTRUCT lpDrawItem );

	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnClose();
	CImage m_Image;
};



CMyButton::CMyButton()
{
	m_Image.Load("d:\\0.bmp");
		
}

CMyButton::~CMyButton()
{
}

BEGIN_MESSAGE_MAP(CMyButton, CButton)

END_MESSAGE_MAP()


void CMyButton::DrawItem(LPDRAWITEMSTRUCT  lpDrawItem) 
{
	CDC			dc;
	CString		Str;
	CRect		Rect(lpDrawItem->rcItem);

	dc.Attach(lpDrawItem->hDC);
	GetWindowText(Str);
	dc.SetBkMode(0);

		if ( (lpDrawItem->itemState& ODS_SELECTED) )
				{
		dc.FillRect(Rect,&CBrush(RGB(255,255,255)));
		dc.FrameRect(Rect,&CBrush(RGB(0,0,255)));

		dc.SetTextColor(RGB(0,0,0));
		dc.DrawText(Str,Rect,DT_CENTER|DT_SINGLELINE);
				}
	else
		{
		dc.FillRect(Rect,&CBrush(RGB(53,97,200)));
		dc.FrameRect(Rect,&CBrush(RGB(0,0,0)));
		dc.SetTextColor(RGB(255,255,255));
		dc.DrawText(Str,Rect,DT_CENTER|DT_SINGLELINE);
		}
		//BitBlt(dc.m_hDC,0,0,800,600,m_Image.GetDC(),0,0,SRCCOPY);
	dc.Detach();
}

</code>




whitesky


GeneralRe: Button problem Pin
ashish dogra4-Jul-06 23:25
ashish dogra4-Jul-06 23:25 
GeneralRe: Button problem Pin
ashish dogra4-Jul-06 23:47
ashish dogra4-Jul-06 23:47 
GeneralRe: Button problem Pin
Hamid_RT5-Jul-06 0:00
Hamid_RT5-Jul-06 0:00 
GeneralRe: Button problem [modified] Pin
ashish dogra5-Jul-06 0:38
ashish dogra5-Jul-06 0:38 
GeneralRe: Button problem Pin
Hamid_RT5-Jul-06 1:55
Hamid_RT5-Jul-06 1:55 
GeneralRe: Button problem Pin
ashish dogra5-Jul-06 2:17
ashish dogra5-Jul-06 2:17 
GeneralRe: Button problem Pin
Hamid_RT5-Jul-06 2:59
Hamid_RT5-Jul-06 2:59 
AnswerRe: Button problem Pin
_AnsHUMAN_ 4-Jul-06 23:06
_AnsHUMAN_ 4-Jul-06 23:06 
Questionwhat it mean in C++-> TCHAR Pin
Nirmal Khatri4-Jul-06 22:39
Nirmal Khatri4-Jul-06 22:39 
AnswerRe: what it mean in C++-> TCHAR Pin
Sarath C4-Jul-06 22:48
Sarath C4-Jul-06 22:48 
AnswerRe: what it mean in C++-> TCHAR Pin
Hamid_RT4-Jul-06 22:51
Hamid_RT4-Jul-06 22:51 
AnswerRe: what it mean in C++-> TCHAR Pin
RChin4-Jul-06 22:54
RChin4-Jul-06 22:54 
Question.lib file is a static library file or DLL implicit linking file? Pin
George_George4-Jul-06 22:35
George_George4-Jul-06 22:35 
QuestionC++ [modified] Pin
Nirmal Khatri4-Jul-06 22:28
Nirmal Khatri4-Jul-06 22:28 
QuestionHow we can add keep colors to dialog and static control Pin
happy_ram4-Jul-06 21:33
happy_ram4-Jul-06 21:33 
AnswerRe: How we can add keep colors to dialog and static control Pin
NiceNaidu4-Jul-06 21:40
NiceNaidu4-Jul-06 21:40 
AnswerRe: How we can add keep colors to dialog and static control Pin
_AnsHUMAN_ 4-Jul-06 22:07
_AnsHUMAN_ 4-Jul-06 22:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.