-
May 6th, 2021, 09:24 AM
#1
Thread Starter
Lively Member
Font size changed after using LiveCharts.WinForms.GeoMap()
I am using a GeoMap from LiveCharts in my application that shows the worldmap.
When I open the form that displays the map all the other forms in my applications start using a completely different (and smaller) font.
I am not setting the font in my map form.
Code:
ReadOnly values As Dictionary(Of String, Double) = New Dictionary(Of String, Double)()
ReadOnly geoMap1 As LiveCharts.WinForms.GeoMap = New LiveCharts.WinForms.GeoMap()
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
geoMap1.TabIndex = 0
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.BackColor = System.Drawing.Color.White
geoMap1.Source = "C:\Users\Gebruiker\Downloads\World.xml"
Me.Controls.Add(geoMap1)
geoMap1.Hoverable = True
geoMap1.SetBounds(50, 10, 1100, 800)
AddHandler geoMap1.LandClick, AddressOf Me.GeoMap1_LandClick
End Sub
Private Sub GeoMap1_LandClick(ByVal arg1 As Object, ByVal arg2 As LiveCharts.Maps.MapData)
Console.WriteLine(arg2.Id)
End Sub
-
May 6th, 2021, 10:21 AM
#2
Re: Font size changed after using LiveCharts.WinForms.GeoMap()
The culprit is this line:
Code:
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
This is documentation on the specific enumeration (documentation):
Controls scale relative to the dimensions of the font the classes are using, which is typically the system font.
-
May 6th, 2021, 10:31 AM
#3
Thread Starter
Lively Member
Re: Font size changed after using LiveCharts.WinForms.GeoMap()
That's what I tought but when I gray out this line it still happens.
-
May 6th, 2021, 03:45 PM
#4
Re: Font size changed after using LiveCharts.WinForms.GeoMap()
I found the documentation behind the GeoMap here: https://lvcharts.net/App/documentati...rts-Wpf-GeoMap
Nothing seems to indicate that it would affect the application's font, but if you stop adding the control to the form, does your font stay the same?
-
May 6th, 2021, 04:01 PM
#5
Thread Starter
Lively Member
Re: Font size changed after using LiveCharts.WinForms.GeoMap()
I removed anything related to the GeoMap and then the font stays unchanged.
As soon as i put this line again: ReadOnly geoMap1 As LiveCharts.WinForms.GeoMap = New LiveCharts.WinForms.GeoMap()
the font changes.
-
May 6th, 2021, 05:07 PM
#6
Re: Font size changed after using LiveCharts.WinForms.GeoMap()
Are you able to dig into the source code or is it protected?
-
May 7th, 2021, 09:48 AM
#7
Thread Starter
Lively Member
Re: Font size changed after using LiveCharts.WinForms.GeoMap()
I tested the application at work on our laptop and there the issue doesn't occur. So it just happens at my desktop at home.
No idea what makes it do that.
-
May 7th, 2021, 10:41 AM
#8
Re: Font size changed after using LiveCharts.WinForms.GeoMap()
I'm sorry, I'm sort of at a loss as to why this would be happening.
Perhaps someone else can jump in.
-
May 7th, 2021, 11:14 AM
#9
Addicted Member
Re: Font size changed after using LiveCharts.WinForms.GeoMap()
It sort of suggests that the call tries to set a default font which is present on your work laptop, but missing from your home desktop and therefore another fall back font is applied.
-
May 7th, 2021, 11:19 AM
#10
Thread Starter
Lively Member
Re: Font size changed after using LiveCharts.WinForms.GeoMap()
So is there a way to identify this action at runtime?
-
May 7th, 2021, 11:48 AM
#11
Addicted Member
Re: Font size changed after using LiveCharts.WinForms.GeoMap()
I can only suggest you set the required font for each form within Form1_Load, or try to identify the font shown when run on your work laptop and then check if that is present on the desktop and install it if missing.
-
May 7th, 2021, 01:06 PM
#12
Re: Font size changed after using LiveCharts.WinForms.GeoMap()
Here's an idea, handle the FontChanged event and have it output the current font. Then you can check if the outputted font is listed in your installed fonts.
-
May 10th, 2021, 09:41 AM
#13
Thread Starter
Lively Member
Re: Font size changed after using LiveCharts.WinForms.GeoMap()
Originally Posted by dday9
Here's an idea, handle the FontChanged event and have it output the current font. Then you can check if the outputted font is listed in your installed fonts.
Code:
Private Sub Form1_FontChanged(sender As Object, e As EventArgs) Handles Me.FontChanged
MsgBox("font changed")
End Sub
It doesn't fire at all.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|