Click here to Skip to main content
15,912,400 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: WM_COPYDATA with PostThreadMessage or PostMessage Pin
KarstenK24-Feb-10 21:48
mveKarstenK24-Feb-10 21:48 
GeneralRe: WM_COPYDATA with PostThreadMessage or PostMessage Pin
ForNow24-Feb-10 23:19
ForNow24-Feb-10 23:19 
GeneralRe: WM_COPYDATA with PostThreadMessage or PostMessage Pin
KarstenK24-Feb-10 23:46
mveKarstenK24-Feb-10 23:46 
AnswerRe: WM_COPYDATA with PostThreadMessage or PostMessage Pin
Vitaly Tomilov28-Nov-10 0:06
Vitaly Tomilov28-Nov-10 0:06 
QuestionDraw PNG on top of a CButton without flicker effect Pin
Lordraco24-Feb-10 10:55
Lordraco24-Feb-10 10:55 
AnswerRe: Draw PNG on top of a CButton without flicker effect Pin
Eugen Podsypalnikov24-Feb-10 19:38
Eugen Podsypalnikov24-Feb-10 19:38 
AnswerRe: Draw PNG on top of a CButton without flicker effect Pin
Saurabh.Garg24-Feb-10 20:36
Saurabh.Garg24-Feb-10 20:36 
AnswerRe: Draw PNG on top of a CButton without flicker effect Pin
Lordraco25-Feb-10 7:32
Lordraco25-Feb-10 7:32 
Ok so here is the code that I use:

- some init stuff

void MyButton::LoadImageFile()
{
CRect rectBtn;
GetClientRect(&rectBtn);
dc.Attach(this->GetDC()->m_hDC);

Gdiplus::GdiplusStartupInput gdiplusstartupinput;
Gdiplus::GdiplusStartup(&m_gdiplusToken,&m_gdiplusstartupinput,NULL);

m_MyImage = Image::FromFile(L"c:\\icon.png",TRUE);

rect = Rect(rectBtn.left,rectBtn.top,rectBtn.right,rectBtn.bottom);

grpx = new Graphics(dc);
}

- Drawing in OnPaint()

void MyButton::OnPaint()
{
CButton::OnPaint();
grpx->DrawImage(m_MyImage, rect);
}

- Message Map

BEGIN_MESSAGE_MAP(MyButton, CButton)
ON_WM_CTLCOLOR()
ON_WM_PAINT()
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_ERASEBKGND()
END_MESSAGE_MAP()

- OnCtlColor

HBRUSH MyButton::OnCtlColor(CDC* pScreenDC, CWnd * wnd, UINT nCtlColor)
{
return NULL;
}

- OnEraseBkgnd

BOOL MyButton::OnEraseBkgnd(CDC* pDC)
{
return TRUE;
}

Image flickers when the focus is set on the button and glowing vista effect is applied or seldom when you fast move over the button with the image.
QuestionHow can find out Serial Com Port of Machine? Pin
Le@rner24-Feb-10 1:58
Le@rner24-Feb-10 1:58 
AnswerRe: How can find out Serial Com Port of Machine? Pin
Cedric Moonen24-Feb-10 2:01
Cedric Moonen24-Feb-10 2:01 
AnswerRe: How can find out Serial Com Port of Machine? Pin
David Crow24-Feb-10 3:17
David Crow24-Feb-10 3:17 
GeneralRe: How can find out Serial Com Port of Machine? Pin
Le@rner24-Feb-10 17:20
Le@rner24-Feb-10 17:20 
QuestionRe: How can find out Serial Com Port of Machine? Pin
David Crow25-Feb-10 2:59
David Crow25-Feb-10 2:59 
AnswerRe: How can find out Serial Com Port of Machine? Pin
Richard MacCutchan24-Feb-10 3:23
mveRichard MacCutchan24-Feb-10 3:23 
AnswerRe: How can find out Serial Com Port of Machine? Pin
CPallini24-Feb-10 7:43
mveCPallini24-Feb-10 7:43 
QuestionDigital Signature: Signer Name Pin
K. Sushilkumar24-Feb-10 1:08
K. Sushilkumar24-Feb-10 1:08 
AnswerRe: Digital Signature: Signer Name Pin
KingsGambit24-Feb-10 1:44
KingsGambit24-Feb-10 1:44 
GeneralRe: Digital Signature: Signer Name Pin
K. Sushilkumar24-Feb-10 18:31
K. Sushilkumar24-Feb-10 18:31 
GeneralRe: Digital Signature: Signer Name Pin
KingsGambit25-Feb-10 5:22
KingsGambit25-Feb-10 5:22 
QuestionUSE DLL Pin
Anubhava Dimri24-Feb-10 0:47
Anubhava Dimri24-Feb-10 0:47 
AnswerRe: USE DLL Pin
Richard MacCutchan24-Feb-10 0:52
mveRichard MacCutchan24-Feb-10 0:52 
AnswerRe: USE DLL Pin
Adam Roderick J24-Feb-10 0:53
Adam Roderick J24-Feb-10 0:53 
GeneralRe: USE DLL Pin
Anubhava Dimri24-Feb-10 1:20
Anubhava Dimri24-Feb-10 1:20 
GeneralRe: USE DLL Pin
Anubhava Dimri24-Feb-10 1:22
Anubhava Dimri24-Feb-10 1:22 
AnswerRe: USE DLL Pin
Chris Losinger24-Feb-10 3:54
professionalChris Losinger24-Feb-10 3:54 

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.