本文整理汇总了C#中System.Windows.Media.ImageSource.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ImageSource.ToString方法的具体用法?C# ImageSource.ToString怎么用?C# ImageSource.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.ImageSource
的用法示例。
在下文中一共展示了ImageSource.ToString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetIconFromImageSource
private static void SetIconFromImageSource(TaskbarIcon taskbarIcon, ImageSource imageSource)
{
// Copied from Hardcodet.Wpf.TaskbarNotification.Util.ToIcon
Icon icon = null;
if (imageSource != null)
{
Uri uri = new Uri(imageSource.ToString());
StreamResourceInfo streamInfo = Application.GetResourceStream(uri);
if (streamInfo == null)
{
string msg = "The supplied image source '{0}' could not be resolved.";
msg = String.Format(msg, imageSource);
throw new ArgumentException(msg);
}
icon = new Icon(streamInfo.Stream, idealIconSize, idealIconSize);
}
taskbarIcon.Icon = icon;
}
示例2: FromImageSource
private static Drawing.Icon FromImageSource(ImageSource icon)
{
if (icon == null)
{
return null;
}
Uri iconUri = new Uri(icon.ToString());
return new Drawing.Icon(Application.GetContentStream(iconUri).Stream);
}
示例3: draw_sprite
////////////////////////////////////////////////////////////////////////////////
// draw a bitmap on a canvas from a file name
public void draw_sprite(Canvas canvas, ImageSource image_file, int x, int y)
{
Image image = new Image
{
Source = new BitmapImage (new Uri (image_file.ToString ())),
};
canvas.Children.Add (image);
Canvas.SetLeft (image, x);
Canvas.SetTop (image, y);
}
示例4: FromImageSource
private static Icon FromImageSource(ImageSource icon)
{
if (icon == null)
{
return null;
}
var iconUri = new Uri(icon.ToString());
return new Icon("." + iconUri.LocalPath);
}
示例5: FromImageSource
System.Drawing.Icon FromImageSource(ImageSource icon)
{
if (icon == null)
{
return null;
}
Uri iconUri = new Uri(icon.ToString());
return new System.Drawing.Icon(Application.GetResourceStream(iconUri).Stream);
}
示例6: FromImageSource
private static Icon FromImageSource(ImageSource icon)
{
if (icon == null)
{
return null;
}
Uri iconUri = new Uri(icon.ToString());
return new Icon(Application.GetResourceStream(iconUri).Stream);
}