Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / November 2007

Tip: Looking for answers? Try searching our database.

changing properties of a form at runtime

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tonyjeffs - 01 Nov 2007 14:50 GMT
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
Frank Hickman - 01 Nov 2007 18:34 GMT
> VC++Express;
> I have a form with one button. This is my code for the button1 click
[quoted text clipped - 17 lines]
>
> Tony

Just a thought, read the documentation?

Signature

============
Frank Hickman
NobleSoft, Inc.
============
Replace the _nosp@m_ with @ to reply.

Peter Oliphant - 01 Nov 2007 19:15 GMT
>> 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==]

>> VC++Express;
>> I have a form with one button. This is my code for the button1 click
[quoted text clipped - 19 lines]
>
> Just a thought, read the documentation?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.