Solved

Scroll box and Canvas

Posted on 1998-01-21
6
1,469 Views
Last Modified: 2013-01-10
To my surprise I found out that a Delphi scroll box has no OnScrool event or ANYTHING that will tell me when the user scrools it!!! How will I solve this problem?!

And another thing that really drives me crazy is that when I draw on the canvas of a Paintbox or a form, all the graphics disappears when this area becomes hidden somehow, I mean by another window or scrolled away, AND I CAN'T RESTORE IT anyhow unless I draw it again!!!
Smth about that, PLEASE?

Thankful for any comment!
Matvey
0
Comment
Question by:Matvey
[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
  • 2
6 Comments
 
LVL 5

Expert Comment

by:inter
ID: 1357216
Dear Matvey,

Regarding First Question of yours:
(These are two methods that I can imagine rightnow)

- Do you want a clean or dirty way(I mean clean way is to override TScrollBox we introduce one new event OnScrolled and override two methods)
- Dirty way, try to capture scroll events in applications.onmessage

Regarding Second Question of yours:

- As far as I know TPaintBox is just a cliping rectangle, so you can not draw persistent images(as far as I know) on it unless every time you paint it in OnPaint, so another method is to use TImage and create a bitmap for its Picture property. If you use the Canvas of the Image.Picture.Bitmap.Canvas to draw the things they do persists overlapping, hiding, showing etc...

Waiting for your comment,
Igor
0
 
LVL 3

Author Comment

by:Matvey
ID: 1357217
Hi Igor,

You see, if a have a good solution for my seccond question, I don't need one for my first question!

What I really need is some good Canvas object to draw things on it so I won't need to refresh them anytime someone scrolls the drawing surface.
What I actually have is a huge Image (13MB), that I can't open as 16 color image because it seemes I don't have enough resources, so I do open it as just BW image as it is. What for do I need it to be opened as 16 colors at least? -to draw colorful lines on it that will seem to the user as roads - the image is actually a scaned map. So I thought that if I can't draw colorful things on the image, why not to put some transperent drawing surface above it to draw on it.
And so I did. But now I have the problems I've described above.
To REDRAEW all the roads of Alabama and Florida everytime doesn't seemes to me like a good solution. And I've tried to put an Image instead of PaintBox above it, but then I also run out of resources, because it has to be the same size as the Image.
I understand that I can make it NORMALLY (you know what I mean - to calculate which lines will be seen, which won't; to reduce the sizes of the images to fit only the screen, to load only the rectangle that needes to be visible, etc...), but time, long brain activity and patience are needed for that task, which are, I must admit, limited resources for me right now :)

Anything on your mind?
Are you from Russia too?
0
 
LVL 5

Expert Comment

by:inter
ID: 1357218
Dear Matvey,

I guess, we can solve your problem with meta-files. So when we want draw a thing on canvas we put it into the metafile and in our TPaintBox.OnPaint just tell metafile to draw everything it contains by PlayMetafile api function (or using TMetaFile objects methods). Thats what in my mind currently.

About the country, I am very close Russia, the Igor is my nickname assigned by my friend decades ago.(I am from Turkey)

So, please consider this solution and notify me, I am here about an hour.

Sincerely,
Igor
0
Independent Software Vendors: 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!

 

Accepted Solution

by:
mov earned 20 total points
ID: 1357219
scrollbox1.HorzScrollBar.Position.. and use onClick event.. and then just look from that scrollbox1.HorzScrollBar.Position for position.. there is own for vertical too.

And that bitmap rotation question.. make two images... and copy from other to other..like:

image1 have 12mb picture sized 3000x3000.. and image2 is that area you can see.. like 200x200.. and now you only copy some area from image1 to image2.

0
 
LVL 3

Author Comment

by:Matvey
ID: 1357220
Hi mov!

Of course I had the idea of copying image parts...but if it's the only way, then I guess I'll have to play with it for a while..

C U
Matvey
0
 
LVL 5

Expert Comment

by:inter
ID: 1357221
Did you consider the metafile approach friend? Or do you solve the problem?

Sincerely,
Igor
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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month10 days, 15 hours left to enroll

631 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