jjzjj

GraphicsPalette

全部标签

c# - 在 winforms 应用程序中缓存 GDI+ 对象 : is it worth it and how to do it right?

对于我的一些winforms应用程序,我需要创建一大堆GDI+对象(画笔、笔、字体等)并一遍又一遍地使用它们。我创建了一个ghetto缓存单例来完成我需要的,但是代码味道太重了......publicsealedclassGraphicsPalette{publicstaticreadonlyGraphicsPaletteInstance=newGraphicsPalette();staticGraphicsPalette(){}privateDictionarysolidBrushes;//multithreadingprivateobjectbrushLock;privateGra