private Brush GetIcon(string path) { System.Drawing.Bitmap x = ShellEx.GetBitmapFromFilePath(path, ShellEx.IconSizeEnum.ExtraLargeIcon); var btSource = Imaging.CreateBitmapSourceFromHBitmap(x.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions()); return(new ImageBrush(btSource)); }
public override void VisitShellEx(ShellEx x) { ConsumeToken(Tokens.T_BACKQUOTE, x.Span.Start); // content ConsumeToken(Tokens.T_BACKQUOTE, x.Span.End - 1); throw new NotImplementedException(); }
private void GetDrawingstodisplay() { if (Directory.Exists(rlog.Path)) { foreach (string item in Directory.GetFiles(rlog.Path).Where(str => !str.Contains(@"\~$")).OrderByDescending(fi => fi)) { try { string sDocFileName = item; wpfThumbnailCreator pvf = new wpfThumbnailCreator { DesiredSize = new Size { Width = 256, Height = 256 } }; System.Drawing.Bitmap pic = pvf.GetThumbNail(sDocFileName); imageList2.Images.Add(pic); } catch (Exception) { const ShellEx.IconSizeEnum size = ShellEx.IconSizeEnum.ExtraLargeIcon; imageList2.Images.Add(ShellEx.GetBitmapFromFilePath(item, size)); } FileInfo fi = new FileInfo(item); listFilesDrawings.Add(fi.FullName); listView1.Items.Add(fi.Name, imageList2.Images.Count - 1); } } }
/// <summary> /// Method to convert string path of the picture into bitmap image. /// </summary> /// <param name="value">The binding object path of the picture.</param> /// <param name="targetType">The target type for binding.</param> /// <param name="parameter">Parameter for convert.</param> /// <param name="culture">The culture to convert.</param> /// <returns>A bitmap image for image binding.</returns> public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { // The value parameter is the data from the source object. string filename = (string)value; string ext = Path.GetExtension(filename); BitmapImage bmp = null; try { if (Extensions.Contains(ext.ToLower())) { if (parameter != null) { Width = int.Parse((string)parameter); } bmp = PictureMemoryCache.Set(filename, Width, false); } else { bmp = ShellEx.GetBitmapFromFilePath(filename, IconSize).ToBitmapImage(); } } catch (Exception e) { log.Debug(e.Output(), e); } return(bmp); }
public static Icon GetIcon(string fileName) { try { Icon icon = Icon.ExtractAssociatedIcon(fileName); ShellEx.IconSizeEnum ExtraLargeIcon = default(ShellEx.IconSizeEnum); var size = (ShellEx.IconSizeEnum)ExtraLargeIcon; ShellEx.GetBitmapFromFilePath(fileName, size); return(icon); } catch { try { Icon icon2 = GetIconOldSchool(fileName); return(icon2); } catch { return(null); } } }
private void getitemstodisplay(string Pathpart, string ItemNo) { if (Directory.Exists(Pathpart)) { foreach (string item in Directory.GetFiles(Pathpart, "*" + ItemNo.ToString() + "*").Where(str => !str.Contains(@"\~$")).OrderByDescending(fi => fi)) { try { string sDocFileName = item; wpfThumbnailCreator pvf; pvf = new wpfThumbnailCreator(); System.Drawing.Size size = new Size { Width = 256, Height = 256 }; pvf.DesiredSize = size; System.Drawing.Bitmap pic = pvf.GetThumbNail(sDocFileName); imageList.Images.Add(pic); //axEModelViewControl1 = new EModelViewControl(); //axEModelViewControl1.OpenDoc(item, false, false, true, ""); } catch (Exception) { //MessageBox.Show(ex.Message); var size = ShellEx.IconSizeEnum.ExtraLargeIcon; imageList.Images.Add(ShellEx.GetBitmapFromFilePath(item, size)); // imageList.Images.Add(GetIcon(item)); } // imageList.Images.Add(GetIcon(item)); FileInfo fi = new FileInfo(item); listFiles.Add(fi.FullName); listView.Items.Add(fi.Name, imageList.Images.Count - 1); } } }
/// <summary> /// Visit shell command expression. /// </summary> /// <param name="x"></param> virtual public void VisitShellEx(ShellEx x) { VisitElement(x.Command); }
override public void VisitShellEx(ShellEx x) { _serializer.StartSerialize(typeof(ShellEx).Name, SerializeSpan(x.Span)); base.VisitShellEx(x); _serializer.EndSerialize(); }
/// <summary> /// Method to convert string path of the file into bitmap image. /// </summary> /// <param name="value">The binding object path of the picture.</param> /// <param name="targetType">The target type for binding.</param> /// <param name="parameter">Parameter for convert.</param> /// <param name="culture">The culture to convert.</param> /// <returns>A bitmap image for image binding.</returns> public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var size = ShellEx.IconSizeEnum.ExtraLargeIcon; return(ShellEx.GetBitmapFromFilePath((string)value, size).ToBitmapImage()); }
private PegPattern BuildGuess() { return(ShellEx.PromptPegPattern("Guess the secret code", Options)); }
/// <inheritdoc /> override public void VisitShellEx(ShellEx x) { VisitElement(x.Command); result = new ShellEx(x.Position, (Expression)result); }