zoukankan      html  css  js  c++  java
  • FileToVisualConverter

        public class StringToVisualConverter : IValueConverter
        {
            #region IValueConverter 成員
    
            public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                if (null != value)
                {
                    string str_ExePath = value.ToString();
                    if (!System.IO.File.Exists(str_ExePath)) return null;
    
                    System.Drawing.Icon icon = System.Drawing.Icon.ExtractAssociatedIcon(str_ExePath);
                    return System.Windows.Interop.Imaging.CreateBitmapSourceFromHIcon(
                                icon.Handle,
                                new Int32Rect(0, 0, icon.Width, icon.Height),
                                System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
                }
                return null;
            }
    
            public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                throw new NotImplementedException();
            }
    
            #endregion
        }
  • 相关阅读:
    POJ3297+map字符串处理
    POJ3204+DInic+maxflow
    HDU4704+费马小定理
    FZU-1924+判断环/DFS/BFS
    FZU-1921+线段树
    FZU-1926+KMP
    CodeForce 339:A+B+C
    HDU2896+AC自动机
    POJ2527+多项式除法
    鼠标移入移出事件
  • 原文地址:https://www.cnblogs.com/RedSky/p/10156978.html
Copyright © 2011-2022 走看看