Solved

Drawing squares, circles, and painted rectangles in Borland C++ Builder

Posted on 2004-09-14
3
2,364 Views
Last Modified: 2013-11-17
Hi everybody,

I'm new in this community and in the C++ also...

I know that this question is too easy to answer but I realy would like this help.
In C++ Builder I have a form and a ScrollBox. How can I draw a square, a circle, a painted rectangle, a line and write a single char inside the ScrollBox but without using a TShape or TLabel component ?
If you have an example script it would be great!

ps: I don't want to use TShape component because actually I need to draw hundreds of shapes in the scrollbox and I think if I use a TShape or TLabel it will consume a lot of CPU...

ps2: sorry my english :(
 
0
Comment
Question by:PETERJORDAN
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
George Tokas earned 500 total points
ID: 12062413
I think that your approach is a bit wrong..
Anyway.. You can use whatever code you can find on the web to draw the shapes you want as long as you obtain a handle on the form's canvas.
Also the Canvas property (on TForm) have some interesting functions such as rectangle  and ellipse and some more. You can find those at the help of BCB.
Now why I'm saying that your approach is wrong.
TShape and TLabel are wrappers to help you create applications FAST. Also the components are REAL FAST. Immagine that some 50 lines of code using standard code or using TCanvas functions can be implemented with only a few lines(3 or 4).

Regards,
gtokas.
0
 

Author Comment

by:PETERJORDAN
ID: 12063556
thanks for your help gtokas.

Let me tell you what I am doing: now I've placed under ScrollBox a TImage component and I'm drawing over it. It seems to be all right 'till now. Also I need to do an extra code for the autosize of TImage component because when the form is maximized I have to do the same with it.

I just dont know how can I clean the images on the TImage.

Regards,

Peter.
0
 
LVL 16

Expert Comment

by:George Tokas
ID: 12065222
That means that you can create a rectangle with some color black lets say..
Made it on the same size as TImage and copy it to TImage..
The easiest way..

gtokas.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand columnThat will then direct you to their download page.From that page s…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question