Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating multiple shapes on load.

Status
Not open for further replies.

richasr1

Programmer
Dec 25, 2007
6
GB
Hey,

I'm creating a very simple program that will allow you to manipulate shapes; each shape has the same mousedown properties as every other shape.

What i want to do next is to use a settings dialogue box to set the number of shapes created when the form is run, bearing in mind that each created shape must have the same functionality as every other shape.

Heres a snippet of code inside a buttons click event, all this does is create the shape and assign it to a group box, there's other code to position the new shape next to existing shapes which is unnecessary here i think:

TShape* shpNew;
shape = new TShape(this);
shape->Parent = mainGrp;

//set all the appearance properties
shape->Shape = stRectangle;
shape->Brush->Color = clRed;
shape->Width = 33;
shape->Height = 33;
shape->Left = 10;
shape->Top = 10;

I'm not sure how i would go about creating multiple shapes on startup, let alone creating them based on a pre-set number.
The idea is that I won't need a button on the form to add more shapes, I can just use a default number of shapes to begin with and then change that number through a dialogue window.

help would be much appreciated, thanks in advance.

Steve.
 
Correction.

I just need to know how to create multiple shapes rather than one at a time, needs to be at least 2 at a time.

I believe once i know how to do this, I can use a component on the settings dialogue to change this.

Sorry for the mass post! I cant seem to find an edit post link if there even is one.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top