Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
450
Floating Toolbar Position and Size
posted

Hi

Please advise as to how I would set a floating toolbar's position and size?

 The utMain.Toolbars[0].FloatingLocation.X says  Gets / sets but does not allow setting a value;

 

How would the FloatingSize be manipulatedf as well?

 

Thank you

  • 44743
    posted

    The compiler will not allow you to directly manipulate value types returned from a property. This is because getting the property makes a copy of the value type on the stack. Then if you were to set a property on the value type, it would set the property on the copy. As soon as the statement was over, the copy of the value type would be lost. Instead, you have to set the FloatingLocation property directly:

    utMain.Toolbars[0].FloatingLocation = new Point(newXValue, utMain.Toolbars[0].FloatingLocation.Y);

    The same applies to the FloatingSize because it is also a value type.