1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
private void LoadValues()
{
if (m_fMaxValue > 0)
{
m_fHeightMultiplicator = (float)this.Height / (float)m_fMaxValue;
}
m_bUpdatingControls = true;
for (int iIndex = 0; iIndex < m_iCapacity; iIndex++)
{
Label objLabel = this.Controls[
NamePrefix + iIndex.ToString()] as Label;
if (m_lfValues.Count <= iIndex)
{
objLabel.Location = new Point(
objLabel.Location.X,
objLabel.Location.Y + objLabel.Height);
objLabel.Height = 0;
continue;
}
float fValue = m_lfValues[iIndex];
int iDeltaHeight = Convert.ToInt32(
fValue * m_fHeightMultiplicator - objLabel.Height);
objLabel.Height = Convert.ToInt32(
fValue * m_fHeightMultiplicator);
objLabel.Location = new Point(
objLabel.Location.X,
objLabel.Location.Y - iDeltaHeight);
if (fValue >= m_fTrigger &&
objLabel.BackColor != m_objTriggeredColor)
{
objLabel.BackColor = m_objTriggeredColor;
}
else if (fValue < m_fTrigger &&
objLabel.BackColor != m_objNormalColor)
{
objLabel.BackColor = m_objNormalColor;
}
if (m_bDisplayValue)
objLabel.Text = fValue.ToString();
else
objLabel.Text = "";
}
m_bUpdatingControls = false;
} |
Partager