Click here to Skip to main content
15,885,088 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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

AnswerRe: draw a rectangle in dialog based visual C++ 6.0 Pin
«_Superman_»23-Sep-09 21:22
professional«_Superman_»23-Sep-09 21:22 
QuestionRe: draw a rectangle in dialog based visual C++ 6.0 Pin
CPallini23-Sep-09 21:27
mveCPallini23-Sep-09 21:27 
AnswerRe: draw a rectangle in dialog based visual C++ 6.0 Pin
«_Superman_»23-Sep-09 21:30
professional«_Superman_»23-Sep-09 21:30 
JokeRe: draw a rectangle in dialog based visual C++ 6.0 Pin
CPallini23-Sep-09 21:36
mveCPallini23-Sep-09 21:36 
GeneralRe: draw a rectangle in dialog based visual C++ 6.0 Pin
«_Superman_»23-Sep-09 22:38
professional«_Superman_»23-Sep-09 22:38 
GeneralRe: draw a rectangle in dialog based visual C++ 6.0 Pin
Eka Candra23-Sep-09 22:17
Eka Candra23-Sep-09 22:17 
QuestionRe: draw a rectangle in dialog based visual C++ 6.0 Pin
CPallini23-Sep-09 22:26
mveCPallini23-Sep-09 22:26 
AnswerRe: draw a rectangle in dialog based visual C++ 6.0 Pin
Eka Candra23-Sep-09 22:49
Eka Candra23-Sep-09 22:49 
AnswerRe: draw a rectangle in dialog based visual C++ 6.0 Pin
CPallini23-Sep-09 21:24
mveCPallini23-Sep-09 21:24 
GeneralRe: draw a rectangle in dialog based visual C++ 6.0 Pin
Eka Candra23-Sep-09 22:38
Eka Candra23-Sep-09 22:38 
GeneralRe: draw a rectangle in dialog based visual C++ 6.0 Pin
KarstenK23-Sep-09 22:51
mveKarstenK23-Sep-09 22:51 
GeneralRe: draw a rectangle in dialog based visual C++ 6.0 Pin
CPallini23-Sep-09 22:54
mveCPallini23-Sep-09 22:54 
AnswerRe: draw a rectangle in dialog based visual C++ 6.0 Pin
Eka Candra23-Sep-09 23:04
Eka Candra23-Sep-09 23:04 
GeneralRe: draw a rectangle in dialog based visual C++ 6.0 Pin
Richard MacCutchan24-Sep-09 1:13
mveRichard MacCutchan24-Sep-09 1:13 
QuestionMY simple txt Based Rpg Pin
akosidandan23-Sep-09 20:15
akosidandan23-Sep-09 20:15 
AnswerRe: MY simple txt Based Rpg Pin
CPallini23-Sep-09 20:49
mveCPallini23-Sep-09 20:49 
GeneralRe: MY simple txt Based Rpg Pin
akosidandan23-Sep-09 21:12
akosidandan23-Sep-09 21:12 

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.