/EasyImGui

Use ImGui with Winforms / .NET Framework.

Primary LanguageC#MIT LicenseMIT

EasyImGui


Use ImGui with Winforms / .NET Framework.
💠 Please leave a Star to the repository ✅ if you liked it. ✨

  • Install via NuGet Package :
    dotnet add package EasyImGui --version 1.0.4.1
    

Example Projects

Sample Description
BF4 External Battlefield 4 Simple External Cheat. It works Offline (Campaign) and Online.
EasyColorPicker A color picker made with EasyImGui
EasyImGui.Samples Examples in C# and VB

Features

EasyImGui allows you to Create your GUI with ImGui, without having to configure anything, you don't need any additional knowledge.

You just need to install EasyImGui from NuGet and that's it! .

Note:

EasyImGui uses DearImGuiSharp, so any question related to ImGui should be asked in its official Reposttory: https://github.com/Sewer56/DearImguiSharp

If within your ImGui code you launch controls that block the Main UI, such as OpenFileDialog or MessageBox.Show, it will cause your application to fail, this is easy to solve, Simply do everything Asynchronously, Without Dialogs ".ShowDialog()"

Example

DX9 Overlay + Imgui Window.

  Overlay OverlayWindow = new Overlay() { EnableDrag = true, ResizableBorders = true,  Fix_WM_NCLBUTTONDBLCLK = true };

 //SingleImguiWindow.ImGuiWindowFlagsEx = DearImguiSharp.ImGuiWindowFlags.NoTitleBar;
 OverlayWindow.OnImGuiReady += (object sender, bool Status) =>
 {

     if (Status)
     {
         OverlayWindow.Imgui.ConfigContex += delegate {

             //DearImguiSharp.ImGui.StyleColorsLight(null);

             var style = ImGui.GetStyle();

             ImVec4[] styleColors = style.Colors;
             styleColors[(int)ImGuiCol.CheckMark].W = 1.0f;
             styleColors[(int)ImGuiCol.CheckMark].X = 1.0f;
             styleColors[(int)ImGuiCol.CheckMark].Y = 1.0f;
             styleColors[(int)ImGuiCol.CheckMark].Z = 1.0f;

             styleColors[(int)ImGuiCol.FrameBg].W = 0.0f;
             styleColors[(int)ImGuiCol.FrameBg].X = 0.0f;
             styleColors[(int)ImGuiCol.FrameBg].Y = 0.0f;
             styleColors[(int)ImGuiCol.FrameBg].Z = 0.0f;

             style.WindowRounding = 5.0f;
             style.FrameRounding = 5.0f;
             style.FrameBorderSize = 1.0f;



             //OverlayWindow.Imgui.IO.ConfigFlags |= (int)ImGuiConfigFlags.ViewportsEnable;

             return true;
         };


         bool DrawImguiMenu = true;

         SharpDX.Direct3D9.Device device = OverlayWindow.D3DDevice;

         OverlayWindow.Imgui.Render += delegate {


             if (DrawImguiMenu == false) { OverlayWindow.Close();  return true; }

             if (OverlayWindow.Imgui.Imgui_Ini == true && OverlayWindow.Imgui.IO != null)
             {

                 // Overlay Dragger
                 bool IsFocusOnMainImguiWindow = (Form.ActiveForm == OverlayWindow); // Old : DearImguiSharp.ImGui.IsWindowFocused((int)DearImguiSharp.ImGuiFocusedFlags.RootWindow);
                 if (IsFocusOnMainImguiWindow == true) { InputHook.Universal(OverlayWindow.Imgui.IO); }
                 OverlayWindow.EnableDrag = (DearImguiSharp.ImGui.IsAnyItemActive() == true) ? false : IsFocusOnMainImguiWindow;

                 DearImguiSharp.ImGui.SetNextWindowPos(new ImVec2 { X = 0, Y = 0 }, 0, new ImVec2 { X = 0, Y = 0 });
                 DearImguiSharp.ImGui.SetNextWindowSize(new ImVec2() { X = OverlayWindow.ClientSize.Width , Y = OverlayWindow.ClientSize.Height  }, 0);

                 DearImguiSharp.ImGui.Begin(OverlayWindow.Text, ref DrawImguiMenu, 0); // (int)ImGuiWindowFlags.NoResize | (int)ImGuiWindowFlags.NoMove | (int)ImGuiWindowFlags.NoCollapse | (int)ImGuiWindowFlags.NoBringToFrontOnFocus

                 if (DearImguiSharp.ImGui.Button("Message", new DearImguiSharp.ImVec2() { X = OverlayWindow.ClientSize.Width - 15, Y = 20 }))
                 {
                     Task.Run(() =>
                     {
                         MessageBox.Show("Hello World!");
                     });
                 }

                 if (DearImguiSharp.ImGui.Button("Exit", new DearImguiSharp.ImVec2() { X = OverlayWindow.ClientSize.Width - 15, Y = 20 }))
                     OverlayWindow.Close();

             }

             return true;
         };

     }
 };

 try { Application.Run(OverlayWindow); } catch { Environment.Exit(0); }
          

-----------------------------------------------------

Preview

Captura de pantalla 2024-01-16 194047

Captura de pantalla 2024-01-16 194153

image

Credits

Sewer56 : For DearImguiSharp library.

Veldrid Discord Server : Thanks to the community for the help, especially to zaafar and his ClickableTransparentOverlay project .

License

MIT License

Copyright (c) 2019-2023 DestroyerDarkNess

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.