[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

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

Posted on 2004-09-14
3
Medium Priority
?
2,399 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
[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
3 Comments
 
LVL 4

Accepted Solution

by:
Delphian earned 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Make the most of your online learning experience.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Introduction to Processes

656 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