Control Height change direction (1 Viewer)

Monardo

Registered User.
Local time
Today, 23:00
Joined
Mar 14, 2008
Messages
70
Hello

I am trying to make something like custom bar chart on a form using rectangles. I made 4 rectangles (BarBZ, BarBA, BarKI and BarMA) and have the following code:

Code:
Dim PctBZ As Double
Dim PctBA As Double
Dim PctKI As Double
Dim PctMA As Double

PctBZ = Me.BZ / (Me.BZ + Me.BA + Me.KI + Me.MA)
PctBA = Me.BA / (Me.BZ + Me.BA + Me.KI + Me.MA)
PctKI = Me.KI / (Me.BZ + Me.BA + Me.KI + Me.MA)
PctMA = Me.MA / (Me.BZ + Me.BA + Me.KI + Me.MA)

Me.BarBZ.Height = 2000 * PctBZ
Me.BarBA.Height = 2000 * PctBA
Me.BarKI.Height = 2000 * PctKI
Me.BarMA.Height = 2000 * PctMA
It works perfectly except... the rectangles grow/shrink downwards and not upwards. As a result the bars are aligned to top, while I would like to have them aligned to bottom.

Is there a way to do that? I guess it's either very simple, or impossible.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 21:00
Joined
Feb 19, 2013
Messages
16,618
use the insideheight property to determine the bottom so

Code:
myctrl.top=insideheight-myctrl.height
 

Monardo

Registered User.
Local time
Today, 23:00
Joined
Mar 14, 2008
Messages
70
Thanks it worked
 

CJ_London

Super Moderator
Staff member
Local time
Today, 21:00
Joined
Feb 19, 2013
Messages
16,618
you can also look at using .move whch enables you to change all 4 dimension properties in one go
 

Users who are viewing this thread

Top Bottom