Changing a panel colour

Ask for help with your homework/assignments in this forum!

Moderators: Darobat, RecursiveS, Dante Shamest, Bugdude, Wizard

Changing a panel colour

Postby choccokels » Wed Jun 20, 2012 1:49 pm

have just started to learn c++, for a job i am trying to get. I all ready know basic so i know a bit about programming, i am required to make a GUI application which when a colour is chosen in a combo box the panel will change to that colour also, at the moment i just have the combo box all set up, i just dont know how to do the panel part in c++. Please help , underneth is my coding up to now.

"//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
ComboBox1->ItemIndex = 0;
ComboBox1Change(NULL);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ComboBox1Change(TObject *Sender)
{
switch (ComboBox1->ItemIndex) {
case 0:
Caption = "Red" ;
break;
case 1:
Caption = "Green";
break;
case 2:
Caption = "Blue";
break;
case 3:
Caption = "White";
break;
case 4:
Caption = "Black";
break;
}
}
//---------------------------------------------------------------------------
choccokels
 
Posts: 3
Joined: Wed Jun 20, 2012 1:46 pm

Return to Homeworks

Who is online

Users browsing this forum: No registered users and 5 guests