{"id":5447,"date":"2018-10-25T00:07:47","date_gmt":"2018-10-24T15:07:47","guid":{"rendered":"https:\/\/elleneast.com\/?p=5447"},"modified":"2018-10-27T23:12:40","modified_gmt":"2018-10-27T14:12:40","slug":"%e3%80%90vb-net%e3%80%91%e3%80%90wpf%e3%80%91%e3%82%b7%e3%82%b9%e3%83%86%e3%83%a0%e3%83%95%e3%82%a9%e3%83%b3%e3%83%88%e3%81%ae%e4%b8%80%e8%a6%a7%e3%82%92%e8%a1%a8%e7%a4%ba%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/elleneast.com\/?p=5447","title":{"rendered":"\u3010VB.NET\u3011\u3010WPF\u3011\u30b7\u30b9\u30c6\u30e0\u30d5\u30a9\u30f3\u30c8\u306e\u4e00\u89a7\u3092\u8868\u793a\u3059\u308b"},"content":{"rendered":"<p>\u4e0b\u56f3\u306e\u3088\u3046\u306a\u30b7\u30b9\u30c6\u30e0\u30d5\u30a9\u30f3\u30c8\u306e\u4e00\u89a7\u3092\u8868\u793a\u3057\u307e\u3059\u3002\uff08\u5de6\u30da\u30a4\u30f3\u3067\u9078\u629e\u3057\u305f\u30d5\u30a9\u30f3\u30c8\u3092\u53f3\u30da\u30a4\u30f3\u306e\u30c6\u30ad\u30b9\u30c8\u306b\u9069\u7528\u3057\u3066\u3044\u308b\u3068\u3053\u308d\uff09<\/p>\n<p><a href=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/fontsList.png\"><img loading=\"lazy\" decoding=\"async\" class=\"bigshadow alignnone wp-image-5449 size-full\" src=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/fontsList.png\" alt=\"VB.NET WPF \u30b7\u30b9\u30c6\u30e0\u30d5\u30a9\u30f3\u30c8\u306e\u4e00\u89a7\" width=\"783\" height=\"436\" srcset=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/fontsList.png 783w, https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/fontsList-300x167.png 300w, https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/fontsList-768x428.png 768w\" sizes=\"auto, (max-width: 783px) 100vw, 783px\"><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>XAML\uff08\u7279\u306b\u6ce8\u610f\u3057\u3066\u6b32\u3057\u3044\u3068\u3053\u308d\u3092\u30cf\u30a4\u30e9\u30a4\u30c8\u3057\u305f\uff09<\/p>\n<pre class=\"lang:xhtml mark:11-12,23-28 decode:true \">&lt;Window x:Class=\"MainWindow\"\nxmlns=\"http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\/presentation\"\nxmlns:x=\"http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\"\nxmlns:d=\"http:\/\/schemas.microsoft.com\/expression\/blend\/2008\"\nxmlns:mc=\"http:\/\/schemas.openxmlformats.org\/markup-compatibility\/2006\"\nxmlns:local=\"clr-namespace:WpfApp1\"\nmc:Ignorable=\"d\"\nTitle=\"MainWindow\" Height=\"450\" Width=\"800\"&gt;\n\n&lt;Window.Resources&gt;\n    &lt;local:FontFamilyTitleConverter x:Key=\"FontFamilyTitleConverter_Key\" \/&gt;\n    &lt;local:FontFamilyNameConverter x:Key=\"FontFamilyNameConverter_Key\" \/&gt;\n&lt;\/Window.Resources&gt;\n\n&lt;Grid&gt;\n    &lt;Grid.ColumnDefinitions&gt;\n        &lt;ColumnDefinition Width=\"5*\" \/&gt;\n        &lt;ColumnDefinition Width=\"5*\" \/&gt;\n    &lt;\/Grid.ColumnDefinitions&gt;\n\n    &lt;UniformGrid Grid.Column=\"0\"&gt;\n        &lt;ListBox Name=\"fontsList\" Margin=\"0,0,0,0\"&gt;\n            &lt;ListBox.ItemTemplate&gt;\n            &lt;DataTemplate&gt;\n                &lt;TextBlock FontFamily=\"{Binding Converter={StaticResource FontFamilyNameConverter_Key}, Mode=OneWay}\" FontSize=\"16\"\n                    Text=\"{Binding Converter={StaticResource FontFamilyTitleConverter_Key}, Mode=OneWay}\" \/&gt;\n            &lt;\/DataTemplate&gt;\n            &lt;\/ListBox.ItemTemplate&gt;\n        &lt;\/ListBox&gt;\n    &lt;\/UniformGrid&gt;\n\n    &lt;UniformGrid Grid.Column=\"1\"&gt;\n        &lt;TextBox Name=\"textbox1\" Margin=\"0,0,0,0\" Text=\"\" FontSize=\"29\" TextWrapping=\"Wrap\" \/&gt;\n    &lt;\/UniformGrid&gt;\n&lt;\/Grid&gt;\n\n&lt;\/Window&gt;<\/pre>\n<p>&nbsp;<\/p>\n<p>\u30b3\u30fc\u30c9<\/p>\n<pre class=\"lang:vbnet decode:true \">Class MainWindow\n\nPrivate Sub MainWindow_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded\n\nMe.Language = System.Windows.Markup.XmlLanguage.GetLanguage(system.Threading.Thread.CurrentThread.CurrentCulture.Name) '\u8a00\u8a9e\u3092\u8a2d\u5b9a\n\nMe.fontsList.ItemsSource = Fonts.SystemFontFamilies.OrderBy(Function(n) n.Source) '\u30b7\u30b9\u30c6\u30e0\u30d5\u30a9\u30f3\u30c8\u3092\u30bd\u30fc\u30c8\u3057\u3066\u8a2d\u5b9a\n\nMe.textbox1.Text = \"\u30a8\u30ec\u30f3\u30fb\u30a4\u30fc\u30b9\u30c8\u306e\u30d6\u30ed\u30b0\u3092\u4eca\u5f8c\u3068\u3082\u3088\u308d\u3057\u304f\u304a\u9858\u3044\u3044\u305f\u3057\u307e\u3059\u3002\" &amp; vbCrLf &amp; vbCrLf &amp; _\n    \"Thank you very much! See you!\" &amp; vbCrLf &amp; vbCrLf &amp; \"https:\/\/elleneast.com\"\n\nEnd Sub\n\n\n\nPrivate Sub fontsList_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles fontsList.SelectionChanged\n\nDim l As ListBox = CType(sender, ListBox)\n\nMe.textbox1.FontFamily = l.SelectedItem\n\nEnd Sub\n\nEnd Class\n\n\n\n'\u73fe\u5728\u306e\u8a00\u8a9e\u306e\u30d5\u30a9\u30f3\u30c8\u540d\u3092\u8fd4\u3059\uff08\u30ea\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u306e\u30bf\u30a4\u30c8\u30eb\u306e\u30c6\u30ad\u30b9\u30c8\uff09\nFriend Class FontFamilyTitleConverter\n    Implements IValueConverter\n\nPrivate Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object _\n    Implements IValueConverter.Convert\n\nDim oFontFamily As FontFamily = value\nDim oLanguage = System.Windows.Markup.XmlLanguage.GetLanguage(culture.IetfLanguageTag) ' _Loaded \u3067\u8a2d\u5b9a\u3057\u305f\u8a00\u8a9e\u306e\u30d5\u30a9\u30f3\u30c8\u540d\u3092\u8fd4\u3059\u5834\u5408\n\nFor Each oFamilyNameKeyValue In oFontFamily.FamilyNames\n    If oFamilyNameKeyValue.Key is oLanguage Then '.Key.ToString --&gt; en-us, ja-jp \u306a\u3069\u3002\n        Return oFamilyNameKeyValue.Value '.Value --&gt; \uff2d\uff33 \u660e\u671d\u3001Arial \u306a\u3069\u3002\u30d5\u30a9\u30f3\u30c8\u306e\u540d\u524d\u3002\n    End If\nNext\n\nReturn oFontFamily.Source\n\nEnd Function\n\n\n\nPrivate Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object _\n    Implements IValueConverter.ConvertBack\n\nThrow New NotImplementedException()\n\nEnd Function\n\nEnd Class\n\n\n\n'\u30ea\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u306e\u30d5\u30a9\u30f3\u30c8\u30bf\u30a4\u30c8\u30eb\u306b\u9069\u7528\u3059\u308b\u30d5\u30a9\u30f3\u30c8\u540d\u3002\u30b7\u30f3\u30dc\u30eb\u7528\u306e\u30d5\u30a9\u30f3\u30c8\u306e\u5834\u5408\u306f Courier \u3092\u8fd4\u3059\uff08\u30ea\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u306e\u30d5\u30a9\u30f3\u30c8\u30bf\u30a4\u30c8\u30eb\u304c\u5316\u3051\u308b\u306e\u3067\uff09\u3002\u305d\u308c\u4ee5\u5916\u306f\u305d\u306e\u307e\u307e\u30d5\u30a9\u30f3\u30c8\u30d5\u30a1\u30df\u30ea\u30fc\u540d\u3092\u8fd4\u3059\u3002\nFriend Class FontFamilyNameConverter\n    Implements IValueConverter\n\nPrivate Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object _\n    Implements IValueConverter.Convert\n\nDim oFontFamily As FontFamily = value\n\nIf IsSymbolFont(oFontFamily) = True Then\n    Return \"Courier\"\nElse\n    Return oFontFamily.Source\nEnd If\n\nEnd Function\n\n\n\nPrivate Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object _\n    Implements IValueConverter.ConvertBack\n\nThrow New NotImplementedException()\n\nEnd Function\n\n\n\n'\u30b7\u30f3\u30dc\u30eb\u7528\u306e\u30d5\u30a9\u30f3\u30c8\u304b\uff1f\nPrivate Function IsSymbolFont(fontFamily As FontFamily) As Boolean\n\nDim oGlyphTypeface As GlyphTypeface = GetFirstTypeface(fontFamily)\n\nIf oGlyphTypeface Is Nothing Then\n    Return False\nElse\n    Return oGlyphTypeface.Symbol\nEnd If\n\nEnd Function\n\n\n\n'\u30d5\u30a9\u30f3\u30c8\u30d5\u30a1\u30df\u30ea\u30fc\u306e\u6700\u521d\u306e\u30b0\u30ea\u30d5\u30bf\u30a4\u30d7\u30d5\u30a7\u30a4\u30b9\u3092\u8fd4\u3059\nPrivate Function GetFirstTypeface(fontFamily As FontFamily) As GlyphTypeface\n\nDim oFirstTypeface As Typeface = FontFamily.GetTypefaces().First()\n\nDim oGlyphTypeface As GlyphTypeface = Nothing\n\noFirstTypeface.TryGetGlyphTypeface(oGlyphTypeface)\n\nReturn oGlyphTypeface\n\nEnd Function\n\nEnd Class\n\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u30b7\u30b9\u30c6\u30e0\u30d5\u30a9\u30f3\u30c8\u30ea\u30b9\u30c8\u306e\u4e00\u89a7\u3092\u6700\u3082\u7c21\u5358\u306b\u5b9f\u73fe\u3057\u305f\u3051\u308c\u3070<\/p>\n<p>Me.fontsList.ItemsSource = Fonts.SystemFontFamilies<\/p>\n<p>\u307f\u305f\u3044\u306b\u3059\u308c\u3070\u826f\u3044\u601d\u3046\u304c\u3001\u305d\u308c\u3060\u3068\u30d5\u30a9\u30f3\u30c8\u306e\u30bf\u30a4\u30c8\u30eb\u304c\u82f1\u8a9e\u540d\u3067\u8868\u793a\u3055\u308c\u3066\u3057\u307e\u3046\u3002\u5404\u30d5\u30a9\u30f3\u30c8\u306e\u30bf\u30a4\u30c8\u30eb\u3082\u5168\u90e8\u540c\u3058\u30d5\u30a9\u30f3\u30c8\u3067\u8868\u793a\u3055\u308c\u3066\u3057\u307e\u3046\u3002\u8868\u793a\u9806\u3082\u306a\u3093\u304b\u30d0\u30e9\u30d0\u30e9\u3002<\/p>\n<p>\u306a\u306e\u3067\u3001<\/p>\n<ul>\n<li>\u30d5\u30a9\u30f3\u30c8\u306e\u30bf\u30a4\u30c8\u30eb\u3092\u305d\u306e\u30b7\u30b9\u30c6\u30e0\u306e\u8a00\u8a9e\u540d\u3067\u8868\u793a\u3057\u3066\u3001<\/li>\n<li>\u30d5\u30a9\u30f3\u30c8\u306e\u30bf\u30a4\u30c8\u30eb\u306b\u305d\u306e\u30d5\u30a9\u30f3\u30c8\u3092\u9069\u7528\u3057\u3066\u3001<\/li>\n<li>\u30b7\u30f3\u30dc\u30eb\u30d5\u30a9\u30f3\u30c8\u306e\u30bf\u30a4\u30c8\u30eb\u304c\u5316\u3051\u306a\u3044\u3088\u3046\u306b\u3057\u3066\u3001<\/li>\n<li>\u30bd\u30fc\u30c8\u3057\u3066<\/li>\n<\/ul>\n<p>\u8868\u793a\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u307f\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e0b\u56f3\u306e\u3088\u3046\u306a\u30b7\u30b9\u30c6\u30e0\u30d5\u30a9\u30f3\u30c8\u306e\u4e00\u89a7\u3092\u8868\u793a\u3057\u307e\u3059\u3002\uff08\u5de6\u30da\u30a4\u30f3\u3067\u9078\u629e\u3057\u305f\u30d5\u30a9\u30f3\u30c8\u3092\u53f3\u30da\u30a4\u30f3\u306e\u30c6\u30ad\u30b9\u30c8\u306b\u9069\u7528\u3057\u3066\u3044\u308b\u3068\u3053\u308d\uff09 &nbsp; XAML\uff08\u7279\u306b\u6ce8\u610f\u3057\u3066\u6b32\u3057\u3044\u3068\u3053\u308d\u3092\u30cf\u30a4\u30e9\u30a4\u30c8\u3057\u305f\uff09 &lt;Window x:Cla &#8230; <\/p>\n","protected":false},"author":1,"featured_media":2656,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[57],"tags":[60,62],"class_list":{"0":"post-5447","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-57","8":"tag-vb-net","9":"tag-wpf"},"_links":{"self":[{"href":"https:\/\/elleneast.com\/index.php?rest_route=\/wp\/v2\/posts\/5447","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/elleneast.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elleneast.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elleneast.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/elleneast.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5447"}],"version-history":[{"count":3,"href":"https:\/\/elleneast.com\/index.php?rest_route=\/wp\/v2\/posts\/5447\/revisions"}],"predecessor-version":[{"id":5694,"href":"https:\/\/elleneast.com\/index.php?rest_route=\/wp\/v2\/posts\/5447\/revisions\/5694"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/elleneast.com\/index.php?rest_route=\/wp\/v2\/media\/2656"}],"wp:attachment":[{"href":"https:\/\/elleneast.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5447"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elleneast.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5447"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elleneast.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5447"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}