Solved

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

Posted on 2004-09-14
3
2,342 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 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Six Sigma Control Plans

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