Click here to Skip to main content
15,892,072 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Problem in displaying image through CPictureHolder Pin
CPallini23-Sep-09 23:25
mveCPallini23-Sep-09 23:25 
AnswerRe: Problem in displaying image through CPictureHolder Pin
Gopal_Kanchana23-Sep-09 23:43
Gopal_Kanchana23-Sep-09 23:43 
QuestionRe: Problem in displaying image through CPictureHolder Pin
CPallini23-Sep-09 23:44
mveCPallini23-Sep-09 23:44 
AnswerRe: Problem in displaying image through CPictureHolder Pin
Gopal_Kanchana23-Sep-09 23:51
Gopal_Kanchana23-Sep-09 23:51 
GeneralRe: Problem in displaying image through CPictureHolder Pin
Gopal_Kanchana24-Sep-09 0:01
Gopal_Kanchana24-Sep-09 0:01 
GeneralRe: Problem in displaying image through CPictureHolder Pin
CPallini24-Sep-09 0:01
mveCPallini24-Sep-09 0:01 
QuestionProbelm with std::ma find function Pin
Lakshmi_p23-Sep-09 23:01
Lakshmi_p23-Sep-09 23:01 
AnswerRe: Probelm with std::ma find function Pin
CPallini23-Sep-09 23:14
mveCPallini23-Sep-09 23:14 
GeneralRe: Probelm with std::ma find function Pin
Lakshmi_p24-Sep-09 2:19
Lakshmi_p24-Sep-09 2:19 
AnswerRe: Probelm with std::ma find function Pin
Roger Stoltz23-Sep-09 23:18
Roger Stoltz23-Sep-09 23:18 
QuestionHow to return the original page protection flags Pin
nah133723-Sep-09 21:58
nah133723-Sep-09 21:58 
AnswerRe: How to return the original page protection flags Pin
Richard MacCutchan24-Sep-09 1:04
mveRichard MacCutchan24-Sep-09 1:04 
QuestionHELP!! Pin
Froztbyte66623-Sep-09 21:37
Froztbyte66623-Sep-09 21:37 
AnswerRe: HELP!! Pin
CPallini23-Sep-09 21:45
mveCPallini23-Sep-09 21:45 
AnswerRe: HELP!! Pin
Cedric Moonen23-Sep-09 21:46
Cedric Moonen23-Sep-09 21:46 
AnswerRe: HELP!! Pin
Michael Schubert23-Sep-09 22:17
Michael Schubert23-Sep-09 22:17 
GeneralRe: HELP!! Pin
CPallini23-Sep-09 22:24
mveCPallini23-Sep-09 22:24 
AnswerRe: HELP!! Pin
Richard MacCutchan24-Sep-09 1:06
mveRichard MacCutchan24-Sep-09 1:06 
QuestionCreating Sheet Music C++ Pin
EmirD23-Sep-09 21:30
EmirD23-Sep-09 21:30 
GeneralRe: Creating Sheet Music C++ Pin
CPallini23-Sep-09 21:44
mveCPallini23-Sep-09 21:44 
GeneralRe: Creating Sheet Music C++ Pin
EmirD26-Sep-09 10:13
EmirD26-Sep-09 10:13 
AnswerRe: Creating Sheet Music C++ Pin
Madhu Nair23-Sep-09 22:53
Madhu Nair23-Sep-09 22:53 
GeneralRe: Creating Sheet Music C++ Pin
EmirD26-Sep-09 10:16
EmirD26-Sep-09 10:16 
GeneralRe: Creating Sheet Music C++ Pin
Gopalakrishna Palem16-Nov-09 18:48
Gopalakrishna Palem16-Nov-09 18:48 
Questiondraw a rectangle in dialog based visual C++ 6.0 [solved] Pin
Eka Candra23-Sep-09 21:02
Eka Candra23-Sep-09 21:02 
Dear all,

I have a problem in Visual C++ 6.0.
I made a project using Dialog Based, not Single Document Type.
I want to make a rectangle that its color able to change when I clicked a button.

For draw the rectangle, I used this code.
__________________________________________________________
dc.Rectangle(10,10,208,92);
CRect RectBackground(10,10,208,92);

CBrush brush;
brush.CreateSolidBrush(RGB(red,green,blue));

dc.FillRect(RectBackground,&brush);
----------------------------------------------------------

I entered those code to class::OnPaint(), so OnPaint function become:
____________________________________________________________
void CGambarDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting

SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;

// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CPaintDC dc(this); // device context for painting
[color = blue]
// Background Rectangle
dc.Rectangle(10,10,208,92);
CRect RectBackground(10,10,208,92);

CBrush brush;
brush.CreateSolidBrush(RGB(red,green,blue));

dc.FillRect(RectBackground,&brush);
[\color]
CDialog::OnPaint();
}
}
-------------------------------------------------------------------------

It produce a black rectangle when I added
___________________________
red = green = blue = 0;
---------------------------
in class::OnInitDialog() fuction.

I think, when I add a button n change "red", "green", and "blue" values, the color of rectangle will change. But it doesn't work.
Code in my button function are:

_____________________________________________
void CGambarDlg::OnButton1()
{
red = green = blue = 255;
OnPaint();
}
---------------------------------------------

Please help me to solve this problem...

Thank you before..

Eka Candra

modified on Thursday, September 24, 2009 5:18 AM

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.