Space width.
-
I've got a TextBlock wich varies in With and FontSize. I want to fill it completely with spaces. How can I calculate how much spaces I need to fill the entire TextBlock? gr. Kevin
-
"Do you want to replace all text with spaces?" No. The situation is a bit more complex. But lets say the TextBlock is empty and I would want to fill it with spaces. The only data I have is the Width of the TextBlock and the FontSize. If I would know the "width" of a space in the same FontSize I could calculate how many I would need. But how do I calculate the width of a space?
-
"Do you want to replace all text with spaces?" No. The situation is a bit more complex. But lets say the TextBlock is empty and I would want to fill it with spaces. The only data I have is the Width of the TextBlock and the FontSize. If I would know the "width" of a space in the same FontSize I could calculate how many I would need. But how do I calculate the width of a space?
-
-
I sounds like it could work. But how do I use it? I can't make a new instance of it, like Graphics g = new Graphics();, And when I just use Graphics. I don't get MeasureString. Can you help me with this.
-
Maybe I should have mentioned that I'm creating WPF application and not a WindowsForms application. I have a TextBlock in a ScrollViewer. The ScrollViewer moves it position so you will see another part of the TextBlock. This creates somekind of Marque. At the start I want the text to start off the screen therefor I need the spaces.
-
I sounds like it could work. But how do I use it? I can't make a new instance of it, like Graphics g = new Graphics();, And when I just use Graphics. I don't get MeasureString. Can you help me with this.
You need to use the Graphics context that you're currently rendering with (e.g. the one that's passed in to the OnPaint method)
-- Help me! I'm turning into a grapefruit! Buzzwords!
-
Maybe I should have mentioned that I'm creating WPF application and not a WindowsForms application. I have a TextBlock in a ScrollViewer. The ScrollViewer moves it position so you will see another part of the TextBlock. This creates somekind of Marque. At the start I want the text to start off the screen therefor I need the spaces.
You should have: a) Posted this on the WPF forum and b) looked into the FormattedText class to see what methods are available there (hint - take a look at the GetMaxWidths method).
Deja View - the feeling that you've seen this post before.
-
You should have: a) Posted this on the WPF forum and b) looked into the FormattedText class to see what methods are available there (hint - take a look at the GetMaxWidths method).
Deja View - the feeling that you've seen this post before.