* 重构字体图标类
+ 增加MaterialIcons字体图标
This commit is contained in:
parent
1902dc2e50
commit
9a6579befe
BIN
SunnyUI/Font/MaterialIcons-Regular.ttf
Normal file
BIN
SunnyUI/Font/MaterialIcons-Regular.ttf
Normal file
Binary file not shown.
@ -881,374 +881,5 @@ namespace Sunny.UI
|
||||
public const int fa_youtube_play = 0xf16a;
|
||||
public const int fa_youtube_square = 0xf166;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ElegantIcons.ttf V1.0
|
||||
/// 33..126, 57344..57609
|
||||
/// </summary>
|
||||
public static class FontElegantIcons
|
||||
{
|
||||
public const int arrow_up = 0x21;
|
||||
public const int arrow_down = 0x22;
|
||||
public const int arrow_left = 0x23;
|
||||
public const int arrow_right = 0x24;
|
||||
public const int arrow_left_up = 0x25;
|
||||
public const int arrow_right_up = 0x26;
|
||||
public const int arrow_right_down = 0x27;
|
||||
public const int arrow_left_down = 0x28;
|
||||
public const int arrow_up_down = 0x29;
|
||||
public const int arrow_up_down_alt = 0x2a;
|
||||
public const int arrow_left_right_alt = 0x2b;
|
||||
public const int arrow_left_right = 0x2c;
|
||||
public const int arrow_expand_alt2 = 0x2d;
|
||||
public const int arrow_expand_alt = 0x2e;
|
||||
public const int arrow_condense = 0x2f;
|
||||
public const int arrow_expand = 0x30;
|
||||
public const int arrow_move = 0x31;
|
||||
public const int arrow_carrot_up = 0x32;
|
||||
public const int arrow_carrot_down = 0x33;
|
||||
public const int arrow_carrot_left = 0x34;
|
||||
public const int arrow_carrot_right = 0x35;
|
||||
public const int arrow_carrot_2up = 0x36;
|
||||
public const int arrow_carrot_2down = 0x37;
|
||||
public const int arrow_carrot_2left = 0x38;
|
||||
public const int arrow_carrot_2right = 0x39;
|
||||
public const int arrow_carrot_up_alt2 = 0x3a;
|
||||
public const int arrow_carrot_down_alt2 = 0x3b;
|
||||
public const int arrow_carrot_left_alt2 = 0x3c;
|
||||
public const int arrow_carrot_right_alt2 = 0x3d;
|
||||
public const int arrow_carrot_2up_alt2 = 0x3e;
|
||||
public const int arrow_carrot_2down_alt2 = 0x3f;
|
||||
public const int arrow_carrot_2left_alt2 = 0x40;
|
||||
public const int arrow_carrot_2right_alt2 = 0x41;
|
||||
public const int arrow_triangle_up = 0x42;
|
||||
public const int arrow_triangle_down = 0x43;
|
||||
public const int arrow_triangle_left = 0x44;
|
||||
public const int arrow_triangle_right = 0x45;
|
||||
public const int arrow_triangle_up_alt2 = 0x46;
|
||||
public const int arrow_triangle_down_alt2 = 0x47;
|
||||
public const int arrow_triangle_left_alt2 = 0x48;
|
||||
public const int arrow_triangle_right_alt2 = 0x49;
|
||||
public const int arrow_back = 0x4a;
|
||||
public const int icon_minus_06 = 0x4b;
|
||||
public const int icon_plus = 0x4c;
|
||||
public const int icon_close = 0x4d;
|
||||
public const int icon_check = 0x4e;
|
||||
public const int icon_minus_alt2 = 0x4f;
|
||||
public const int icon_plus_alt2 = 0x50;
|
||||
public const int icon_close_alt2 = 0x51;
|
||||
public const int icon_check_alt2 = 0x52;
|
||||
public const int icon_zoom_out_alt = 0x53;
|
||||
public const int icon_zoom_in_alt = 0x54;
|
||||
public const int icon_search = 0x55;
|
||||
public const int icon_box_empty = 0x56;
|
||||
public const int icon_box_selected = 0x57;
|
||||
public const int icon_minus_box = 0x58;
|
||||
public const int icon_plus_box = 0x59;
|
||||
public const int icon_box_checked = 0x5a;
|
||||
public const int icon_circle_empty = 0x5b;
|
||||
public const int icon_circle_slelected = 0x5c;
|
||||
public const int icon_stop_alt2 = 0x5d;
|
||||
public const int icon_stop = 0x5e;
|
||||
public const int icon_pause_alt2 = 0x5f;
|
||||
public const int icon_pause = 0x60;
|
||||
public const int icon_menu = 0x61;
|
||||
public const int icon_menu_square_alt2 = 0x62;
|
||||
public const int icon_menu_circle_alt2 = 0x63;
|
||||
public const int icon_ul = 0x64;
|
||||
public const int icon_ol = 0x65;
|
||||
public const int icon_adjust_horiz = 0x66;
|
||||
public const int icon_adjust_vert = 0x67;
|
||||
public const int icon_document_alt = 0x68;
|
||||
public const int icon_documents_alt = 0x69;
|
||||
public const int icon_pencil = 0x6a;
|
||||
public const int icon_pencil_edit_alt = 0x6b;
|
||||
public const int icon_pencil_edit = 0x6c;
|
||||
public const int icon_folder_alt = 0x6d;
|
||||
public const int icon_folder_open_alt = 0x6e;
|
||||
public const int icon_folder_add_alt = 0x6f;
|
||||
public const int icon_info_alt = 0x70;
|
||||
public const int icon_error_oct_alt = 0x71;
|
||||
public const int icon_error_circle_alt = 0x72;
|
||||
public const int icon_error_triangle_alt = 0x73;
|
||||
public const int icon_question_alt2 = 0x74;
|
||||
public const int icon_question = 0x75;
|
||||
public const int icon_comment_alt = 0x76;
|
||||
public const int icon_chat_alt = 0x77;
|
||||
public const int icon_vol_mute_alt = 0x78;
|
||||
public const int icon_volume_low_alt = 0x79;
|
||||
public const int icon_volume_high_alt = 0x7a;
|
||||
public const int icon_quotations = 0x7b;
|
||||
public const int icon_quotations_alt2 = 0x7c;
|
||||
public const int icon_clock_alt = 0x7d;
|
||||
public const int icon_lock_alt = 0x7e;
|
||||
public const int icon_lock_open_alt = 0xe000;
|
||||
public const int icon_key_alt = 0xe001;
|
||||
public const int icon_cloud_alt = 0xe002;
|
||||
public const int icon_cloud_upload_alt = 0xe003;
|
||||
public const int icon_cloud_download_alt = 0xe004;
|
||||
public const int icon_image = 0xe005;
|
||||
public const int icon_images = 0xe006;
|
||||
public const int icon_lightbulb_alt = 0xe007;
|
||||
public const int icon_gift_alt = 0xe008;
|
||||
public const int icon_house_alt = 0xe009;
|
||||
public const int icon_genius = 0xe00a;
|
||||
public const int icon_mobile = 0xe00b;
|
||||
public const int icon_tablet = 0xe00c;
|
||||
public const int icon_laptop = 0xe00d;
|
||||
public const int icon_desktop = 0xe00e;
|
||||
public const int icon_camera_alt = 0xe00f;
|
||||
public const int icon_mail_alt = 0xe010;
|
||||
public const int icon_cone_alt = 0xe011;
|
||||
public const int icon_ribbon_alt = 0xe012;
|
||||
public const int icon_bag_alt = 0xe013;
|
||||
public const int icon_creditcard = 0xe014;
|
||||
public const int icon_cart_alt = 0xe015;
|
||||
public const int icon_paperclip = 0xe016;
|
||||
public const int icon_tag_alt = 0xe017;
|
||||
public const int icon_tags_alt = 0xe018;
|
||||
public const int icon_trash_alt = 0xe019;
|
||||
public const int icon_cursor_alt = 0xe01a;
|
||||
public const int icon_mic_alt = 0xe01b;
|
||||
public const int icon_compass_alt = 0xe01c;
|
||||
public const int icon_pin_alt = 0xe01d;
|
||||
public const int icon_pushpin_alt = 0xe01e;
|
||||
public const int icon_map_alt = 0xe01f;
|
||||
public const int icon_drawer_alt = 0xe020;
|
||||
public const int icon_toolbox_alt = 0xe021;
|
||||
public const int icon_book_alt = 0xe022;
|
||||
public const int icon_calendar = 0xe023;
|
||||
public const int icon_film = 0xe024;
|
||||
public const int icon_table = 0xe025;
|
||||
public const int icon_contacts_alt = 0xe026;
|
||||
public const int icon_headphones = 0xe027;
|
||||
public const int icon_lifesaver = 0xe028;
|
||||
public const int icon_piechart = 0xe029;
|
||||
public const int icon_refresh = 0xe02a;
|
||||
public const int icon_link_alt = 0xe02b;
|
||||
public const int icon_link = 0xe02c;
|
||||
public const int icon_loading = 0xe02d;
|
||||
public const int icon_blocked = 0xe02e;
|
||||
public const int icon_archive_alt = 0xe02f;
|
||||
public const int icon_heart_alt = 0xe030;
|
||||
public const int icon_star_alt = 0xe031;
|
||||
public const int icon_star_half_alt = 0xe032;
|
||||
public const int icon_star = 0xe033;
|
||||
public const int icon_star_half = 0xe034;
|
||||
public const int icon_tools = 0xe035;
|
||||
public const int icon_tool = 0xe036;
|
||||
public const int icon_cog = 0xe037;
|
||||
public const int icon_cogs = 0xe038;
|
||||
public const int arrow_up_alt = 0xe039;
|
||||
public const int arrow_down_alt = 0xe03a;
|
||||
public const int arrow_left_alt = 0xe03b;
|
||||
public const int arrow_right_alt = 0xe03c;
|
||||
public const int arrow_left_up_alt = 0xe03d;
|
||||
public const int arrow_right_up_alt = 0xe03e;
|
||||
public const int arrow_right_down_alt = 0xe03f;
|
||||
public const int arrow_left_down_alt = 0xe040;
|
||||
public const int arrow_condense_alt = 0xe041;
|
||||
public const int arrow_expand_alt3 = 0xe042;
|
||||
public const int arrow_carrot_up_alt = 0xe043;
|
||||
public const int arrow_carrot_down_alt = 0xe044;
|
||||
public const int arrow_carrot_left_alt = 0xe045;
|
||||
public const int arrow_carrot_right_alt = 0xe046;
|
||||
public const int arrow_carrot_2up_alt = 0xe047;
|
||||
public const int arrow_carrot_2dwnn_alt = 0xe048;
|
||||
public const int arrow_carrot_2left_alt = 0xe049;
|
||||
public const int arrow_carrot_2right_alt = 0xe04a;
|
||||
public const int arrow_triangle_up_alt = 0xe04b;
|
||||
public const int arrow_triangle_down_alt = 0xe04c;
|
||||
public const int arrow_triangle_left_alt = 0xe04d;
|
||||
public const int arrow_triangle_right_alt = 0xe04e;
|
||||
public const int icon_minus_alt = 0xe04f;
|
||||
public const int icon_plus_alt = 0xe050;
|
||||
public const int icon_close_alt = 0xe051;
|
||||
public const int icon_check_alt = 0xe052;
|
||||
public const int icon_zoom_out = 0xe053;
|
||||
public const int icon_zoom_in = 0xe054;
|
||||
public const int icon_stop_alt = 0xe055;
|
||||
public const int icon_menu_square_alt = 0xe056;
|
||||
public const int icon_menu_circle_alt = 0xe057;
|
||||
public const int icon_document = 0xe058;
|
||||
public const int icon_documents = 0xe059;
|
||||
public const int icon_pencil_alt = 0xe05a;
|
||||
public const int icon_folder = 0xe05b;
|
||||
public const int icon_folder_open = 0xe05c;
|
||||
public const int icon_folder_add = 0xe05d;
|
||||
public const int icon_folder_upload = 0xe05e;
|
||||
public const int icon_folder_download = 0xe05f;
|
||||
public const int icon_info = 0xe060;
|
||||
public const int icon_error_circle = 0xe061;
|
||||
public const int icon_error_oct = 0xe062;
|
||||
public const int icon_error_triangle = 0xe063;
|
||||
public const int icon_question_alt = 0xe064;
|
||||
public const int icon_comment = 0xe065;
|
||||
public const int icon_chat = 0xe066;
|
||||
public const int icon_vol_mute = 0xe067;
|
||||
public const int icon_volume_low = 0xe068;
|
||||
public const int icon_volume_high = 0xe069;
|
||||
public const int icon_quotations_alt = 0xe06a;
|
||||
public const int icon_clock = 0xe06b;
|
||||
public const int icon_lock = 0xe06c;
|
||||
public const int icon_lock_open = 0xe06d;
|
||||
public const int icon_key = 0xe06e;
|
||||
public const int icon_cloud = 0xe06f;
|
||||
public const int icon_cloud_upload = 0xe070;
|
||||
public const int icon_cloud_download = 0xe071;
|
||||
public const int icon_lightbulb = 0xe072;
|
||||
public const int icon_gift = 0xe073;
|
||||
public const int icon_house = 0xe074;
|
||||
public const int icon_camera = 0xe075;
|
||||
public const int icon_mail = 0xe076;
|
||||
public const int icon_cone = 0xe077;
|
||||
public const int icon_ribbon = 0xe078;
|
||||
public const int icon_bag = 0xe079;
|
||||
public const int icon_cart = 0xe07a;
|
||||
public const int icon_tag = 0xe07b;
|
||||
public const int icon_tags = 0xe07c;
|
||||
public const int icon_trash = 0xe07d;
|
||||
public const int icon_cursor = 0xe07e;
|
||||
public const int icon_mic = 0xe07f;
|
||||
public const int icon_compass = 0xe080;
|
||||
public const int icon_pin = 0xe081;
|
||||
public const int icon_pushpin = 0xe082;
|
||||
public const int icon_map = 0xe083;
|
||||
public const int icon_drawer = 0xe084;
|
||||
public const int icon_toolbox = 0xe085;
|
||||
public const int icon_book = 0xe086;
|
||||
public const int icon_contacts = 0xe087;
|
||||
public const int icon_archive = 0xe088;
|
||||
public const int icon_heart = 0xe089;
|
||||
public const int icon_profile = 0xe08a;
|
||||
public const int icon_group = 0xe08b;
|
||||
public const int icon_grid_2x2 = 0xe08c;
|
||||
public const int icon_grid_3x3 = 0xe08d;
|
||||
public const int icon_music = 0xe08e;
|
||||
public const int icon_pause_alt = 0xe08f;
|
||||
public const int icon_phone = 0xe090;
|
||||
public const int icon_upload = 0xe091;
|
||||
public const int icon_download = 0xe092;
|
||||
public const int social_facebook = 0xe093;
|
||||
public const int social_twitter = 0xe094;
|
||||
public const int social_pinterest = 0xe095;
|
||||
public const int social_googleplus = 0xe096;
|
||||
public const int social_tumblr = 0xe097;
|
||||
public const int social_tumbleupon = 0xe098;
|
||||
public const int social_wordpress = 0xe099;
|
||||
public const int social_instagram = 0xe09a;
|
||||
public const int social_dribbble = 0xe09b;
|
||||
public const int social_vimeo = 0xe09c;
|
||||
public const int social_linkedin = 0xe09d;
|
||||
public const int social_rss = 0xe09e;
|
||||
public const int social_deviantart = 0xe09f;
|
||||
public const int social_share = 0xe0a0;
|
||||
public const int social_myspace = 0xe0a1;
|
||||
public const int social_skype = 0xe0a2;
|
||||
public const int social_youtube = 0xe0a3;
|
||||
public const int social_picassa = 0xe0a4;
|
||||
public const int social_googledrive = 0xe0a5;
|
||||
public const int social_flickr = 0xe0a6;
|
||||
public const int social_blogger = 0xe0a7;
|
||||
public const int social_spotify = 0xe0a8;
|
||||
public const int social_delicious = 0xe0a9;
|
||||
public const int social_facebook_circle = 0xe0aa;
|
||||
public const int social_twitter_circle = 0xe0ab;
|
||||
public const int social_pinterest_circle = 0xe0ac;
|
||||
public const int social_googleplus_circle = 0xe0ad;
|
||||
public const int social_tumblr_circle = 0xe0ae;
|
||||
public const int social_stumbleupon_circle = 0xe0af;
|
||||
public const int social_wordpress_circle = 0xe0b0;
|
||||
public const int social_instagram_circle = 0xe0b1;
|
||||
public const int social_dribbble_circle = 0xe0b2;
|
||||
public const int social_vimeo_circle = 0xe0b3;
|
||||
public const int social_linkedin_circle = 0xe0b4;
|
||||
public const int social_rss_circle = 0xe0b5;
|
||||
public const int social_deviantart_circle = 0xe0b6;
|
||||
public const int social_share_circle = 0xe0b7;
|
||||
public const int social_myspace_circle = 0xe0b8;
|
||||
public const int social_skype_circle = 0xe0b9;
|
||||
public const int social_youtube_circle = 0xe0ba;
|
||||
public const int social_picassa_circle = 0xe0bb;
|
||||
public const int social_googledrive_alt2 = 0xe0bc;
|
||||
public const int social_flickr_circle = 0xe0bd;
|
||||
public const int social_blogger_circle = 0xe0be;
|
||||
public const int social_spotify_circle = 0xe0bf;
|
||||
public const int social_delicious_circle = 0xe0c0;
|
||||
public const int social_facebook_square = 0xe0c1;
|
||||
public const int social_twitter_square = 0xe0c2;
|
||||
public const int social_pinterest_square = 0xe0c3;
|
||||
public const int social_googleplus_square = 0xe0c4;
|
||||
public const int social_tumblr_square = 0xe0c5;
|
||||
public const int social_stumbleupon_square = 0xe0c6;
|
||||
public const int social_wordpress_square = 0xe0c7;
|
||||
public const int social_instagram_square = 0xe0c8;
|
||||
public const int social_dribbble_square = 0xe0c9;
|
||||
public const int social_vimeo_square = 0xe0ca;
|
||||
public const int social_linkedin_square = 0xe0cb;
|
||||
public const int social_rss_square = 0xe0cc;
|
||||
public const int social_deviantart_square = 0xe0cd;
|
||||
public const int social_share_square = 0xe0ce;
|
||||
public const int social_myspace_square = 0xe0cf;
|
||||
public const int social_skype_square = 0xe0d0;
|
||||
public const int social_youtube_square = 0xe0d1;
|
||||
public const int social_picassa_square = 0xe0d2;
|
||||
public const int social_googledrive_square = 0xe0d3;
|
||||
public const int social_flickr_square = 0xe0d4;
|
||||
public const int social_blogger_square = 0xe0d5;
|
||||
public const int social_spotify_square = 0xe0d6;
|
||||
public const int social_delicious_square = 0xe0d7;
|
||||
public const int icon_printer = 0xe103;
|
||||
public const int icon_calulator = 0xe0ee;
|
||||
public const int icon_building = 0xe0ef;
|
||||
public const int icon_floppy = 0xe0e8;
|
||||
public const int icon_drive = 0xe0ea;
|
||||
public const int icon_search_2 = 0xe101;
|
||||
public const int icon_id = 0xe107;
|
||||
public const int icon_id_2 = 0xe108;
|
||||
public const int icon_puzzle = 0xe102;
|
||||
public const int icon_like = 0xe106;
|
||||
public const int icon_dislike = 0xe0eb;
|
||||
public const int icon_mug = 0xe105;
|
||||
public const int icon_currency = 0xe0ed;
|
||||
public const int icon_wallet = 0xe100;
|
||||
public const int icon_pens = 0xe104;
|
||||
public const int icon_easel = 0xe0e9;
|
||||
public const int icon_flowchart = 0xe109;
|
||||
public const int icon_datareport = 0xe0ec;
|
||||
public const int icon_briefcase = 0xe0fe;
|
||||
public const int icon_shield = 0xe0f6;
|
||||
public const int icon_percent = 0xe0fb;
|
||||
public const int icon_globe = 0xe0e2;
|
||||
public const int icon_globe_2 = 0xe0e3;
|
||||
public const int icon_target = 0xe0f5;
|
||||
public const int icon_hourglass = 0xe0e1;
|
||||
public const int icon_balance = 0xe0ff;
|
||||
public const int icon_rook = 0xe0f8;
|
||||
public const int icon_printer_alt = 0xe0fa;
|
||||
public const int icon_calculator_alt = 0xe0e7;
|
||||
public const int icon_building_alt = 0xe0fd;
|
||||
public const int icon_floppy_alt = 0xe0e4;
|
||||
public const int icon_drive_alt = 0xe0e5;
|
||||
public const int icon_search_alt = 0xe0f7;
|
||||
public const int icon_id_alt = 0xe0e0;
|
||||
public const int icon_id_2_alt = 0xe0fc;
|
||||
public const int icon_puzzle_alt = 0xe0f9;
|
||||
public const int icon_like_alt = 0xe0dd;
|
||||
public const int icon_dislike_alt = 0xe0f1;
|
||||
public const int icon_mug_alt = 0xe0dc;
|
||||
public const int icon_currency_alt = 0xe0f3;
|
||||
public const int icon_wallet_alt = 0xe0d8;
|
||||
public const int icon_pens_alt = 0xe0db;
|
||||
public const int icon_easel_alt = 0xe0f0;
|
||||
public const int icon_flowchart_alt = 0xe0df;
|
||||
public const int icon_datareport_alt = 0xe0f2;
|
||||
public const int icon_briefcase_alt = 0xe0f4;
|
||||
public const int icon_shield_alt = 0xe0d9;
|
||||
public const int icon_percent_alt = 0xe0da;
|
||||
public const int icon_globe_alt = 0xe0de;
|
||||
public const int icon_clipboard = 0xe0e6;
|
||||
}
|
||||
|
||||
#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释
|
||||
}
|
File diff suppressed because it is too large
Load Diff
370
SunnyUI/Font/UFontElegantIcons.cs
Normal file
370
SunnyUI/Font/UFontElegantIcons.cs
Normal file
@ -0,0 +1,370 @@
|
||||
namespace Sunny.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// ElegantIcons.ttf V1.0
|
||||
/// 33..126, 57344..57609
|
||||
/// </summary>
|
||||
public static class FontElegantIcons
|
||||
{
|
||||
public const int arrow_up = 0x21;
|
||||
public const int arrow_down = 0x22;
|
||||
public const int arrow_left = 0x23;
|
||||
public const int arrow_right = 0x24;
|
||||
public const int arrow_left_up = 0x25;
|
||||
public const int arrow_right_up = 0x26;
|
||||
public const int arrow_right_down = 0x27;
|
||||
public const int arrow_left_down = 0x28;
|
||||
public const int arrow_up_down = 0x29;
|
||||
public const int arrow_up_down_alt = 0x2a;
|
||||
public const int arrow_left_right_alt = 0x2b;
|
||||
public const int arrow_left_right = 0x2c;
|
||||
public const int arrow_expand_alt2 = 0x2d;
|
||||
public const int arrow_expand_alt = 0x2e;
|
||||
public const int arrow_condense = 0x2f;
|
||||
public const int arrow_expand = 0x30;
|
||||
public const int arrow_move = 0x31;
|
||||
public const int arrow_carrot_up = 0x32;
|
||||
public const int arrow_carrot_down = 0x33;
|
||||
public const int arrow_carrot_left = 0x34;
|
||||
public const int arrow_carrot_right = 0x35;
|
||||
public const int arrow_carrot_2up = 0x36;
|
||||
public const int arrow_carrot_2down = 0x37;
|
||||
public const int arrow_carrot_2left = 0x38;
|
||||
public const int arrow_carrot_2right = 0x39;
|
||||
public const int arrow_carrot_up_alt2 = 0x3a;
|
||||
public const int arrow_carrot_down_alt2 = 0x3b;
|
||||
public const int arrow_carrot_left_alt2 = 0x3c;
|
||||
public const int arrow_carrot_right_alt2 = 0x3d;
|
||||
public const int arrow_carrot_2up_alt2 = 0x3e;
|
||||
public const int arrow_carrot_2down_alt2 = 0x3f;
|
||||
public const int arrow_carrot_2left_alt2 = 0x40;
|
||||
public const int arrow_carrot_2right_alt2 = 0x41;
|
||||
public const int arrow_triangle_up = 0x42;
|
||||
public const int arrow_triangle_down = 0x43;
|
||||
public const int arrow_triangle_left = 0x44;
|
||||
public const int arrow_triangle_right = 0x45;
|
||||
public const int arrow_triangle_up_alt2 = 0x46;
|
||||
public const int arrow_triangle_down_alt2 = 0x47;
|
||||
public const int arrow_triangle_left_alt2 = 0x48;
|
||||
public const int arrow_triangle_right_alt2 = 0x49;
|
||||
public const int arrow_back = 0x4a;
|
||||
public const int icon_minus_06 = 0x4b;
|
||||
public const int icon_plus = 0x4c;
|
||||
public const int icon_close = 0x4d;
|
||||
public const int icon_check = 0x4e;
|
||||
public const int icon_minus_alt2 = 0x4f;
|
||||
public const int icon_plus_alt2 = 0x50;
|
||||
public const int icon_close_alt2 = 0x51;
|
||||
public const int icon_check_alt2 = 0x52;
|
||||
public const int icon_zoom_out_alt = 0x53;
|
||||
public const int icon_zoom_in_alt = 0x54;
|
||||
public const int icon_search = 0x55;
|
||||
public const int icon_box_empty = 0x56;
|
||||
public const int icon_box_selected = 0x57;
|
||||
public const int icon_minus_box = 0x58;
|
||||
public const int icon_plus_box = 0x59;
|
||||
public const int icon_box_checked = 0x5a;
|
||||
public const int icon_circle_empty = 0x5b;
|
||||
public const int icon_circle_slelected = 0x5c;
|
||||
public const int icon_stop_alt2 = 0x5d;
|
||||
public const int icon_stop = 0x5e;
|
||||
public const int icon_pause_alt2 = 0x5f;
|
||||
public const int icon_pause = 0x60;
|
||||
public const int icon_menu = 0x61;
|
||||
public const int icon_menu_square_alt2 = 0x62;
|
||||
public const int icon_menu_circle_alt2 = 0x63;
|
||||
public const int icon_ul = 0x64;
|
||||
public const int icon_ol = 0x65;
|
||||
public const int icon_adjust_horiz = 0x66;
|
||||
public const int icon_adjust_vert = 0x67;
|
||||
public const int icon_document_alt = 0x68;
|
||||
public const int icon_documents_alt = 0x69;
|
||||
public const int icon_pencil = 0x6a;
|
||||
public const int icon_pencil_edit_alt = 0x6b;
|
||||
public const int icon_pencil_edit = 0x6c;
|
||||
public const int icon_folder_alt = 0x6d;
|
||||
public const int icon_folder_open_alt = 0x6e;
|
||||
public const int icon_folder_add_alt = 0x6f;
|
||||
public const int icon_info_alt = 0x70;
|
||||
public const int icon_error_oct_alt = 0x71;
|
||||
public const int icon_error_circle_alt = 0x72;
|
||||
public const int icon_error_triangle_alt = 0x73;
|
||||
public const int icon_question_alt2 = 0x74;
|
||||
public const int icon_question = 0x75;
|
||||
public const int icon_comment_alt = 0x76;
|
||||
public const int icon_chat_alt = 0x77;
|
||||
public const int icon_vol_mute_alt = 0x78;
|
||||
public const int icon_volume_low_alt = 0x79;
|
||||
public const int icon_volume_high_alt = 0x7a;
|
||||
public const int icon_quotations = 0x7b;
|
||||
public const int icon_quotations_alt2 = 0x7c;
|
||||
public const int icon_clock_alt = 0x7d;
|
||||
public const int icon_lock_alt = 0x7e;
|
||||
public const int icon_lock_open_alt = 0xe000;
|
||||
public const int icon_key_alt = 0xe001;
|
||||
public const int icon_cloud_alt = 0xe002;
|
||||
public const int icon_cloud_upload_alt = 0xe003;
|
||||
public const int icon_cloud_download_alt = 0xe004;
|
||||
public const int icon_image = 0xe005;
|
||||
public const int icon_images = 0xe006;
|
||||
public const int icon_lightbulb_alt = 0xe007;
|
||||
public const int icon_gift_alt = 0xe008;
|
||||
public const int icon_house_alt = 0xe009;
|
||||
public const int icon_genius = 0xe00a;
|
||||
public const int icon_mobile = 0xe00b;
|
||||
public const int icon_tablet = 0xe00c;
|
||||
public const int icon_laptop = 0xe00d;
|
||||
public const int icon_desktop = 0xe00e;
|
||||
public const int icon_camera_alt = 0xe00f;
|
||||
public const int icon_mail_alt = 0xe010;
|
||||
public const int icon_cone_alt = 0xe011;
|
||||
public const int icon_ribbon_alt = 0xe012;
|
||||
public const int icon_bag_alt = 0xe013;
|
||||
public const int icon_creditcard = 0xe014;
|
||||
public const int icon_cart_alt = 0xe015;
|
||||
public const int icon_paperclip = 0xe016;
|
||||
public const int icon_tag_alt = 0xe017;
|
||||
public const int icon_tags_alt = 0xe018;
|
||||
public const int icon_trash_alt = 0xe019;
|
||||
public const int icon_cursor_alt = 0xe01a;
|
||||
public const int icon_mic_alt = 0xe01b;
|
||||
public const int icon_compass_alt = 0xe01c;
|
||||
public const int icon_pin_alt = 0xe01d;
|
||||
public const int icon_pushpin_alt = 0xe01e;
|
||||
public const int icon_map_alt = 0xe01f;
|
||||
public const int icon_drawer_alt = 0xe020;
|
||||
public const int icon_toolbox_alt = 0xe021;
|
||||
public const int icon_book_alt = 0xe022;
|
||||
public const int icon_calendar = 0xe023;
|
||||
public const int icon_film = 0xe024;
|
||||
public const int icon_table = 0xe025;
|
||||
public const int icon_contacts_alt = 0xe026;
|
||||
public const int icon_headphones = 0xe027;
|
||||
public const int icon_lifesaver = 0xe028;
|
||||
public const int icon_piechart = 0xe029;
|
||||
public const int icon_refresh = 0xe02a;
|
||||
public const int icon_link_alt = 0xe02b;
|
||||
public const int icon_link = 0xe02c;
|
||||
public const int icon_loading = 0xe02d;
|
||||
public const int icon_blocked = 0xe02e;
|
||||
public const int icon_archive_alt = 0xe02f;
|
||||
public const int icon_heart_alt = 0xe030;
|
||||
public const int icon_star_alt = 0xe031;
|
||||
public const int icon_star_half_alt = 0xe032;
|
||||
public const int icon_star = 0xe033;
|
||||
public const int icon_star_half = 0xe034;
|
||||
public const int icon_tools = 0xe035;
|
||||
public const int icon_tool = 0xe036;
|
||||
public const int icon_cog = 0xe037;
|
||||
public const int icon_cogs = 0xe038;
|
||||
public const int arrow_up_alt = 0xe039;
|
||||
public const int arrow_down_alt = 0xe03a;
|
||||
public const int arrow_left_alt = 0xe03b;
|
||||
public const int arrow_right_alt = 0xe03c;
|
||||
public const int arrow_left_up_alt = 0xe03d;
|
||||
public const int arrow_right_up_alt = 0xe03e;
|
||||
public const int arrow_right_down_alt = 0xe03f;
|
||||
public const int arrow_left_down_alt = 0xe040;
|
||||
public const int arrow_condense_alt = 0xe041;
|
||||
public const int arrow_expand_alt3 = 0xe042;
|
||||
public const int arrow_carrot_up_alt = 0xe043;
|
||||
public const int arrow_carrot_down_alt = 0xe044;
|
||||
public const int arrow_carrot_left_alt = 0xe045;
|
||||
public const int arrow_carrot_right_alt = 0xe046;
|
||||
public const int arrow_carrot_2up_alt = 0xe047;
|
||||
public const int arrow_carrot_2dwnn_alt = 0xe048;
|
||||
public const int arrow_carrot_2left_alt = 0xe049;
|
||||
public const int arrow_carrot_2right_alt = 0xe04a;
|
||||
public const int arrow_triangle_up_alt = 0xe04b;
|
||||
public const int arrow_triangle_down_alt = 0xe04c;
|
||||
public const int arrow_triangle_left_alt = 0xe04d;
|
||||
public const int arrow_triangle_right_alt = 0xe04e;
|
||||
public const int icon_minus_alt = 0xe04f;
|
||||
public const int icon_plus_alt = 0xe050;
|
||||
public const int icon_close_alt = 0xe051;
|
||||
public const int icon_check_alt = 0xe052;
|
||||
public const int icon_zoom_out = 0xe053;
|
||||
public const int icon_zoom_in = 0xe054;
|
||||
public const int icon_stop_alt = 0xe055;
|
||||
public const int icon_menu_square_alt = 0xe056;
|
||||
public const int icon_menu_circle_alt = 0xe057;
|
||||
public const int icon_document = 0xe058;
|
||||
public const int icon_documents = 0xe059;
|
||||
public const int icon_pencil_alt = 0xe05a;
|
||||
public const int icon_folder = 0xe05b;
|
||||
public const int icon_folder_open = 0xe05c;
|
||||
public const int icon_folder_add = 0xe05d;
|
||||
public const int icon_folder_upload = 0xe05e;
|
||||
public const int icon_folder_download = 0xe05f;
|
||||
public const int icon_info = 0xe060;
|
||||
public const int icon_error_circle = 0xe061;
|
||||
public const int icon_error_oct = 0xe062;
|
||||
public const int icon_error_triangle = 0xe063;
|
||||
public const int icon_question_alt = 0xe064;
|
||||
public const int icon_comment = 0xe065;
|
||||
public const int icon_chat = 0xe066;
|
||||
public const int icon_vol_mute = 0xe067;
|
||||
public const int icon_volume_low = 0xe068;
|
||||
public const int icon_volume_high = 0xe069;
|
||||
public const int icon_quotations_alt = 0xe06a;
|
||||
public const int icon_clock = 0xe06b;
|
||||
public const int icon_lock = 0xe06c;
|
||||
public const int icon_lock_open = 0xe06d;
|
||||
public const int icon_key = 0xe06e;
|
||||
public const int icon_cloud = 0xe06f;
|
||||
public const int icon_cloud_upload = 0xe070;
|
||||
public const int icon_cloud_download = 0xe071;
|
||||
public const int icon_lightbulb = 0xe072;
|
||||
public const int icon_gift = 0xe073;
|
||||
public const int icon_house = 0xe074;
|
||||
public const int icon_camera = 0xe075;
|
||||
public const int icon_mail = 0xe076;
|
||||
public const int icon_cone = 0xe077;
|
||||
public const int icon_ribbon = 0xe078;
|
||||
public const int icon_bag = 0xe079;
|
||||
public const int icon_cart = 0xe07a;
|
||||
public const int icon_tag = 0xe07b;
|
||||
public const int icon_tags = 0xe07c;
|
||||
public const int icon_trash = 0xe07d;
|
||||
public const int icon_cursor = 0xe07e;
|
||||
public const int icon_mic = 0xe07f;
|
||||
public const int icon_compass = 0xe080;
|
||||
public const int icon_pin = 0xe081;
|
||||
public const int icon_pushpin = 0xe082;
|
||||
public const int icon_map = 0xe083;
|
||||
public const int icon_drawer = 0xe084;
|
||||
public const int icon_toolbox = 0xe085;
|
||||
public const int icon_book = 0xe086;
|
||||
public const int icon_contacts = 0xe087;
|
||||
public const int icon_archive = 0xe088;
|
||||
public const int icon_heart = 0xe089;
|
||||
public const int icon_profile = 0xe08a;
|
||||
public const int icon_group = 0xe08b;
|
||||
public const int icon_grid_2x2 = 0xe08c;
|
||||
public const int icon_grid_3x3 = 0xe08d;
|
||||
public const int icon_music = 0xe08e;
|
||||
public const int icon_pause_alt = 0xe08f;
|
||||
public const int icon_phone = 0xe090;
|
||||
public const int icon_upload = 0xe091;
|
||||
public const int icon_download = 0xe092;
|
||||
public const int social_facebook = 0xe093;
|
||||
public const int social_twitter = 0xe094;
|
||||
public const int social_pinterest = 0xe095;
|
||||
public const int social_googleplus = 0xe096;
|
||||
public const int social_tumblr = 0xe097;
|
||||
public const int social_tumbleupon = 0xe098;
|
||||
public const int social_wordpress = 0xe099;
|
||||
public const int social_instagram = 0xe09a;
|
||||
public const int social_dribbble = 0xe09b;
|
||||
public const int social_vimeo = 0xe09c;
|
||||
public const int social_linkedin = 0xe09d;
|
||||
public const int social_rss = 0xe09e;
|
||||
public const int social_deviantart = 0xe09f;
|
||||
public const int social_share = 0xe0a0;
|
||||
public const int social_myspace = 0xe0a1;
|
||||
public const int social_skype = 0xe0a2;
|
||||
public const int social_youtube = 0xe0a3;
|
||||
public const int social_picassa = 0xe0a4;
|
||||
public const int social_googledrive = 0xe0a5;
|
||||
public const int social_flickr = 0xe0a6;
|
||||
public const int social_blogger = 0xe0a7;
|
||||
public const int social_spotify = 0xe0a8;
|
||||
public const int social_delicious = 0xe0a9;
|
||||
public const int social_facebook_circle = 0xe0aa;
|
||||
public const int social_twitter_circle = 0xe0ab;
|
||||
public const int social_pinterest_circle = 0xe0ac;
|
||||
public const int social_googleplus_circle = 0xe0ad;
|
||||
public const int social_tumblr_circle = 0xe0ae;
|
||||
public const int social_stumbleupon_circle = 0xe0af;
|
||||
public const int social_wordpress_circle = 0xe0b0;
|
||||
public const int social_instagram_circle = 0xe0b1;
|
||||
public const int social_dribbble_circle = 0xe0b2;
|
||||
public const int social_vimeo_circle = 0xe0b3;
|
||||
public const int social_linkedin_circle = 0xe0b4;
|
||||
public const int social_rss_circle = 0xe0b5;
|
||||
public const int social_deviantart_circle = 0xe0b6;
|
||||
public const int social_share_circle = 0xe0b7;
|
||||
public const int social_myspace_circle = 0xe0b8;
|
||||
public const int social_skype_circle = 0xe0b9;
|
||||
public const int social_youtube_circle = 0xe0ba;
|
||||
public const int social_picassa_circle = 0xe0bb;
|
||||
public const int social_googledrive_alt2 = 0xe0bc;
|
||||
public const int social_flickr_circle = 0xe0bd;
|
||||
public const int social_blogger_circle = 0xe0be;
|
||||
public const int social_spotify_circle = 0xe0bf;
|
||||
public const int social_delicious_circle = 0xe0c0;
|
||||
public const int social_facebook_square = 0xe0c1;
|
||||
public const int social_twitter_square = 0xe0c2;
|
||||
public const int social_pinterest_square = 0xe0c3;
|
||||
public const int social_googleplus_square = 0xe0c4;
|
||||
public const int social_tumblr_square = 0xe0c5;
|
||||
public const int social_stumbleupon_square = 0xe0c6;
|
||||
public const int social_wordpress_square = 0xe0c7;
|
||||
public const int social_instagram_square = 0xe0c8;
|
||||
public const int social_dribbble_square = 0xe0c9;
|
||||
public const int social_vimeo_square = 0xe0ca;
|
||||
public const int social_linkedin_square = 0xe0cb;
|
||||
public const int social_rss_square = 0xe0cc;
|
||||
public const int social_deviantart_square = 0xe0cd;
|
||||
public const int social_share_square = 0xe0ce;
|
||||
public const int social_myspace_square = 0xe0cf;
|
||||
public const int social_skype_square = 0xe0d0;
|
||||
public const int social_youtube_square = 0xe0d1;
|
||||
public const int social_picassa_square = 0xe0d2;
|
||||
public const int social_googledrive_square = 0xe0d3;
|
||||
public const int social_flickr_square = 0xe0d4;
|
||||
public const int social_blogger_square = 0xe0d5;
|
||||
public const int social_spotify_square = 0xe0d6;
|
||||
public const int social_delicious_square = 0xe0d7;
|
||||
public const int icon_printer = 0xe103;
|
||||
public const int icon_calulator = 0xe0ee;
|
||||
public const int icon_building = 0xe0ef;
|
||||
public const int icon_floppy = 0xe0e8;
|
||||
public const int icon_drive = 0xe0ea;
|
||||
public const int icon_search_2 = 0xe101;
|
||||
public const int icon_id = 0xe107;
|
||||
public const int icon_id_2 = 0xe108;
|
||||
public const int icon_puzzle = 0xe102;
|
||||
public const int icon_like = 0xe106;
|
||||
public const int icon_dislike = 0xe0eb;
|
||||
public const int icon_mug = 0xe105;
|
||||
public const int icon_currency = 0xe0ed;
|
||||
public const int icon_wallet = 0xe100;
|
||||
public const int icon_pens = 0xe104;
|
||||
public const int icon_easel = 0xe0e9;
|
||||
public const int icon_flowchart = 0xe109;
|
||||
public const int icon_datareport = 0xe0ec;
|
||||
public const int icon_briefcase = 0xe0fe;
|
||||
public const int icon_shield = 0xe0f6;
|
||||
public const int icon_percent = 0xe0fb;
|
||||
public const int icon_globe = 0xe0e2;
|
||||
public const int icon_globe_2 = 0xe0e3;
|
||||
public const int icon_target = 0xe0f5;
|
||||
public const int icon_hourglass = 0xe0e1;
|
||||
public const int icon_balance = 0xe0ff;
|
||||
public const int icon_rook = 0xe0f8;
|
||||
public const int icon_printer_alt = 0xe0fa;
|
||||
public const int icon_calculator_alt = 0xe0e7;
|
||||
public const int icon_building_alt = 0xe0fd;
|
||||
public const int icon_floppy_alt = 0xe0e4;
|
||||
public const int icon_drive_alt = 0xe0e5;
|
||||
public const int icon_search_alt = 0xe0f7;
|
||||
public const int icon_id_alt = 0xe0e0;
|
||||
public const int icon_id_2_alt = 0xe0fc;
|
||||
public const int icon_puzzle_alt = 0xe0f9;
|
||||
public const int icon_like_alt = 0xe0dd;
|
||||
public const int icon_dislike_alt = 0xe0f1;
|
||||
public const int icon_mug_alt = 0xe0dc;
|
||||
public const int icon_currency_alt = 0xe0f3;
|
||||
public const int icon_wallet_alt = 0xe0d8;
|
||||
public const int icon_pens_alt = 0xe0db;
|
||||
public const int icon_easel_alt = 0xe0f0;
|
||||
public const int icon_flowchart_alt = 0xe0df;
|
||||
public const int icon_datareport_alt = 0xe0f2;
|
||||
public const int icon_briefcase_alt = 0xe0f4;
|
||||
public const int icon_shield_alt = 0xe0d9;
|
||||
public const int icon_percent_alt = 0xe0da;
|
||||
public const int icon_globe_alt = 0xe0de;
|
||||
public const int icon_clipboard = 0xe0e6;
|
||||
}
|
||||
}
|
196
SunnyUI/Font/UFontImageHelper.cs
Normal file
196
SunnyUI/Font/UFontImageHelper.cs
Normal file
@ -0,0 +1,196 @@
|
||||
/******************************************************************************
|
||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||
* CopyRight (C) 2012-2023 ShenYongHua(沈永华).
|
||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||
*
|
||||
* Blog: https://www.cnblogs.com/yhuse
|
||||
* Gitee: https://gitee.com/yhuse/SunnyUI
|
||||
* GitHub: https://github.com/yhuse/SunnyUI
|
||||
*
|
||||
* SunnyUI.dll can be used for free under the GPL-3.0 license.
|
||||
* If you use this code, please keep this note.
|
||||
* 如果您使用此代码,请保留此说明。
|
||||
******************************************************************************
|
||||
* 文件名称: UFontImage.cs
|
||||
* 文件说明: 字体图片帮助类
|
||||
* 当前版本: V3.1
|
||||
* 创建日期: 2020-01-01
|
||||
*
|
||||
* 2020-01-01: V2.2.0 增加文件说明
|
||||
* 2020-05-21: V2.2.5 调整从资源文件中加载字体,不用另存为文件。
|
||||
* 感谢:麦壳饼 https://gitee.com/maikebing
|
||||
* 2021-06-15: V3.0.4 增加FontAwesomeV5的字体图标,重构代码
|
||||
* 2021-06-15: V3.3.5 增加FontAwesomeV6的字体图标,重构代码
|
||||
* 2023-05-16: V3.3.6 重构DrawFontImage函数
|
||||
* 2022-05-17: V3.3.7 修复了一个窗体属性编辑器图标显示不全的问题
|
||||
******************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Text;
|
||||
using System.IO;
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// 字体图片帮助类
|
||||
/// </summary>
|
||||
public static class FontImageHelper
|
||||
{
|
||||
public static readonly Dictionary<UISymbolType, FontImages> Fonts = new();
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
static FontImageHelper()
|
||||
{
|
||||
Fonts.Add(UISymbolType.FontAwesomeV4, new FontImages(UISymbolType.FontAwesomeV4, ReadFontFileFromResource("Sunny.UI.Font.FontAwesome.ttf")));
|
||||
Fonts.Add(UISymbolType.ElegantIcons, new FontImages(UISymbolType.ElegantIcons, ReadFontFileFromResource("Sunny.UI.Font.ElegantIcons.ttf")));
|
||||
Fonts.Add(UISymbolType.FontAwesomeV6Brands, new FontImages(UISymbolType.FontAwesomeV6Brands, ReadFontFileFromResource("Sunny.UI.Font.fa-brands-400.ttf")));
|
||||
Fonts.Add(UISymbolType.FontAwesomeV6Regular, new FontImages(UISymbolType.FontAwesomeV6Regular, ReadFontFileFromResource("Sunny.UI.Font.fa-regular-400.ttf")));
|
||||
Fonts.Add(UISymbolType.FontAwesomeV6Solid, new FontImages(UISymbolType.FontAwesomeV6Solid, ReadFontFileFromResource("Sunny.UI.Font.fa-solid-900.ttf")));
|
||||
Fonts.Add(UISymbolType.MaterialIcons, new FontImages(UISymbolType.MaterialIcons, ReadFontFileFromResource("Sunny.UI.Font.MaterialIcons-Regular.ttf")));
|
||||
}
|
||||
|
||||
private static byte[] ReadFontFileFromResource(string name)
|
||||
{
|
||||
byte[] buffer = null;
|
||||
Stream fontStream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(name);
|
||||
if (fontStream != null)
|
||||
{
|
||||
buffer = new byte[fontStream.Length];
|
||||
fontStream.Read(buffer, 0, (int)fontStream.Length);
|
||||
fontStream.Close();
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取字体大小
|
||||
/// </summary>
|
||||
/// <param name="graphics">GDI绘图</param>
|
||||
/// <param name="symbol">字符</param>
|
||||
/// <param name="symbolSize">大小</param>
|
||||
/// <returns>字体大小</returns>
|
||||
private static SizeF GetFontImageSize(this Graphics graphics, int symbol, int symbolSize)
|
||||
{
|
||||
Font font = GetFont(symbol, symbolSize);
|
||||
if (font == null)
|
||||
{
|
||||
return new SizeF(0, 0);
|
||||
}
|
||||
|
||||
return graphics.MeasureString(char.ConvertFromUtf32(symbol), font);
|
||||
}
|
||||
|
||||
private static UISymbolType GetSymbolType(int symbol)
|
||||
{
|
||||
return (UISymbolType)symbol.Div(100000);
|
||||
}
|
||||
|
||||
private static int GetSymbolValue(int symbol)
|
||||
{
|
||||
return symbol.Mod(100000);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绘制字体图片
|
||||
/// </summary>
|
||||
/// <param name="graphics">GDI绘图</param>
|
||||
/// <param name="symbol">字符</param>
|
||||
/// <param name="symbolSize">大小</param>
|
||||
/// <param name="color">颜色</param>
|
||||
/// <param name="rect">区域</param>
|
||||
/// <param name="xOffset">左右偏移</param>
|
||||
/// <param name="yOffSet">上下偏移</param>
|
||||
public static void DrawFontImage(this Graphics graphics, int symbol, int symbolSize, Color color,
|
||||
RectangleF rect, int xOffset = 0, int yOffSet = 0)
|
||||
{
|
||||
SizeF sf = graphics.GetFontImageSize(symbol, symbolSize);
|
||||
graphics.DrawFontImage(symbol, symbolSize, color, rect.Left + ((rect.Width - sf.Width) / 2.0f).RoundEx(),
|
||||
rect.Top + ((rect.Height - sf.Height) / 2.0f).RoundEx(), xOffset, yOffSet);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绘制字体图片
|
||||
/// </summary>
|
||||
/// <param name="graphics">GDI绘图</param>
|
||||
/// <param name="symbol">字符</param>
|
||||
/// <param name="symbolSize">大小</param>
|
||||
/// <param name="color">颜色</param>
|
||||
/// <param name="left">左</param>
|
||||
/// <param name="top">上</param>
|
||||
/// <param name="xOffset">左右偏移</param>
|
||||
/// <param name="yOffSet">上下偏移</param>
|
||||
public static void DrawFontImage(this Graphics graphics, int symbol, int symbolSize, Color color,
|
||||
float left, float top, int xOffset = 0, int yOffSet = 0)
|
||||
{
|
||||
//字体
|
||||
Font font = GetFont(symbol, symbolSize);
|
||||
if (font == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var symbolValue = GetSymbolValue(symbol);
|
||||
string text = char.ConvertFromUtf32(symbolValue);
|
||||
graphics.TextRenderingHint = TextRenderingHint.AntiAlias;
|
||||
graphics.InterpolationMode = InterpolationMode.HighQualityBilinear;
|
||||
graphics.DrawString(text, font, color, left + xOffset, top + yOffSet);
|
||||
graphics.TextRenderingHint = TextRenderingHint.SystemDefault;
|
||||
graphics.InterpolationMode = InterpolationMode.Default;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建图片
|
||||
/// </summary>
|
||||
/// <param name="symbol">字符</param>
|
||||
/// <param name="size">大小</param>
|
||||
/// <param name="color">颜色</param>
|
||||
/// <returns>图片</returns>
|
||||
public static Image CreateImage(int symbol, int size, Color color)
|
||||
{
|
||||
Bitmap image = new Bitmap(size, size);
|
||||
|
||||
using (Graphics g = image.Graphics())
|
||||
{
|
||||
SizeF sf = g.GetFontImageSize(symbol, size);
|
||||
g.DrawFontImage(symbol, size, color, (image.Width - sf.Width) / 2.0f, (image.Height - sf.Height) / 2.0f);
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取字体
|
||||
/// </summary>
|
||||
/// <param name="symbol">字符</param>
|
||||
/// <param name="imageSize">大小</param>
|
||||
/// <returns>字体</returns>
|
||||
public static Font GetFont(int symbol, int imageSize)
|
||||
{
|
||||
var symbolType = GetSymbolType(symbol);
|
||||
var symbolValue = GetSymbolValue(symbol);
|
||||
switch (symbolType)
|
||||
{
|
||||
case UISymbolType.FontAwesomeV4:
|
||||
if (symbol > 0xF000)
|
||||
return Fonts[UISymbolType.FontAwesomeV4].GetFont(symbolValue, imageSize);
|
||||
else
|
||||
return Fonts[UISymbolType.ElegantIcons].GetFont(symbolValue, imageSize);
|
||||
case UISymbolType.FontAwesomeV6Brands:
|
||||
return Fonts[UISymbolType.FontAwesomeV6Brands].GetFont(symbolValue, imageSize);
|
||||
case UISymbolType.FontAwesomeV6Regular:
|
||||
return Fonts[UISymbolType.FontAwesomeV6Regular].GetFont(symbolValue, imageSize);
|
||||
case UISymbolType.FontAwesomeV6Solid:
|
||||
return Fonts[UISymbolType.FontAwesomeV6Solid].GetFont(symbolValue, imageSize);
|
||||
case UISymbolType.MaterialIcons:
|
||||
return Fonts[UISymbolType.MaterialIcons].GetFont(symbolValue, imageSize);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
180
SunnyUI/Font/UFontImages.cs
Normal file
180
SunnyUI/Font/UFontImages.cs
Normal file
@ -0,0 +1,180 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Drawing.Text;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// 字体图标图片
|
||||
/// </summary>
|
||||
public class FontImages
|
||||
{
|
||||
private readonly PrivateFontCollection ImageFont;
|
||||
private readonly Dictionary<int, Font> Fonts = new Dictionary<int, Font>();
|
||||
private const int MinFontSize = 8;
|
||||
private const int MaxFontSize = 88;
|
||||
private readonly IntPtr memoryFont = IntPtr.Zero;
|
||||
|
||||
public UISymbolType SymbolType { get; }
|
||||
|
||||
public FontImages(UISymbolType symbolType, byte[] buffer)
|
||||
{
|
||||
SymbolType = symbolType;
|
||||
ImageFont = new PrivateFontCollection();
|
||||
memoryFont = Marshal.AllocCoTaskMem(buffer.Length);
|
||||
Marshal.Copy(buffer, 0, memoryFont, buffer.Length);
|
||||
ImageFont.AddMemoryFont(memoryFont, buffer.Length);
|
||||
Loaded = true;
|
||||
LoadDictionary();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="filename">字体文件名</param>
|
||||
public FontImages(UISymbolType symbolType, string filename)
|
||||
{
|
||||
if (!File.Exists(filename)) throw new FileNotFoundException(filename);
|
||||
|
||||
SymbolType = symbolType;
|
||||
ImageFont = new PrivateFontCollection();
|
||||
ImageFont.AddFontFile(filename);
|
||||
Loaded = true;
|
||||
LoadDictionary();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 字体加载完成标志
|
||||
/// </summary>
|
||||
public bool Loaded
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
private void LoadDictionary()
|
||||
{
|
||||
int size = MinFontSize;
|
||||
for (int i = 0; i <= MaxFontSize - MinFontSize; i++)
|
||||
{
|
||||
Fonts.Add(size, GetFont(size));
|
||||
size += 1;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 析构函数
|
||||
/// </summary>
|
||||
~FontImages()
|
||||
{
|
||||
foreach (var font in Fonts.Values)
|
||||
{
|
||||
font.Dispose();
|
||||
}
|
||||
|
||||
if (memoryFont != IntPtr.Zero)
|
||||
{
|
||||
Marshal.FreeCoTaskMem(memoryFont);
|
||||
}
|
||||
|
||||
Fonts.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取字体
|
||||
/// </summary>
|
||||
/// <param name="iconText">图标</param>
|
||||
/// <param name="imageSize">图标大小</param>
|
||||
/// <returns>字体</returns>
|
||||
public Font GetFont(int iconText, int imageSize)
|
||||
{
|
||||
int item = GetFontSize(iconText, imageSize);
|
||||
return Fonts.ContainsKey(item) ? Fonts[item] : null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取字体大小
|
||||
/// </summary>
|
||||
/// <param name="symbol">图标</param>
|
||||
/// <param name="imageSize">图标大小</param>
|
||||
/// <returns>字体大小</returns>
|
||||
public int GetFontSize(int symbol, int imageSize)
|
||||
{
|
||||
using Bitmap bitmap = new Bitmap(48, 48);
|
||||
using Graphics graphics = Graphics.FromImage(bitmap);
|
||||
return BinarySearch(graphics, MinFontSize, MaxFontSize, symbol, imageSize);
|
||||
}
|
||||
|
||||
public int BinarySearch(Graphics graphics, int low, int high, int symbol, int imageSize)
|
||||
{
|
||||
int mid = (low + high) / 2;
|
||||
Font font = Fonts[mid];
|
||||
SizeF sf = GetIconSize(symbol, graphics, font);
|
||||
if (low >= high)
|
||||
{
|
||||
return mid;
|
||||
}
|
||||
|
||||
if (sf.Width < imageSize && sf.Height < imageSize)
|
||||
{
|
||||
return BinarySearch(graphics, mid + 1, high, symbol, imageSize);
|
||||
}
|
||||
|
||||
return BinarySearch(graphics, low, mid - 1, symbol, imageSize);
|
||||
}
|
||||
|
||||
private Size GetIconSize(int iconText, Graphics graphics, Font font)
|
||||
{
|
||||
string text = char.ConvertFromUtf32(iconText);
|
||||
return graphics.MeasureString(text, font).ToSize();
|
||||
}
|
||||
|
||||
public Icon ToIcon(Bitmap srcBitmap, int size)
|
||||
{
|
||||
if (srcBitmap == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(srcBitmap));
|
||||
}
|
||||
|
||||
Icon icon;
|
||||
using (MemoryStream memoryStream = new MemoryStream())
|
||||
{
|
||||
new Bitmap(srcBitmap, new Size(size, size)).Save(memoryStream, ImageFormat.Png);
|
||||
Stream stream = new MemoryStream();
|
||||
BinaryWriter binaryWriter = new BinaryWriter(stream);
|
||||
if (stream.Length <= 0L)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
binaryWriter.Write((byte)0);
|
||||
binaryWriter.Write((byte)0);
|
||||
binaryWriter.Write((short)1);
|
||||
binaryWriter.Write((short)1);
|
||||
binaryWriter.Write((byte)size);
|
||||
binaryWriter.Write((byte)size);
|
||||
binaryWriter.Write((byte)0);
|
||||
binaryWriter.Write((byte)0);
|
||||
binaryWriter.Write((short)0);
|
||||
binaryWriter.Write((short)32);
|
||||
binaryWriter.Write((int)memoryStream.Length);
|
||||
binaryWriter.Write(22);
|
||||
binaryWriter.Write(memoryStream.ToArray());
|
||||
binaryWriter.Flush();
|
||||
binaryWriter.Seek(0, SeekOrigin.Begin);
|
||||
icon = new Icon(stream);
|
||||
stream.Dispose();
|
||||
}
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
private Font GetFont(float size)
|
||||
{
|
||||
return Loaded ? new Font(ImageFont.Families[0], size, FontStyle.Regular, GraphicsUnit.Point) : null;
|
||||
}
|
||||
}
|
||||
}
|
2246
SunnyUI/Font/UFontMaterialIcons.cs
Normal file
2246
SunnyUI/Font/UFontMaterialIcons.cs
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,398 +0,0 @@
|
||||
/******************************************************************************
|
||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||
* CopyRight (C) 2012-2023 ShenYongHua(沈永华).
|
||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||
*
|
||||
* Blog: https://www.cnblogs.com/yhuse
|
||||
* Gitee: https://gitee.com/yhuse/SunnyUI
|
||||
* GitHub: https://github.com/yhuse/SunnyUI
|
||||
*
|
||||
* SunnyUI.dll can be used for free under the GPL-3.0 license.
|
||||
* If you use this code, please keep this note.
|
||||
* 如果您使用此代码,请保留此说明。
|
||||
******************************************************************************
|
||||
* 文件名称: UFontImage.cs
|
||||
* 文件说明: 字体图片帮助类
|
||||
* 当前版本: V3.1
|
||||
* 创建日期: 2020-01-01
|
||||
*
|
||||
* 2020-01-01: V2.2.0 增加文件说明
|
||||
* 2020-05-21: V2.2.5 调整从资源文件中加载字体,不用另存为文件。
|
||||
* 感谢:麦壳饼 https://gitee.com/maikebing
|
||||
* 2021-06-15: V3.0.4 增加FontAwesomeV5的字体图标,重构代码
|
||||
* 2021-06-15: V3.3.5 增加FontAwesomeV6的字体图标,重构代码
|
||||
* 2023-05-16: V3.3.6 重构DrawFontImage函数
|
||||
* 2022-05-17: V3.3.7 修复了一个窗体属性编辑器图标显示不全的问题
|
||||
******************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Drawing.Text;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// 字体图片帮助类
|
||||
/// </summary>
|
||||
public static class FontImageHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// AwesomeFont
|
||||
/// </summary>
|
||||
public static readonly FontImages FontAwesomeV4;
|
||||
|
||||
/// <summary>
|
||||
/// ElegantFont
|
||||
/// </summary>
|
||||
public static readonly FontImages ElegantIcons;
|
||||
|
||||
/// <summary>
|
||||
/// FontAwesomeV6Brands
|
||||
/// </summary>
|
||||
public static readonly FontImages FontAwesomeV6Brands;
|
||||
|
||||
/// <summary>
|
||||
/// FontAwesomeV6Regular
|
||||
/// </summary>
|
||||
public static readonly FontImages FontAwesomeV6Regular;
|
||||
|
||||
/// <summary>
|
||||
/// FontAwesomeV6Solid
|
||||
/// </summary>
|
||||
public static readonly FontImages FontAwesomeV6Solid;
|
||||
|
||||
//public const int FontAwesomeV4Count = 786;
|
||||
//public const int ElegantIconsCount = 360;
|
||||
//public const int FontAwesomeV6RegularCount = 151;
|
||||
//public const int FontAwesomeV6SolidCount = 1001;
|
||||
//public const int FontAwesomeV6BrandsCount = 457;
|
||||
//public const int LineAwesomeRegularCount = 151;
|
||||
//public const int LineAwesomeSolidCount = 960;
|
||||
//public const int LineAwesomeBrandsCount = 433;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
static FontImageHelper()
|
||||
{
|
||||
FontAwesomeV4 = new FontImages(ReadFontFileFromResource("Sunny.UI.Font.FontAwesome.ttf"));
|
||||
ElegantIcons = new FontImages(ReadFontFileFromResource("Sunny.UI.Font.ElegantIcons.ttf"));
|
||||
FontAwesomeV6Brands = new FontImages(ReadFontFileFromResource("Sunny.UI.Font.fa-brands-400.ttf"));
|
||||
FontAwesomeV6Regular = new FontImages(ReadFontFileFromResource("Sunny.UI.Font.fa-regular-400.ttf"));
|
||||
FontAwesomeV6Solid = new FontImages(ReadFontFileFromResource("Sunny.UI.Font.fa-solid-900.ttf"));
|
||||
}
|
||||
|
||||
private static byte[] ReadFontFileFromResource(string name)
|
||||
{
|
||||
byte[] buffer = null;
|
||||
Stream fontStream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(name);
|
||||
if (fontStream != null)
|
||||
{
|
||||
buffer = new byte[fontStream.Length];
|
||||
fontStream.Read(buffer, 0, (int)fontStream.Length);
|
||||
fontStream.Close();
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取字体大小
|
||||
/// </summary>
|
||||
/// <param name="graphics">GDI绘图</param>
|
||||
/// <param name="symbol">字符</param>
|
||||
/// <param name="symbolSize">大小</param>
|
||||
/// <returns>字体大小</returns>
|
||||
private static SizeF GetFontImageSize(this Graphics graphics, int symbol, int symbolSize)
|
||||
{
|
||||
Font font = GetFont(symbol, symbolSize);
|
||||
if (font == null)
|
||||
{
|
||||
return new SizeF(0, 0);
|
||||
}
|
||||
|
||||
return graphics.MeasureString(char.ConvertFromUtf32(symbol), font);
|
||||
}
|
||||
|
||||
private static UISymbolType GetSymbolType(int symbol)
|
||||
{
|
||||
return (UISymbolType)symbol.Div(100000);
|
||||
}
|
||||
|
||||
private static int GetSymbolValue(int symbol)
|
||||
{
|
||||
return symbol.Mod(100000);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绘制字体图片
|
||||
/// </summary>
|
||||
/// <param name="graphics">GDI绘图</param>
|
||||
/// <param name="symbol">字符</param>
|
||||
/// <param name="symbolSize">大小</param>
|
||||
/// <param name="color">颜色</param>
|
||||
/// <param name="rect">区域</param>
|
||||
/// <param name="xOffset">左右偏移</param>
|
||||
/// <param name="yOffSet">上下偏移</param>
|
||||
public static void DrawFontImage(this Graphics graphics, int symbol, int symbolSize, Color color,
|
||||
RectangleF rect, int xOffset = 0, int yOffSet = 0)
|
||||
{
|
||||
SizeF sf = graphics.GetFontImageSize(symbol, symbolSize);
|
||||
graphics.DrawFontImage(symbol, symbolSize, color, rect.Left + ((rect.Width - sf.Width) / 2.0f).RoundEx(),
|
||||
rect.Top + ((rect.Height - sf.Height) / 2.0f).RoundEx(), xOffset, yOffSet);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绘制字体图片
|
||||
/// </summary>
|
||||
/// <param name="graphics">GDI绘图</param>
|
||||
/// <param name="symbol">字符</param>
|
||||
/// <param name="symbolSize">大小</param>
|
||||
/// <param name="color">颜色</param>
|
||||
/// <param name="left">左</param>
|
||||
/// <param name="top">上</param>
|
||||
/// <param name="xOffset">左右偏移</param>
|
||||
/// <param name="yOffSet">上下偏移</param>
|
||||
public static void DrawFontImage(this Graphics graphics, int symbol, int symbolSize, Color color,
|
||||
float left, float top, int xOffset = 0, int yOffSet = 0)
|
||||
{
|
||||
//字体
|
||||
Font font = GetFont(symbol, symbolSize);
|
||||
if (font == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var symbolValue = GetSymbolValue(symbol);
|
||||
string text = char.ConvertFromUtf32(symbolValue);
|
||||
graphics.TextRenderingHint = TextRenderingHint.AntiAlias;
|
||||
graphics.InterpolationMode = InterpolationMode.HighQualityBilinear;
|
||||
graphics.DrawString(text, font, color, left + xOffset, top + yOffSet);
|
||||
graphics.TextRenderingHint = TextRenderingHint.SystemDefault;
|
||||
graphics.InterpolationMode = InterpolationMode.Default;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建图片
|
||||
/// </summary>
|
||||
/// <param name="symbol">字符</param>
|
||||
/// <param name="size">大小</param>
|
||||
/// <param name="color">颜色</param>
|
||||
/// <returns>图片</returns>
|
||||
public static Image CreateImage(int symbol, int size, Color color)
|
||||
{
|
||||
Bitmap image = new Bitmap(size, size);
|
||||
|
||||
using (Graphics g = image.Graphics())
|
||||
{
|
||||
SizeF sf = g.GetFontImageSize(symbol, size);
|
||||
g.DrawFontImage(symbol, size, color, (image.Width - sf.Width) / 2.0f, (image.Height - sf.Height) / 2.0f);
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取字体
|
||||
/// </summary>
|
||||
/// <param name="symbol">字符</param>
|
||||
/// <param name="imageSize">大小</param>
|
||||
/// <returns>字体</returns>
|
||||
public static Font GetFont(int symbol, int imageSize)
|
||||
{
|
||||
var symbolType = GetSymbolType(symbol);
|
||||
var symbolValue = GetSymbolValue(symbol);
|
||||
switch (symbolType)
|
||||
{
|
||||
case UISymbolType.FontAwesomeV4:
|
||||
if (symbol > 0xF000)
|
||||
return FontAwesomeV4.GetFont(symbolValue, imageSize);
|
||||
else
|
||||
return ElegantIcons.GetFont(symbolValue, imageSize);
|
||||
case UISymbolType.FontAwesomeV6Brands:
|
||||
return FontAwesomeV6Brands.GetFont(symbolValue, imageSize);
|
||||
case UISymbolType.FontAwesomeV6Regular:
|
||||
return FontAwesomeV6Regular.GetFont(symbolValue, imageSize);
|
||||
case UISymbolType.FontAwesomeV6Solid:
|
||||
return FontAwesomeV6Solid.GetFont(symbolValue, imageSize);
|
||||
default:
|
||||
if (symbol > 0xF000)
|
||||
return FontAwesomeV4.GetFont(symbolValue, imageSize);
|
||||
else
|
||||
return ElegantIcons.GetFont(symbolValue, imageSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 字体图标图片
|
||||
/// </summary>
|
||||
public class FontImages
|
||||
{
|
||||
private readonly PrivateFontCollection ImageFont;
|
||||
private readonly Dictionary<int, Font> Fonts = new Dictionary<int, Font>();
|
||||
private const int MinFontSize = 8;
|
||||
private const int MaxFontSize = 88;
|
||||
private readonly IntPtr memoryFont = IntPtr.Zero;
|
||||
|
||||
public FontImages(byte[] buffer)
|
||||
{
|
||||
ImageFont = new PrivateFontCollection();
|
||||
memoryFont = Marshal.AllocCoTaskMem(buffer.Length);
|
||||
Marshal.Copy(buffer, 0, memoryFont, buffer.Length);
|
||||
ImageFont.AddMemoryFont(memoryFont, buffer.Length);
|
||||
Loaded = true;
|
||||
LoadDictionary();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="filename">字体文件名</param>
|
||||
public FontImages(string filename)
|
||||
{
|
||||
if (File.Exists(filename))
|
||||
{
|
||||
ImageFont = new PrivateFontCollection();
|
||||
ImageFont.AddFontFile(filename);
|
||||
Loaded = true;
|
||||
LoadDictionary();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 字体加载完成标志
|
||||
/// </summary>
|
||||
public bool Loaded
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
private void LoadDictionary()
|
||||
{
|
||||
int size = MinFontSize;
|
||||
for (int i = 0; i <= MaxFontSize - MinFontSize; i++)
|
||||
{
|
||||
Fonts.Add(size, GetFont(size));
|
||||
size += 1;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 析构函数
|
||||
/// </summary>
|
||||
~FontImages()
|
||||
{
|
||||
foreach (var font in Fonts.Values)
|
||||
{
|
||||
font.Dispose();
|
||||
}
|
||||
|
||||
if (memoryFont != IntPtr.Zero)
|
||||
{
|
||||
Marshal.FreeCoTaskMem(memoryFont);
|
||||
}
|
||||
|
||||
Fonts.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取字体
|
||||
/// </summary>
|
||||
/// <param name="iconText">图标</param>
|
||||
/// <param name="imageSize">图标大小</param>
|
||||
/// <returns>字体</returns>
|
||||
public Font GetFont(int iconText, int imageSize)
|
||||
{
|
||||
int item = GetFontSize(iconText, imageSize);
|
||||
return Fonts.ContainsKey(item) ? Fonts[item] : null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取字体大小
|
||||
/// </summary>
|
||||
/// <param name="symbol">图标</param>
|
||||
/// <param name="imageSize">图标大小</param>
|
||||
/// <returns>字体大小</returns>
|
||||
public int GetFontSize(int symbol, int imageSize)
|
||||
{
|
||||
using Bitmap bitmap = new Bitmap(48, 48);
|
||||
using Graphics graphics = Graphics.FromImage(bitmap);
|
||||
return BinarySearch(graphics, MinFontSize, MaxFontSize, symbol, imageSize);
|
||||
}
|
||||
|
||||
public int BinarySearch(Graphics graphics, int low, int high, int symbol, int imageSize)
|
||||
{
|
||||
int mid = (low + high) / 2;
|
||||
Font font = Fonts[mid];
|
||||
SizeF sf = GetIconSize(symbol, graphics, font);
|
||||
if (low >= high)
|
||||
{
|
||||
return mid;
|
||||
}
|
||||
|
||||
if (sf.Width < imageSize && sf.Height < imageSize)
|
||||
{
|
||||
return BinarySearch(graphics, mid + 1, high, symbol, imageSize);
|
||||
}
|
||||
|
||||
return BinarySearch(graphics, low, mid - 1, symbol, imageSize);
|
||||
}
|
||||
|
||||
private Size GetIconSize(int iconText, Graphics graphics, Font font)
|
||||
{
|
||||
string text = char.ConvertFromUtf32(iconText);
|
||||
return graphics.MeasureString(text, font).ToSize();
|
||||
}
|
||||
|
||||
public Icon ToIcon(Bitmap srcBitmap, int size)
|
||||
{
|
||||
if (srcBitmap == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(srcBitmap));
|
||||
}
|
||||
|
||||
Icon icon;
|
||||
using (MemoryStream memoryStream = new MemoryStream())
|
||||
{
|
||||
new Bitmap(srcBitmap, new Size(size, size)).Save(memoryStream, ImageFormat.Png);
|
||||
Stream stream = new MemoryStream();
|
||||
BinaryWriter binaryWriter = new BinaryWriter(stream);
|
||||
if (stream.Length <= 0L)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
binaryWriter.Write((byte)0);
|
||||
binaryWriter.Write((byte)0);
|
||||
binaryWriter.Write((short)1);
|
||||
binaryWriter.Write((short)1);
|
||||
binaryWriter.Write((byte)size);
|
||||
binaryWriter.Write((byte)size);
|
||||
binaryWriter.Write((byte)0);
|
||||
binaryWriter.Write((byte)0);
|
||||
binaryWriter.Write((short)0);
|
||||
binaryWriter.Write((short)32);
|
||||
binaryWriter.Write((int)memoryStream.Length);
|
||||
binaryWriter.Write(22);
|
||||
binaryWriter.Write(memoryStream.ToArray());
|
||||
binaryWriter.Flush();
|
||||
binaryWriter.Seek(0, SeekOrigin.Begin);
|
||||
icon = new Icon(stream);
|
||||
stream.Dispose();
|
||||
}
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
private Font GetFont(float size)
|
||||
{
|
||||
return Loaded ? new Font(ImageFont.Families[0], size, FontStyle.Regular, GraphicsUnit.Point) : null;
|
||||
}
|
||||
}
|
||||
}
|
@ -38,6 +38,8 @@ namespace Sunny.UI
|
||||
FontAwesomeV4 = 0,
|
||||
FontAwesomeV6Brands = 1,
|
||||
FontAwesomeV6Regular = 2,
|
||||
FontAwesomeV6Solid = 3
|
||||
FontAwesomeV6Solid = 3,
|
||||
ElegantIcons = 4,
|
||||
MaterialIcons = 5
|
||||
}
|
||||
}
|
@ -43,6 +43,7 @@ namespace Sunny.UI
|
||||
private readonly ConcurrentQueue<Label> FontAwesomeV6SolidLabels = new ConcurrentQueue<Label>();
|
||||
private readonly ConcurrentQueue<Label> FontAwesomeV6BrandsLabels = new ConcurrentQueue<Label>();
|
||||
private readonly ConcurrentQueue<Label> FontAwesomeV6RegularLabels = new ConcurrentQueue<Label>();
|
||||
private readonly ConcurrentQueue<Label> MaterialIconsLabels = new ConcurrentQueue<Label>();
|
||||
private readonly ConcurrentQueue<Label> SearchLabels = new ConcurrentQueue<Label>();
|
||||
|
||||
/// <summary>
|
||||
@ -57,6 +58,7 @@ namespace Sunny.UI
|
||||
lpV6Brands.DoubleBuffered();
|
||||
lpV6Regular.DoubleBuffered();
|
||||
lpV6Solid.DoubleBuffered();
|
||||
lpMaterialIcons.DoubleBuffered();
|
||||
}
|
||||
|
||||
private void UIFontImages_Load(object sender, EventArgs e)
|
||||
@ -67,6 +69,7 @@ namespace Sunny.UI
|
||||
bg3.RunWorkerAsync();
|
||||
bg4.RunWorkerAsync();
|
||||
bg5.RunWorkerAsync();
|
||||
bg6.RunWorkerAsync();
|
||||
timer.Start();
|
||||
}
|
||||
|
||||
@ -124,6 +127,16 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
while (!MaterialIconsLabels.IsEmpty)
|
||||
{
|
||||
if (MaterialIconsLabels.TryDequeue(out Label lbl))
|
||||
{
|
||||
lpMaterialIcons.Controls.Add(lbl);
|
||||
SymbolValue symbol = (SymbolValue)lbl.Tag;
|
||||
toolTip.SetToolTip(lbl, symbol.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
timer.Start();
|
||||
}
|
||||
|
||||
@ -291,7 +304,7 @@ namespace Sunny.UI
|
||||
lbl.Click += lbl_DoubleClick;
|
||||
lbl.MouseEnter += Lbl_MouseEnter;
|
||||
lbl.MouseLeave += Lbl_MouseLeave;
|
||||
lbl.Tag = new SymbolValue() { Name = name.Replace("fa_", ""), Symbol = icon, SymbolType = symbolType };
|
||||
lbl.Tag = new SymbolValue() { Name = name.Replace("fa_", "").Replace("ma_", ""), Symbol = icon, SymbolType = symbolType };
|
||||
return lbl;
|
||||
}
|
||||
|
||||
@ -393,6 +406,11 @@ namespace Sunny.UI
|
||||
LoadLabels(typeof(FontAweSomeV6Solid), FontAwesomeV6SolidLabels, UISymbolType.FontAwesomeV6Solid);
|
||||
}
|
||||
|
||||
private void bg6_DoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
LoadLabels(typeof(MaterialIcons), MaterialIconsLabels, UISymbolType.MaterialIcons);
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (textBox1.Text.IsNullOrEmpty()) return;
|
||||
@ -404,6 +422,7 @@ namespace Sunny.UI
|
||||
LoadLabels(typeof(FontAweSomeV6Brands), SearchLabels, UISymbolType.FontAwesomeV6Brands, textBox1.Text);
|
||||
LoadLabels(typeof(FontAweSomeV6Regular), SearchLabels, UISymbolType.FontAwesomeV6Regular, textBox1.Text);
|
||||
LoadLabels(typeof(FontAweSomeV6Solid), SearchLabels, UISymbolType.FontAwesomeV6Solid, textBox1.Text);
|
||||
LoadLabels(typeof(MaterialIcons), SearchLabels, UISymbolType.MaterialIcons, textBox1.Text);
|
||||
|
||||
label1.Text = SearchLabels.Count + " results.";
|
||||
while (!SearchLabels.IsEmpty)
|
||||
|
64
SunnyUI/Font/UIFontImages.designer.cs
generated
64
SunnyUI/Font/UIFontImages.designer.cs
generated
@ -42,6 +42,8 @@
|
||||
lpAwesome = new System.Windows.Forms.FlowLayoutPanel();
|
||||
tabPage3 = new System.Windows.Forms.TabPage();
|
||||
lpElegant = new System.Windows.Forms.FlowLayoutPanel();
|
||||
tsMaterialIcons = new System.Windows.Forms.TabPage();
|
||||
lpMaterialIcons = new System.Windows.Forms.FlowLayoutPanel();
|
||||
tabPage7 = new System.Windows.Forms.TabPage();
|
||||
lblResult = new System.Windows.Forms.FlowLayoutPanel();
|
||||
bg1 = new System.ComponentModel.BackgroundWorker();
|
||||
@ -56,6 +58,7 @@
|
||||
label1 = new System.Windows.Forms.Label();
|
||||
button1 = new System.Windows.Forms.Button();
|
||||
textBox1 = new System.Windows.Forms.TextBox();
|
||||
bg6 = new System.ComponentModel.BackgroundWorker();
|
||||
tabControl1.SuspendLayout();
|
||||
tabPage1.SuspendLayout();
|
||||
tabPage5.SuspendLayout();
|
||||
@ -63,6 +66,7 @@
|
||||
tabPage4.SuspendLayout();
|
||||
tabPage2.SuspendLayout();
|
||||
tabPage3.SuspendLayout();
|
||||
tsMaterialIcons.SuspendLayout();
|
||||
tabPage7.SuspendLayout();
|
||||
panel1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
@ -75,6 +79,7 @@
|
||||
tabControl1.Controls.Add(tabPage4);
|
||||
tabControl1.Controls.Add(tabPage2);
|
||||
tabControl1.Controls.Add(tabPage3);
|
||||
tabControl1.Controls.Add(tsMaterialIcons);
|
||||
tabControl1.Controls.Add(tabPage7);
|
||||
tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
tabControl1.ItemSize = new System.Drawing.Size(48, 24);
|
||||
@ -196,7 +201,7 @@
|
||||
tabPage3.Padding = new System.Windows.Forms.Padding(3);
|
||||
tabPage3.Size = new System.Drawing.Size(892, 578);
|
||||
tabPage3.TabIndex = 2;
|
||||
tabPage3.Text = "ElegantFont";
|
||||
tabPage3.Text = "ElegantIcons";
|
||||
tabPage3.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// lpElegant
|
||||
@ -209,6 +214,27 @@
|
||||
lpElegant.Size = new System.Drawing.Size(886, 572);
|
||||
lpElegant.TabIndex = 2;
|
||||
//
|
||||
// tsMaterialIcons
|
||||
//
|
||||
tsMaterialIcons.Controls.Add(lpMaterialIcons);
|
||||
tsMaterialIcons.Location = new System.Drawing.Point(4, 28);
|
||||
tsMaterialIcons.Name = "tsMaterialIcons";
|
||||
tsMaterialIcons.Padding = new System.Windows.Forms.Padding(3);
|
||||
tsMaterialIcons.Size = new System.Drawing.Size(892, 578);
|
||||
tsMaterialIcons.TabIndex = 7;
|
||||
tsMaterialIcons.Text = "MaterialIcons";
|
||||
tsMaterialIcons.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// lpMaterialIcons
|
||||
//
|
||||
lpMaterialIcons.AutoScroll = true;
|
||||
lpMaterialIcons.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
lpMaterialIcons.ForeColor = System.Drawing.Color.FromArgb(64, 158, 255);
|
||||
lpMaterialIcons.Location = new System.Drawing.Point(3, 3);
|
||||
lpMaterialIcons.Name = "lpMaterialIcons";
|
||||
lpMaterialIcons.Size = new System.Drawing.Size(886, 572);
|
||||
lpMaterialIcons.TabIndex = 3;
|
||||
//
|
||||
// tabPage7
|
||||
//
|
||||
tabPage7.Controls.Add(lblResult);
|
||||
@ -308,6 +334,10 @@
|
||||
textBox1.TabIndex = 0;
|
||||
textBox1.KeyDown += textBox1_KeyDown;
|
||||
//
|
||||
// bg6
|
||||
//
|
||||
bg6.DoWork += bg6_DoWork;
|
||||
//
|
||||
// UIFontImages
|
||||
//
|
||||
AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
@ -327,6 +357,7 @@
|
||||
tabPage4.ResumeLayout(false);
|
||||
tabPage2.ResumeLayout(false);
|
||||
tabPage3.ResumeLayout(false);
|
||||
tsMaterialIcons.ResumeLayout(false);
|
||||
tabPage7.ResumeLayout(false);
|
||||
panel1.ResumeLayout(false);
|
||||
panel1.PerformLayout();
|
||||
@ -362,5 +393,36 @@
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.TabPage tabPage7;
|
||||
private System.Windows.Forms.FlowLayoutPanel lblResult;
|
||||
|
||||
/* 项目“SunnyUI (net472)”的未合并的更改
|
||||
在此之前:
|
||||
private System.Windows.Forms.TabPage lpMaterialIcons;
|
||||
在此之后:
|
||||
private System.Windows.Forms.TabPage tsMaterialIcons;
|
||||
*/
|
||||
|
||||
/* 项目“SunnyUI (net40)”的未合并的更改
|
||||
在此之前:
|
||||
private System.Windows.Forms.TabPage lpMaterialIcons;
|
||||
在此之后:
|
||||
private System.Windows.Forms.TabPage tsMaterialIcons;
|
||||
*/
|
||||
|
||||
/* 项目“SunnyUI (net7.0-windows)”的未合并的更改
|
||||
在此之前:
|
||||
private System.Windows.Forms.TabPage lpMaterialIcons;
|
||||
在此之后:
|
||||
private System.Windows.Forms.TabPage tsMaterialIcons;
|
||||
*/
|
||||
|
||||
/* 项目“SunnyUI (net6.0-windows)”的未合并的更改
|
||||
在此之前:
|
||||
private System.Windows.Forms.TabPage lpMaterialIcons;
|
||||
在此之后:
|
||||
private System.Windows.Forms.TabPage tsMaterialIcons;
|
||||
*/
|
||||
private System.Windows.Forms.TabPage tsMaterialIcons;
|
||||
private System.Windows.Forms.FlowLayoutPanel lpMaterialIcons;
|
||||
private System.ComponentModel.BackgroundWorker bg6;
|
||||
}
|
||||
}
|
@ -1,4 +1,64 @@
|
||||
<root>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
@ -76,6 +136,9 @@
|
||||
<value>234, 17</value>
|
||||
</metadata>
|
||||
<metadata name="bg5.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>309, 17</value>
|
||||
<value>644, 26</value>
|
||||
</metadata>
|
||||
<metadata name="bg6.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>772, 17</value>
|
||||
</metadata>
|
||||
</root>
|
File diff suppressed because it is too large
Load Diff
@ -40,6 +40,7 @@
|
||||
<ItemGroup>
|
||||
<None Remove="Common\FastLZx64.dat" />
|
||||
<None Remove="Common\FastLZx86.dat" />
|
||||
<None Remove="Font\MaterialIcons-Regular.ttf" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -62,6 +63,7 @@
|
||||
<EmbeddedResource Include="Font\fa-regular-400.ttf" />
|
||||
<EmbeddedResource Include="Font\fa-solid-900.ttf" />
|
||||
<EmbeddedResource Include="Font\FontAwesome.ttf" />
|
||||
<EmbeddedResource Include="Font\MaterialIcons-Regular.ttf" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net40'">
|
||||
|
Loading…
x
Reference in New Issue
Block a user