Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Adding color to my test panel using MS6.0 running under Visual C++6.0.

I love adding colors to everything quickly and easily under CVI. I know that I have to play by Microsoft's rules when I develop under windows but I was hoping you could point me in the right direction. Are there any examples that show how to change a button's background to green? I've been reading the help file but I can't seem to put it all together.

Also, are there any plans for adding a paintbrush tool in the future releases of MS so you can make everything look nice? This is important stuff right.

Grant
Grant M. Johnson
Project Engineer
LECO Corporation
0 Kudos
Message 1 of 3
(3,244 Views)
That's one of the advantages of our Measurement Studio User Interface controls is that they have rich property pages that let you set these kind of properties in the Resource Editor. If you are referring to Microsoft's button control, you have to do it programmatically. With the CNiButton, you just go to the Property pages of the button, and change the On color and Off color under the Button tab.

Best Regards,

Chris Matthews
National Instruments
Message 2 of 3
(3,244 Views)
Grant:

An alternative to the method that Chris suggested for specifying color properties of a National Instruments control is to programmatically modify the control's properties. A very simple and effective way to do this is to use MFC's CColorDialog class. This MFC dialog presents a palette to the user very similar to one you might see when configuring color properties of the Windows operating system. You could use this dialog to allow users the ability to customize the display colors of your application at run-time.

For example, I have written a simple dialog example that contains only a single National Instruments button control. In the Click event handler for this button, my code reads:

void CColorDlg::OnClickChangecolor()
{
CColorDialog
dlg(m_button.GetOffColor());

if(IDOK == dlg.DoModal())
{
m_button.SetOffColor(dlg.GetColor());
}
}

Every time the button is pressed, this code creates the CColorDialog as a modal dialog and sets the current color to reflect the current color settings of the button control. If the user presses the OK button then the button is changed to the color selected in the dialog.

Used with ComponentWorks and ComponentWorks++, prepackaged MFC dialogs like CColorDialog, CFontDialog, CFileDialog, CPageSetupDialog, and CFindReplaceDialog can often be used to quickly add professional features to your application.

Hope this helps,

Chris W.
Message 3 of 3
(3,244 Views)