Solved

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

Posted on 2004-09-14
3
2,232 Views
Last Modified: 2010-08-05
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...

Thanks
0
Comment
Question by:PETERJORDAN
3 Comments
 
LVL 4

Accepted Solution

by:
Delphian earned 500 total points
ID: 12071357
TScrollBar doesn't have a Canvas. And you need it to Draw.

You have some choices:
1- Derive your own  TScrollBar and add a canvas to it
2- Replace the TScrollBar for a control that have a Canvas property
3- Use a TPaintBox. Appear to me that control is designed to be a
a drawings'  blackboard

Tips:
#1 Way
See the code on Forms unit (TCUstomForm class) - it's pascal but the changes to
C++ are minimal and are easier to read (if you can read C++ code, pascal is not
a problem). Read on help about TControlCanvas unit

#2 Way
You can use a Panel. Or research on VCL source code for other containers
with a canvas (don't look on help - go rightly to source code)

#3 Way
No need. Press F1.

I hope this helps,

Fabricio
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
maxMirror challenge 10 88
Enhanced For loop vs ForEach Loop 4 56
nestparen challenge 4 56
move one pixel 4 41
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now