Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2004-09-14
3
Medium Priority
?
2,386 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 1000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
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 column That will then direct you to their download page. From that p…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

885 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