Index: Core/Components/src/Core.Components.DotSpatial.Forms/Core.Components.DotSpatial.Forms.csproj =================================================================== diff -u -r2b894d6833741b18aed72819933caaf48350cb2b -r6049b52f0552bb346a429c06d7395d19a36ef26a --- Core/Components/src/Core.Components.DotSpatial.Forms/Core.Components.DotSpatial.Forms.csproj (.../Core.Components.DotSpatial.Forms.csproj) (revision 2b894d6833741b18aed72819933caaf48350cb2b) +++ Core/Components/src/Core.Components.DotSpatial.Forms/Core.Components.DotSpatial.Forms.csproj (.../Core.Components.DotSpatial.Forms.csproj) (revision 6049b52f0552bb346a429c06d7395d19a36ef26a) @@ -1,6 +1,12 @@  + + + + + + Index: Core/Components/src/Core.Components.DotSpatial.Forms/MapControl.Designer.cs =================================================================== diff -u -r2d9c462dd373edd8cf907713df95ada4876d29d5 -r6049b52f0552bb346a429c06d7395d19a36ef26a --- Core/Components/src/Core.Components.DotSpatial.Forms/MapControl.Designer.cs (.../MapControl.Designer.cs) (revision 2d9c462dd373edd8cf907713df95ada4876d29d5) +++ Core/Components/src/Core.Components.DotSpatial.Forms/MapControl.Designer.cs (.../MapControl.Designer.cs) (revision 6049b52f0552bb346a429c06d7395d19a36ef26a) @@ -70,7 +70,6 @@ // panToolStripButton // this.panToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; - this.panToolStripButton.Font = new System.Drawing.Font("Deltares-Riskeer-Symbols", 12F); this.panToolStripButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 3); this.panToolStripButton.Name = "panToolStripButton"; this.panToolStripButton.Size = new System.Drawing.Size(39, 29); @@ -81,7 +80,6 @@ // zoomToRectangleToolStripButton // this.zoomToRectangleToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; - this.zoomToRectangleToolStripButton.Font = new System.Drawing.Font("Deltares-Riskeer-Symbols", 12F); this.zoomToRectangleToolStripButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 3); this.zoomToRectangleToolStripButton.Name = "zoomToRectangleToolStripButton"; this.zoomToRectangleToolStripButton.Size = new System.Drawing.Size(39, 29); @@ -97,7 +95,6 @@ // zoomToAllVisibleLayersToolStripButton // this.zoomToAllVisibleLayersToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; - this.zoomToAllVisibleLayersToolStripButton.Font = new System.Drawing.Font("Deltares-Riskeer-Symbols", 12F); this.zoomToAllVisibleLayersToolStripButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 3); this.zoomToAllVisibleLayersToolStripButton.Name = "zoomToAllVisibleLayersToolStripButton"; this.zoomToAllVisibleLayersToolStripButton.Size = new System.Drawing.Size(39, 29); @@ -113,7 +110,6 @@ // showCoordinatesToolStripButton // this.showCoordinatesToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; - this.showCoordinatesToolStripButton.Font = new System.Drawing.Font("Deltares-Riskeer-Symbols", 12F); this.showCoordinatesToolStripButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 3); this.showCoordinatesToolStripButton.Name = "showCoordinatesToolStripButton"; this.showCoordinatesToolStripButton.Size = new System.Drawing.Size(39, 29); Index: Core/Components/src/Core.Components.DotSpatial.Forms/MapControl.cs =================================================================== diff -u -r3732fd8049fe829894945e2b7bd74143454b8218 -r6049b52f0552bb346a429c06d7395d19a36ef26a --- Core/Components/src/Core.Components.DotSpatial.Forms/MapControl.cs (.../MapControl.cs) (revision 3732fd8049fe829894945e2b7bd74143454b8218) +++ Core/Components/src/Core.Components.DotSpatial.Forms/MapControl.cs (.../MapControl.cs) (revision 6049b52f0552bb346a429c06d7395d19a36ef26a) @@ -21,7 +21,10 @@ using System; using System.Collections.Generic; +using System.Drawing; +using System.Drawing.Text; using System.Linq; +using System.Runtime.InteropServices; using System.Windows.Forms; using Core.Common.Base; using Core.Components.DotSpatial.Forms.Properties; @@ -53,6 +56,7 @@ private readonly List drawnMapDataList = new List(); private readonly MapControlBackgroundLayerStatus backgroundLayerStatus = new MapControlBackgroundLayerStatus(); private readonly List mapDataLayersToUpdate = new List(); + private readonly PrivateFontCollection fonts = new PrivateFontCollection(); private Map map; private bool removing; @@ -61,6 +65,7 @@ private MapDataCollection data; private ImageBasedMapData backgroundMapData; private Timer updateTimer; + private Font myFont; /// /// Creates a new instance of . @@ -69,6 +74,8 @@ { InitializeComponent(); + InitializeFont(); + InitializeMap(); panToolStripButton.PerformClick(); @@ -173,6 +180,29 @@ } } + [DllImport("gdi32.dll")] + private static extern IntPtr AddFontMemResourceEx(IntPtr pbFont, uint cbFont, + IntPtr pdv, [In] ref uint pcFonts); + + private void InitializeFont() + { + byte[] fontData = Resources.Deltares_Riskeer_Symbols; + IntPtr fontPtr = Marshal.AllocCoTaskMem(fontData.Length); + Marshal.Copy(fontData, 0, fontPtr, fontData.Length); + + uint dummy = 0; + fonts.AddMemoryFont(fontPtr, Resources.Deltares_Riskeer_Symbols.Length); + AddFontMemResourceEx(fontPtr, (uint) Resources.Deltares_Riskeer_Symbols.Length, IntPtr.Zero, ref dummy); + Marshal.FreeCoTaskMem(fontPtr); + + myFont = new Font(fonts.Families[0], 14.0F); + + panToolStripButton.Font = myFont; + zoomToRectangleToolStripButton.Font = myFont; + zoomToAllVisibleLayersToolStripButton.Font = myFont; + showCoordinatesToolStripButton.Font = myFont; + } + private void InitializeMap() { map = new DotSpatialMap @@ -493,16 +523,15 @@ /// not part of the drawn map features. private Envelope CreateEnvelopeForAllVisibleLayers(MapData mapData) { - var collection = mapData as MapDataCollection; - if (collection != null) + if (mapData is MapDataCollection collection) { return CreateEnvelopeForAllVisibleLayers(collection); } DrawnMapData drawnMapData = drawnMapDataList.FirstOrDefault(dmd => dmd.FeatureBasedMapData.Equals(mapData)); if (drawnMapData == null) { - throw new ArgumentException($@"Can only zoom to {typeof(MapData).Name} that is part of this {typeof(MapControl).Name}s drawn {nameof(mapData)}.", + throw new ArgumentException($@"Can only zoom to {nameof(MapData)} that is part of this {nameof(MapControl)}s drawn {nameof(mapData)}.", nameof(mapData)); } Index: Core/Components/src/Core.Components.DotSpatial.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r2d9c462dd373edd8cf907713df95ada4876d29d5 -r6049b52f0552bb346a429c06d7395d19a36ef26a --- Core/Components/src/Core.Components.DotSpatial.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 2d9c462dd373edd8cf907713df95ada4876d29d5) +++ Core/Components/src/Core.Components.DotSpatial.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 6049b52f0552bb346a429c06d7395d19a36ef26a) @@ -82,6 +82,16 @@ } /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] Deltares_Riskeer_Symbols { + get { + object obj = ResourceManager.GetObject("Deltares_Riskeer_Symbols", resourceCulture); + return ((byte[])(obj)); + } + } + + /// /// Looks up a localized string similar to {0} De achtergrondkaart kan nu niet getoond worden.. /// internal static string MapControl_HandleBruTileInitializationException_Message_0_therefore_cannot_show_background_layer { Index: Core/Components/src/Core.Components.DotSpatial.Forms/Properties/Resources.resx =================================================================== diff -u -r2d9c462dd373edd8cf907713df95ada4876d29d5 -r6049b52f0552bb346a429c06d7395d19a36ef26a --- Core/Components/src/Core.Components.DotSpatial.Forms/Properties/Resources.resx (.../Resources.resx) (revision 2d9c462dd373edd8cf907713df95ada4876d29d5) +++ Core/Components/src/Core.Components.DotSpatial.Forms/Properties/Resources.resx (.../Resources.resx) (revision 6049b52f0552bb346a429c06d7395d19a36ef26a) @@ -117,6 +117,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\Deltares-Riskeer-Symbols.ttf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + {0} De achtergrondkaart kan nu niet getoond worden. Index: Core/Components/src/Core.Components.DotSpatial.Forms/Resources/Deltares-Riskeer-Symbols.ttf =================================================================== diff -u Binary files differ