Hi,
This may be an easy one but I could not find an answer
here or Help files.
I derived my own class from
LinearGradientRoundedRectangle ( from Demo1 sample )
All I want is Some text to show up inside this rectangle
and should fit nicely ( font/text should stretch nicely
to fill the rectangle. so when user do a scaling to Fit
window etc the text should show)
Right now the text is too small but the rectangle is big.
I am drawing on a huge Document and then doing a “fit”
to the View , so the final look to the user is big
enough rectangle but small text ( not readable ).
If you want this text-and-rectangle to be a node, just use either:
- a GoBasicNode with .LabelSpot = Middle and .Shape = yourRectangle, OR
- a GoTextNode with .Background = yourRectangle
If you don’t want your thing to be a node, you could use a GoComment, or construct it yourself using a GoGroup.
In any case, you can modify the Label (a GoText) .FontSize to be larger, if it’s too small for your taste.
It isn’t clear to me from your description if you wanted the text to be a constant size, regardless of the GoView.DocScale. If so, you’ll need to modify the FontSize as the DocScale changes, in a GoView.PropertyChanged event handler.
Here is what I do now.
I draw a Rectangle with width=200, Height=200
and use GoText with text=“Some Text”
and then I do a MyView.RescaleToFit() so users will see
the entire Document.
Here the Rectangle looks good in terms of size etc
but the Text is too small.
I want the text to be inside ( by stretching/skewing )
otherwise I cant see the Text inside the rectangle.
Thanx