Click here to Skip to main content
15,889,411 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionMy progremmer can't run,why?? Pin
wbgxx11-May-10 4:17
wbgxx11-May-10 4:17 
AnswerRe: My progremmer can't run,why?? Pin
Cedric Moonen11-May-10 4:18
Cedric Moonen11-May-10 4:18 
GeneralRe: My progremmer can't run,why?? Pin
wbgxx11-May-10 4:27
wbgxx11-May-10 4:27 
GeneralRe: My progremmer can't run,why?? PinPopular
Cedric Moonen11-May-10 4:33
Cedric Moonen11-May-10 4:33 
JokeRe: My progremmer can't run,why?? Pin
CPallini11-May-10 11:44
mveCPallini11-May-10 11:44 
AnswerRe: My progremmer can't run,why?? Pin
Covean11-May-10 4:33
Covean11-May-10 4:33 
AnswerRe: My progremmer can't run,why?? Pin
Tim Craig11-May-10 17:34
Tim Craig11-May-10 17:34 
QuestionRound button with image Pin
AbhiHcl11-May-10 4:16
AbhiHcl11-May-10 4:16 
I want to create a round rect button with three image , one for left round, one for middle and one for right round. Middle image I m rendring according to with of button, but I don't know how to use the both side images so that my button sud look like reound rectangular.
Here is my code to render the middle image.
void CRoundButton2::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
// Get DC of Item
CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
ASSERT (pDC != NULL);

// Should Buttons be generated?
bool bGenerate = !m_rBtnSize.EqualRect(&lpDrawItemStruct->rcItem) || m_bRedraw;

// If Rectangles of Button are not the same
if (bGenerate)
{
// Generate Bitmap to hold Buttons
GenButtonBMPs(pDC, lpDrawItemStruct->rcItem);

// Redraw done
m_bRedraw = false;
}

// Generate DC to draw in Memory
CDC *MemDC = new CDC();
MemDC->CreateCompatibleDC(pDC);

HGDIOBJ hOldBmp = MemDC->SelectObject(m_tBmpBtn);

CString sActualCaption;
// Get actual caption
GetWindowText(sActualCaption);

// Check, if caption has changed
if (sActualCaption != m_sOldCaption)
bGenerate = true;

// Store old caption
m_sOldCaption = sActualCaption;

// If Rectangles of Button are not the same
if (bGenerate)
{
// Draw Buttons
DrawButtonFace(MemDC);

// Draw Button-Caption
DrawButtonCaption(MemDC);
}

int nButtonState;

nButtonState = BS_ENABLED;

if (m_bIsHotButton && m_bMouseOnButton)
nButtonState = BS_HOT;

if ((lpDrawItemStruct->itemState & ODS_DISABLED) == ODS_DISABLED)
nButtonState = BS_DISABLED;
else
{
if ((lpDrawItemStruct->itemState & ODS_SELECTED) == ODS_SELECTED)
nButtonState = BS_PRESSED;
else
{
if (this->m_bIsChecked)
{
nButtonState = BS_CLICKED;
}
}
}
CBitmap bitmap2;
bitmap2.LoadBitmap(IDB_BITMAP1);
BITMAP bmpInfo;
bitmap2.GetBitmap(&bmpInfo);
CBitmap* pOldBitmap = MemDC->SelectObject(&bitmap2);
//int nX = m_rBtnSize.left + (m_rBtnSize.Width() - bmpInfo.bmWidth) / 2;
//int nY = m_rBtnSize.top + (m_rBtnSize.Height() - bmpInfo.bmHeight) / 2;


// Copy correct Bitmap to Screen
for ( int i = 0 ; i<117 ; i++)
{
MemDC->SelectObject(bitmap2);
pDC->BitBlt(0+i,0,bmpInfo.bmWidth,bmpInfo.bmHeight, MemDC,0, 0, SRCCOPY);

//MemDC->SelectObject(hOldBmp);
MemDC->SelectObject(pOldBitmap);
}

UINT state = lpDrawItemStruct->itemState; //Get state of the button
if ( (state & ODS_SELECTED) ) // If it is pressed
pDC->DrawEdge(m_rBtnSize,EDGE_SUNKEN,BF_RECT); // Draw a sunken face
// else
// pDC->DrawEdge(rt,EDGE_RAISED,BF_RECT); // Draw a raised face
}

Please help me out..

Thanks in Advance
QuestionUnable to CreateFileMapping for Elivated User on Windows7 Version or Windows Vista Pin
janaswamy uday11-May-10 3:54
janaswamy uday11-May-10 3:54 
QuestionRe: Unable to CreateFileMapping for Elivated User on Windows7 Version or Windows Vista Pin
Randor 11-May-10 15:46
professional Randor 11-May-10 15:46 
Questionmy strcpy funcution! Pin
wbgxx11-May-10 3:47
wbgxx11-May-10 3:47 
AnswerRe: my strcpy funcution! Pin
wbgxx11-May-10 3:49
wbgxx11-May-10 3:49 
AnswerRe: my strcpy funcution! Pin
Jonathan Davies11-May-10 4:09
Jonathan Davies11-May-10 4:09 
GeneralRe: my strcpy funcution! Pin
wbgxx11-May-10 4:13
wbgxx11-May-10 4:13 
GeneralRe: my strcpy funcution! Pin
Maximilien11-May-10 4:26
Maximilien11-May-10 4:26 
GeneralRe: my strcpy funcution! Pin
Jonathan Davies11-May-10 4:26
Jonathan Davies11-May-10 4:26 
AnswerRe: my strcpy funcution! Pin
Richard MacCutchan11-May-10 5:17
mveRichard MacCutchan11-May-10 5:17 
AnswerRe: my strcpy funcution! Pin
David Crow12-May-10 3:01
David Crow12-May-10 3:01 
QuestionCDialog::PumpMessage hangs (endless WM_PAINT?) Pin
VictorSotnikov11-May-10 3:41
VictorSotnikov11-May-10 3:41 
Questionhow to use select() function with file descriptors on windows Pin
Vijay_Vijay11-May-10 1:04
Vijay_Vijay11-May-10 1:04 
AnswerRe: how to use select() function with file descriptors on windows Pin
Richard MacCutchan11-May-10 2:36
mveRichard MacCutchan11-May-10 2:36 
QuestionHow to Track the event in Excel for cell insert/delete in C++ or VC++ for ? Pin
Gaurav171011-May-10 0:28
Gaurav171011-May-10 0:28 
AnswerRe: How to Track the event in Excel for cell insert/delete in C++ or VC++ for ? Pin
Stuart Dootson11-May-10 0:44
professionalStuart Dootson11-May-10 0:44 
GeneralRe: How to Track the event in Excel for cell insert/delete in C++ or VC++ for ? Pin
KTTransfer11-May-10 18:19
KTTransfer11-May-10 18:19 
GeneralRe: How to Track the event in Excel for cell insert/delete in C++ or VC++ for ? Pin
Stuart Dootson11-May-10 23:24
professionalStuart Dootson11-May-10 23:24 

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.