leocb / MaterialSkin

Theming .NET WinForms, C# or VB.Net, to Google's Material Design Principles.
MIT License
450 stars 132 forks source link

Menu Drawer Icon Issue #347

Closed KristanSmout closed 2 years ago

KristanSmout commented 2 years ago

When attempting to use icons using the latest version of MaterialSkin2 on the drawer menu the process will crash when attempting to draw the icons. This happens regardless of the resolution of the image. This occurs on a form just with material skin and the drawer.

If it does help the icons I am attempting to use are from here https://fonts.google.com/icons?selected=Material+Icons+Round:remove

" at MaterialSkin.Controls.MaterialDrawer.preProcessIcons()\r\n at MaterialSkin.Controls.MaterialDrawer.set_BaseTabControl(MaterialTabControl value)\r\n at MaterialSkin.Controls.MaterialForm.AddDrawerOverlayForm()\r\n at MaterialSkin.Controls.MaterialForm.<.ctor>b__112_1(Object sender, EventArgs e)\r\n at System.Windows.Forms.Form.OnShown(EventArgs e)\r\n at System.Windows.Forms.Form.CallShownEvent()\r\n at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)\r\n at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)\r\n at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\r\n at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\r\n at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)\r\n at System.Windows.Forms.Control.InvokeMarshaledCallbacks()\r\n at System.Windows.Forms.Control.WndProc(Message& m)\r\n at System.Windows.Forms.ScrollableControl.WndProc(Message& m)\r\n at System.Windows.Forms.Form.WndProc(Message& m)\r\n at MaterialSkin.Controls.MaterialForm.WndProc(Message& m)\r\n at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)\r\n at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)\r\n at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)\r\n at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)\r\n at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)\r\n at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)\r\n at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)\r\n at System.Windows.Forms.Application.Run(Form mainForm)\r\n at {redacted}.Program.Main() in C:\{redacted}\{redacted}\{redacted}\Program.cs:line 19"

Here is an image of the tab control itself image

Here is the settings for the image list if that helps also image

KristanSmout commented 2 years ago

Additionally, if attempting to use the same key image for multiple items you will get the following

'An item with the same key has already been added.'

KristanSmout commented 2 years ago

Investigating this further, it would appear that this crashing may not be caused by the library, following through it line by line it would appear that the image is failing to get passed along. When viewing the files in file explorer the preview is empty indicating they may actually be corrupted. Replacing these images has resolved the issue.