Results 1 to 13 of 13

Thread: Font size changed after using LiveCharts.WinForms.GeoMap()

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2021
    Posts
    71

    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

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    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.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Apr 2021
    Posts
    71

    Re: Font size changed after using LiveCharts.WinForms.GeoMap()

    That's what I tought but when I gray out this line it still happens.

  4. #4
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    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?
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Apr 2021
    Posts
    71

    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.

  6. #6
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    Re: Font size changed after using LiveCharts.WinForms.GeoMap()

    Are you able to dig into the source code or is it protected?
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Apr 2021
    Posts
    71

    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.

  8. #8
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    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.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  9. #9
    Addicted Member
    Join Date
    Jul 2017
    Location
    Exeter, UK
    Posts
    180

    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.

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Apr 2021
    Posts
    71

    Re: Font size changed after using LiveCharts.WinForms.GeoMap()

    So is there a way to identify this action at runtime?

  11. #11
    Addicted Member
    Join Date
    Jul 2017
    Location
    Exeter, UK
    Posts
    180

    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.

  12. #12
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    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.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  13. #13

    Thread Starter
    Lively Member
    Join Date
    Apr 2021
    Posts
    71

    Re: Font size changed after using LiveCharts.WinForms.GeoMap()

    Quote Originally Posted by dday9 View Post
    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
  •  



Click Here to Expand Forum to Full Width