changing properties of a form at runtime

  • Thread starter Thread starter tonyjeffs
  • Start date Start date
T

tonyjeffs

VC++Express;
I have a form with one button. This is my code for the button1 click
event.

BackColor=Color::Red; // Red is in the scope Color ?
changes
color of Form1
button1->BackColor=Color::White; //changes color of button1
MessageBox::Show("Hello"); //Show is in the scope MessageBox???
button1->Text="BUTTON!"; //straightforward. Same as
(*button1).Text="BUTTON!";
button1->Font=("Arial"); //WRONG


It took me a while to figure some of these out by cribbing from
existing code on the web.
How would I more easily find out how to , for example, change the
font of the button text, or any feature of any control?

thanks


Tony
 
tonyjeffs said:
VC++Express;
I have a form with one button. This is my code for the button1 click
event.

BackColor=Color::Red; // Red is in the scope Color ?
changes
color of Form1
button1->BackColor=Color::White; //changes color of button1
MessageBox::Show("Hello"); //Show is in the scope MessageBox???
button1->Text="BUTTON!"; //straightforward. Same as
(*button1).Text="BUTTON!";
button1->Font=("Arial"); //WRONG


It took me a while to figure some of these out by cribbing from
existing code on the web.
How would I more easily find out how to , for example, change the
font of the button text, or any feature of any control?

thanks


Tony

Just a thought, read the documentation?

--
============
Frank Hickman
NobleSoft, Inc.
============
Replace the _nosp@m_ with @ to reply.
 
Just a thought, read the documentation?

which can be found here assuming you are using this 'flavor' of Button
class:

http://msdn2.microsoft.com/en-us/library/system.windows.forms.button(VS.80).aspx

[technically there is no 'documentation' since the languages are shipped
without any, and the word implies 'documents' are involved...hehe]

Also, changing the button font is a bit tricky. You have to create a brand
new Font instance that you like externally and store it in the Button's
Font^ member. You can't just change the properties of the Button's Font
instance which already part of the Button instance, all f it's properties
are read-only...

[==Peter==]
 
Back
Top