Click here to Skip to main content
15,881,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have made 3 radio buttons. When i run program, they all 3 are already in enable condition. What should I do?
Posted
Updated 15-Jun-10 23:13pm
v4
Comments
Richard MacCutchan 16-Jun-10 4:30am    
What do you want to do? Your question is not very clear, please try and reword it.
Sweety Khan 16-Jun-10 5:01am    
:) how lucky u r for me. i got my mistake and correct it so leave this question.

now this is my question.

i have made a button(color filter) on a dialogue(image analyser). when i click on this a new dialog(color filter) opens. it has three radio buttons and ok button. when i select one of the radio buttons and click on ok, it displays the image on the same dialog but i want that when i click on ok button the dialog will close and the image will display on dialog(image analyser). so wht should i do for this?

waitingg for ur reply.......:)
Sweety Khan 16-Jun-10 5:11am    
sorry i forget to give my code. this my ok button code

void CColourDlg::OnBnClickedButton1()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
CBitmap img;
CDC dc;
BITMAP bmp;
img.LoadBitmapW(IDB_BITMAP1);
img.GetBitmap(&bmp);
CDC* pDC = this->GetDC();
dc.CreateCompatibleDC(pDC);
CBitmap* pOld = dc.SelectObject(&img);
for(int y = 0; y BitBlt(200, 200, bmp.bmWidth, bmp.bmHeight, &dc, 0, 0, SRCCOPY);
dc.SelectObject(pOld);
}

now plz tell me wht should i add to display image on another dialog.
waiting for ur reply.....
LittleYellowBird 16-Jun-10 5:41am    
If you have a new question then start a new thread, that way everyone gets a good chance to see it and you are much more likely to get an answer. Plus you can format it properly so it is easier to read. Thank You.
Sweety Khan 16-Jun-10 7:48am    
ohk. for formatting i should use this pre tag
?

Radio buttons need to be in a Group Box and need the Auto Style option set if they are to select/deselect automatically.

Here's a nice little article about radio buttons that should help:

http://www.functionx.com/visualc/controls/radiobutton.htm[^]

:)
 
Share this answer
 
Comments
Hans Dietrich 21-Jun-10 16:26pm    
It's not necessary for the radio buttons to be in a group box. It IS necessary that the first radio button have the WS_GROUP style, and for all the radio buttons to have the BS_AUTORADIOBUTTON style.
Check if tab order and grouping are correct.
 
Share this answer
 
Comments
Sweety Khan 16-Jun-10 5:09am    
sorry i forget to give my code. this my ok button code

void CColourDlg::OnBnClickedButton1()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
CBitmap img;
CDC dc;
BITMAP bmp;
img.LoadBitmapW(IDB_BITMAP1);
img.GetBitmap(&bmp);
CDC* pDC = this->GetDC();
dc.CreateCompatibleDC(pDC);
CBitmap* pOld = dc.SelectObject(&img);
for(int y = 0; y < bmp.bmHeight; y++)
{
for(int x = 0; x < bmp.bmWidth; x++)
{
COLORREF rgb = dc.GetPixel(x, y);
BYTE r = GetRValue(rgb);
BYTE g = GetGValue(rgb);
BYTE b = GetBValue(rgb);
if(color==0)
dc.SetPixel(x, y, RGB(r,0,0));
else if(color==1)
dc.SetPixel(x, y, RGB(0,g,0));
else
dc.SetPixel(x, y, RGB(0,0,b));
}
}
pDC->BitBlt(200, 200, bmp.bmWidth, bmp.bmHeight, &dc, 0, 0, SRCCOPY);
dc.SelectObject(pOld);
}

now plz tell me wht should i add to display image on another dialog.
waiting for ur reply.....
use Device Contest of u r dialog where you want to draw your image...
 
Share this answer
 
Comments
Sweety Khan 20-Jun-10 12:39pm    
what is device contest?
Here's what you do (this is a three-year old memory, so you may have to tweak it).

0) Put a GroupBox control on your form.

1) Put the radio buttons inside the groupbox.

2) Set the tab order, starting with the radio buttons, and finishing with the groupnbox.

3) Set the first radio button to be a group and a tab stop

4) Set the groupbox to be a group

5) You're done.

If you have a problem, GOOGLE it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900