GoButton doesn’t support resizing. The LayoutChildren for GoButton just computes the rectangle for the icon and label, then wraps the TopLeftMargin and BottomRightMargin around that. You could, I suppose, make it resizable by adjusting the margins… I’ll look to see if that’s practical in this case.
I modified your code to keep button label centered at all times - at the end of margin calculations I added:
this.Label.Center = this.Center;
This helps, however, the button's background is not repainted fully. Say, if I drag sizing point to the right to make button wider. Label shifts to the right as well, but all area to the left of the label is white, not the specified background colour. Clicking on left sizing point causes repaint. Is there some way to force the repaint?
Sorry, I can’t reproduce what you’re seeing. Since you just joined the forum, I’m assuming this is still a fairly simple “getting started” app… Can you send me the whole project? Send it to godiagram [at] the domain above.
Thank you for your reply! What I'm doing here, is porting/rewriting in C# our old and rather big C++ project, which was using Go++. As I can see from the old code, we could not get resizable button there neither, so we wrote a class which was faking CGoButton, and was resizable via dragging, and via SetSize, etc. (BTW, I spent some time today trying to get Size or Bounds to work for ResizableButton class - no much success yet. )
Maybe you can suggest some ideas in the same vein of faking the button - some 3Dborder effects for raised and sunken edge around RounderRectangle, or something similar?
And I'll try to make a simple demo application to work on ResizableButton.