diff --git a/ImGui.Forms/Controls/Button.cs b/ImGui.Forms/Controls/Button.cs index cca1859..074029d 100644 --- a/ImGui.Forms/Controls/Button.cs +++ b/ImGui.Forms/Controls/Button.cs @@ -90,9 +90,8 @@ private void ApplyStyles(bool enabled, FontResource font) private void RemoveStyles(bool enabled, FontResource font) { ImGuiNET.ImGui.PopStyleVar(); - - ImFontPtr? fontPtr = font?.GetPointer(); - if (fontPtr != null) + + if (Font?.GetPointer() != null) ImGuiNET.ImGui.PopFont(); if (!enabled) diff --git a/ImGui.Forms/Controls/Label.cs b/ImGui.Forms/Controls/Label.cs index 7145852..c2f972f 100644 --- a/ImGui.Forms/Controls/Label.cs +++ b/ImGui.Forms/Controls/Label.cs @@ -1,5 +1,4 @@ using System; -using System.Drawing; using System.Numerics; using ImGui.Forms.Controls.Base; using ImGui.Forms.Localization; @@ -83,8 +82,7 @@ protected override void ApplyStyles() protected override void RemoveStyles() { - ImFontPtr? fontPtr = Font?.GetPointer(); - if (fontPtr != null) + if (Font?.GetPointer() != null) ImGuiNET.ImGui.PopFont(); if (!TextColor.IsEmpty) diff --git a/ImGui.Forms/Controls/Menu/MenuBar.cs b/ImGui.Forms/Controls/Menu/MenuBar.cs index 25b14ff..e980fe1 100644 --- a/ImGui.Forms/Controls/Menu/MenuBar.cs +++ b/ImGui.Forms/Controls/Menu/MenuBar.cs @@ -2,7 +2,6 @@ using System.Linq; using ImGui.Forms.Resources; using ImGuiNET; -using static System.Net.Mime.MediaTypeNames; namespace ImGui.Forms.Controls.Menu { diff --git a/ImGui.Forms/Controls/ProgressBar.cs b/ImGui.Forms/Controls/ProgressBar.cs index a319b52..c419a9e 100644 --- a/ImGui.Forms/Controls/ProgressBar.cs +++ b/ImGui.Forms/Controls/ProgressBar.cs @@ -64,8 +64,7 @@ protected override void ApplyStyles() protected override void RemoveStyles() { - ImFontPtr? fontPtr = Font?.GetPointer(); - if (fontPtr != null) + if (Font?.GetPointer() != null) ImGuiNET.ImGui.PopFont(); } } diff --git a/ImGui.Forms/Controls/TextBox.cs b/ImGui.Forms/Controls/TextBox.cs index 379e456..951eefb 100644 --- a/ImGui.Forms/Controls/TextBox.cs +++ b/ImGui.Forms/Controls/TextBox.cs @@ -155,9 +155,8 @@ protected override void ApplyStyles() protected override void RemoveStyles() { ImGuiNET.ImGui.PopStyleVar(); - - ImFontPtr? fontPtr = Font?.GetPointer(); - if (fontPtr != null) + + if (Font?.GetPointer() != null) ImGuiNET.ImGui.PopFont(); } diff --git a/ImGui.Forms/ImGui.Forms.nuspec b/ImGui.Forms/ImGui.Forms.nuspec index 5579971..73aad12 100644 --- a/ImGui.Forms/ImGui.Forms.nuspec +++ b/ImGui.Forms/ImGui.Forms.nuspec @@ -2,7 +2,7 @@ Imgui.Forms - 1.1.7 + 1.1.8 A WinForms-inspired object-oriented framework around Dear ImGui (https://github.com/ocornut/imgui) onepiecefreak diff --git a/ImGui.Forms/Resources/ImageResource.cs b/ImGui.Forms/Resources/ImageResource.cs index c4bd587..397c6ed 100644 --- a/ImGui.Forms/Resources/ImageResource.cs +++ b/ImGui.Forms/Resources/ImageResource.cs @@ -52,6 +52,17 @@ public static ImageResource FromFile(string path) return FromImage(Image.Load(path)); } + /// + /// Creates a new from an embedded resource in . + /// + /// The name of the resource to load. + /// An representing the image. + /// To load built-in images, see . + public static ImageResource FromResource(string resourceName) + { + return FromResource(Assembly.GetCallingAssembly(), resourceName); + } + /// /// Creates a new from an embedded resource in . ///