1
Answer

Position of custom controls messed up by scrollbar?

Emilie

Emilie

16y
3.3k
1
Hi there,

I have a custom control that contains a button which adds the same custom control bellow it when you click on it. So you can keep adding and adding the same control vertically. My problem happens when the controls get close to the bottom of the window and the scrollbar appears. Then the controls appear more and more seperated from each other (no more 90 offset for the Y). Here is my code:

            FunctionRule newRule = new FunctionRule();
            newRule.functionIdentifier = e.Identifier;
            Point newRulept = newRule.Location;
            int positionYRule = lastRuleLocationPoint.Y + 90;
            int positionXRule = lastRuleLocationPoint.X;
            newRulept.Offset(positionXRule, positionYRule);
            MessageBox.Show(lastRuleLocationPoint.ToString());

The MessageBox always shows the right number that increments by 90, but on the screen it looks WEIRDDDDD...

Anyone got any idea?

Thanks,
Emmi
Answers (1)