c# - Global Project Static Variables -
i have 3 windows libraries drawing different types of bitmaps. 1 thing share in common the: font, colors, , pens.
i design library have standard fonts, colors, , pens if make font change changed globally across other libraries.
for example: i've got 3 libraries draw onto bitmaps , use these same settings:
internal static readonly font elevation_font = new font("segoe ui semibold", 7.9f), detail_box_font = new font(fontfamily.genericserif, 8f, fontstyle.regular);//"palatino linotype" internal static readonly color back_color_screen = color.black, line_color_screen = color.fromargb(161, 161, 161), back_color = color.white, line_color = color.black;
i create 1 library called mysoluctionnamedrawing , other libraries use these settings drawing onto bitmaps use ones mysoluctionnamedrawing.
this maintainability.
mysoluctionname name of solution, i'm sure point demo purposes.
anyone got ideas easiest , cleanest way have drawing related tools in 1 library , access them other libraries with-out making mess?
here i've come with.
drawing dll
namespace alumclouddrawing { public static class drawingoptions { public static readonly font elevation_font = new font("segoe ui semibold", 7.9f), detail_box_font = new font(fontfamily.genericserif, 8f, fontstyle.regular);//"palatino linotype" public static readonly color back_color_screen = color.black, line_color_screen = color.fromargb(161, 161, 161), back_color = color.white, line_color = color.black; } }
usage ref library depends on drawing dll library.
internal static readonly font elevation_font = alumclouddrawing.drawingoptions.elevation_font, detail_box_font = alumclouddrawing.drawingoptions.detail_box_font; internal static readonly color back_color_screen = alumclouddrawing.drawingoptions.back_color_screen, line_color_screen = alumclouddrawing.drawingoptions.line_color_screen, back_color = alumclouddrawing.drawingoptions.back_color, line_color = alumclouddrawing.drawingoptions.line_color;
i follow pattern
/src fooapp.sln -- solution file /apps -- folder apps /fooapp.core -- core project /fooapp.drawing1 -- project references core /fooapp.drawing2 -- project references core /tests -- tests /fooapp.core.test /fooapp.drawing1.test /fooapp.drawing2.test
Comments
Post a Comment