Solved

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

Posted on 2004-09-14
3
2,372 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

751 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