?
Solved

Showing Percentage

Posted on 2003-02-22
4
Medium Priority
?
340 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
[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
  • 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

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!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month10 days, 8 hours left to enroll

765 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