?
Solved

Showing Percentage

Posted on 2003-02-22
4
Medium Priority
?
341 Views
Last Modified: 2010-04-04
This is simple math question (I stink at math)

I'm adding translucency to my application, and I want to use a trackbar or dropdown to let the user select the visibility of forms in the application.

I set the max on my trackbar to 255 and when you slide it the translucency changes on the form.

255 is 100% visible, 0 is 0% visible.

What I want to do is put the percentage of visibilty into an integer so I can display it on a label or something, indicating what "percentage of visibilty" the form has.

Also, I'd lide a way to calculate all the in-between percentages, just in case I decide to go with a dropdown.


Thanks!
0
Comment
Question by:Psylord
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
Slaugh earned 200 total points
ID: 8001560
Put Math in your Uses then

procedure TForm1.TrackBar1Change(Sender: TObject);
begin
label1.caption := 'Percentage = '+ floattostr(roundto(trackbar1.Position /255 *100, -2)) + '%';
end;
0
 
LVL 6

Expert Comment

by:DaFox
ID: 8001561
100 / 255 * TrackBar1.Position ?

Markus
0
 
LVL 6

Expert Comment

by:DaFox
ID: 8001569
Damn! ;-)
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 8001669
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Is your organization moving toward a cloud and mobile-first environment? In this transition, your IT department will encounter many challenges, such as navigating how to: Deploy new applications and services to a growing team Accommodate employee…
Suggested Courses

621 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