Hi,
Whenever the bounds of a GoIconicNode is changed programmatically the method, ComputBounds(), gets called which returns the new bounds. However, this method seems to be returning the Bounds just a little bit smaller than what had been set programmatically, maybe to leave some amount of margin/buffer for drawing or some similar pupose.
Can anyone please tell me why this happens?
Thanks,
Rafique
Setting the Bounds of a GoGroup will call the ResizeChildren and LayoutChildren methods; LayoutChildren will then set GoObject.InvalidBounds to true so that ComputeBounds is called when needed.
It is likely that LayoutChildren for a node such as the predefined ones will result in a sizing and arrangement of the child objects that will not exactly match the originally requested size when you set the group’s Bounds.
For example, if you have a GoIconicNode with a long text label and tried to make the Width very small, the Icon might narrow, but the Label will not, because the Label’s GoText.AutoRescales property is false.
Perhaps you don’t really care about the Bounds of the whole node, but just the Bounds of the node’s Icon.
If the difference in Bounds is due to the children, then shouldnt ComputeBounds return a bound slightly bigger then the requested bound?
Yes, that would happen in the example I described. I don’t know what your particular case is.
In any case, why do you care? Do you really want to set the Icon’s Bounds anyway? Or more generally, set the SelectionObject’s Bounds? (The GoObject.SelectionObject for a GoIconicNode is actually the GoIconicNode.Icon.)