Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic ResizeToFitText maybe not working in all cases (Read 1026 times)
David Long
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 125
Location: England
Joined: Oct 23rd, 2006
ResizeToFitText maybe not working in all cases
Mar 21st, 2023 at 3:43pm
Print Post  
Does the function "ResizeToFitText(FitSize.KeepWidth);" work in all cases? The box in question has text padding set up as follows:

            box.TextPadding = new Thickness(1, 1, 1, 1);

The font used is:

            Font ChartFont = new Font("Segoe UI Semibold", 10F, FontStyle.Regular);

The text format is as follows:

            box.TextFormat                      = new StringFormat();
            box.TextFormat.Alignment       = StringAlignment.Center;
            box.TextFormat.LineAlignment = StringAlignment.Center;

But the box is not resized correctly (see 3rd box along in the screen-shot which has two letters missed off the end (it should be ...task are poor)

Looking at the debugger, the box height is set to 25.9mm which is not quite enough.

DavidL
  

Screenshot_2023-03-21_154119.png ( 17 KB | 42 Downloads )
Screenshot_2023-03-21_154119.png
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3153
Joined: Oct 19th, 2005
Re: ResizeToFitText maybe not working in all cases
Reply #1 - Mar 22nd, 2023 at 3:30pm
Print Post  
Try this build -
https://mindfusion.eu/_temp/winforms_fit_width.zip

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
David Long
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 125
Location: England
Joined: Oct 23rd, 2006
Re: ResizeToFitText maybe not working in all cases
Reply #2 - Mar 22nd, 2023 at 4:33pm
Print Post  
Thanks, that fixes the problem. Is it possible to have signed .NET 4 assemblies for FlowChart.NET Pro version 6.8.4? This is the last version available on our licence.

Many thanks
DavidL
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3153
Joined: Oct 19th, 2005
Re: ResizeToFitText maybe not working in all cases
Reply #3 - Mar 23rd, 2023 at 6:33am
Print Post  
We won't be backporting this to old versions. If you don't want to move to current one, you can work around like this:

Code
Select All
if (fit == FitSize.KeepWidth && !box.EnableStyledText)
{
    var r = box.Bounds;
    box.Resize(r.Width - box.TextPadding.Width, r.Height);
    box.ResizeToFitText(fit);
    box.Resize(r.Width, box.Bounds.Height);
} 



Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
David Long
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 125
Location: England
Joined: Oct 23rd, 2006
Re: ResizeToFitText maybe not working in all cases
Reply #4 - Mar 23rd, 2023 at 3:44pm
Print Post  
Ok, thanks, That has fixed the problem.
DavidL
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint