本文整理汇总了C#中ImageSource类的典型用法代码示例。如果您正苦于以下问题:C# ImageSource类的具体用法?C# ImageSource怎么用?C# ImageSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImageSource类属于命名空间,在下文中一共展示了ImageSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompareResultWindow
public CompareResultWindow(string filePath, ImageSource avatar, string name, string compareResult, bool equal)
{
InitializeComponent();
stayTime = GetStayTime();
lblName.Content = name;
lblResult.Content = compareResult;
imgsnap.Source = filePath.FileToByte().ToImageSource();
imgAvatar.Source = avatar;
if (equal)
{
lblResult.Foreground = Brushes.Green;
imgResult.Source = new BitmapImage(new Uri(okImageSource, UriKind.Relative));
}
else
{
lblResult.Foreground = Brushes.Red;
imgResult.Source = new BitmapImage(new Uri(errorImageSource, UriKind.Relative));
}
Task.Factory.StartNew(() =>
{
Thread.Sleep(stayTime);
Application.Current.Dispatcher.Invoke(() =>
{
this.Close();
});
});
}
示例2: SetCover
private void SetCover(ImageSource img)
{
Dispatcher.BeginInvoke(new Action(delegate
{
Cover.Source = img;
}));
}
示例3: CreateDocument
public RadFixedDocument CreateDocument()
{
RadFixedDocument document = new RadFixedDocument();
RadFixedPage page = document.Pages.AddPage();
page.Size = new Size(600, 800);
this.editor = new FixedContentEditor(page);
this.editor.Position.Translate(40, 50);
using (Stream stream = FileHelper.GetSampleResourceStream("banner.png"))
{
ImageSource imageSource = new ImageSource(stream, ImageQuality.High);
editor.DrawImage(imageSource, new Size(530, 80));
}
editor.Position.Translate(ExampleDocumentSizes.DefaultLeftIndent, 160);
double maxWidth = page.Size.Width - ExampleDocumentSizes.DefaultLeftIndent * 2;
this.DrawDescription(maxWidth);
using (editor.SaveProperties())
{
using (editor.SavePosition())
{
this.DrawFunnelFigure();
}
}
return document;
}
示例4: SearchBarControl
public SearchBarControl ()
{
InitializeComponent ();
DataContext = this;
SearchBar.GotKeyboardFocus += (o, e) => {
if (searchText == placeholderText)
SearchText = string.Empty;
};
IdeApp.Workbench.RootWindow.SetFocus += (o, e) =>
{
Keyboard.ClearFocus();
IdeApp.Workbench.RootWindow.Present();
};
searchIcon = Stock.SearchboxSearch.GetImageSource (Xwt.IconSize.Small);
searchIconHovered = Xwt.Drawing.Image.FromResource (typeof(IdeApp), "searchbox-search-win-24~hover.png").WithSize (Xwt.IconSize.Small).GetImageSource ();
searchIconPressed = Xwt.Drawing.Image.FromResource (typeof(IdeApp), "searchbox-search-win-24~pressed.png").WithSize (Xwt.IconSize.Small).GetImageSource ();
clearIcon = ((MonoDevelop.Core.IconId)"md-searchbox-clear").GetImageSource (Xwt.IconSize.Small);
clearIconHovered = Xwt.Drawing.Image.FromResource (typeof(IdeApp),"searchbox-clear-win-24~hover.png").WithSize (Xwt.IconSize.Small).GetImageSource ();
clearIconPressed = Xwt.Drawing.Image.FromResource (typeof(IdeApp), "searchbox-clear-win-24~pressed.png").WithSize (Xwt.IconSize.Small).GetImageSource ();
SearchIcon.Image = searchIcon;
SearchIcon.ImageHovered = searchIconHovered;
SearchIcon.ImagePressed = searchIconPressed;
SearchIcon.Focusable = false;
}
示例5: ShowImageSource
public void ShowImageSource(ImageSource source)
{
this.videoImage.Dispatcher.Invoke(new Action(() =>
{
this.videoImage.Source = source;
}));
}
示例6: ImagePackage
public ImagePackage(IImageDecoder decoder, ImageSource source, double width, double height)
{
this.Decoder = decoder;
this.ImageSource = source;
this.PixelWidth = width;
this.PixelHeight = height;
}
示例7: load_image
public void load_image(object arg, DoWorkEventArgs e)
{
int contribution_id = (int)e.Argument;
if (!window_manager.downloaded_contributions.Contains(contribution_id))
{
naturenet_dataclassDataContext db = new naturenet_dataclassDataContext();
var result1 = from c in db.Contributions
where c.id == contribution_id
select c;
if (result1.Count() != 0)
{
Contribution contrib = result1.First<Contribution>();
bool result = file_manager.download_file_from_googledirve(contrib.media_url, contribution_id);
if (result) window_manager.downloaded_contributions.Add(contribution_id);
}
}
try
{
ImageSource src = new BitmapImage(new Uri(configurations.GetAbsoluteContributionPath() + contribution_id.ToString() + ".jpg"));
src.Freeze();
the_image = src;
//window_manager.contributions.Add(contribution_id, src);
e.Result = (object)contribution_id;
}
catch (Exception)
{
/// write log
e.Result = -1;
}
}
示例8: SetSources
/// <summary>
/// Cashes original ImageSource, creates and caches greyscale ImageSource and greyscale opacity mask
/// </summary>
private void SetSources()
{
_sourceC = Source;
try
{
// create and cache greyscale ImageSource
_sourceG = new FormatConvertedBitmap(new BitmapImage(new Uri(TypeDescriptor.GetConverter(Source).ConvertTo(Source, typeof(string)) as string)),
PixelFormats.Gray16, null, 0);
// create Opacity Mask for greyscale image as FormatConvertedBitmap does not keep transparency info
_opacityMaskG = new ImageBrush(_sourceC);
_opacityMaskG.Opacity = 0.5;
this.Source = IsEnabled ? _sourceC : _sourceG;
this.OpacityMask = IsEnabled ? _opacityMaskC : _opacityMaskG;
InvalidateProperty(IsEnabledProperty);
}
catch
{
#if DEBUG
MessageBox.Show(String.Format("The ImageSource used cannot be greyed out.\nUse BitmapImage or URI as a Source in order to allow greyscaling.\nSource type used: {0}", Source.GetType().Name),
"Unsupported Source in GreyableImage", MessageBoxButton.OK, MessageBoxImage.Warning);
#endif // DEBUG
// in case greyscale image cannot be created set greyscale source to original Source
_sourceG = Source;
}
}
示例9: MediaPlayerControl
public MediaPlayerControl()
{
InitializeComponent();
SoundOff = loadImageSource(Properties.Resources.SoundOffIcon);
SoundOn = loadImageSource(Properties.Resources.SoundOnIcon);
PlayIcon = loadImageSource(Properties.Resources.PlayIcon);
PauseIcon = loadImageSource(Properties.Resources.PauseIcon);
brushSoundOff = new ImageBrush();
brushSoundOff.ImageSource = SoundOff;//loadImageSource(Properties.Resources.SoundOffIcon);
brushSoundOn = new ImageBrush();
brushSoundOn.ImageSource = SoundOn;//loadImageSource(Properties.Resources.SoundOnIcon);
lblMuteSound.Background = brushSoundOn;
brushPlayIcon = new ImageBrush();
brushPlayIcon.ImageSource = PlayIcon;
lblPlay.Background = brushPlayIcon;
brushPauseIcon = new ImageBrush();
brushPauseIcon.ImageSource = PauseIcon;
EnableControls(false);
soundSlider.Value = soundSlider.Maximum;
SetControlFlow(0, 0, 0, 0);
}
示例10: NumericControl
public NumericControl(Func<string, Task> sendCommandAction, ImageSource signalIcon, DataType type)
{
SendCommandAction = sendCommandAction;
Type = type;
InitializeComponent();
SignalImg.Source = signalIcon;
}
示例11: ImgView
public ImgView(string phoneNumber, string nickName , ImageSource imageSource, string hour)
{
InitializeComponent();
this.PhoneNumber = phoneNumber;
this.NickName = nickName;
this.ImageSourceLink = imageSource;
this.Hour = hour;
this.imgField.Source = ImageSourceLink;
string from = PhoneNumber;
if (string.IsNullOrEmpty(nickName))
{
from = PhoneNumber;
}
else
{
from = PhoneNumber + " - " + nickName;
}
Helpers.parseEmjoi(from, this.fromfd);
this.phoneField.Foreground = NumberPropList.Instance.getPhoneColor(phoneNumber);
this.hourField.Text = Hour;
this.HorizontalAlignment = HorizontalAlignment.Left;
buildImgView(this);
this.phoneField.Width = Helpers.MeasureString(from, this.phoneField.FontFamily, this.phoneField.FontStyle, this.phoneField.FontWeight, this.phoneField.FontStretch, this.phoneField.FontSize).Width + 50;
}
示例12: imageSource_NewDataAvailable
void imageSource_NewDataAvailable(ImageSource data)
{
this.videoControl.Dispatcher.BeginInvoke(new Action(() =>
{
this.videoControl.ShowImageSource(data);
}));
}
示例13: GetGeneratorByType
private static ImageBase GetGeneratorByType(ImageSource imageSource)
{
switch (imageSource)
{
case ImageSource.FpoImg:
return new FpoImg();
case ImageSource.PlaceCage:
return new PlaceCage();
case ImageSource.FillMurray:
return new FillMurray();
case ImageSource.NiceNiceJpg:
return new NiceNiceJpg();
case ImageSource.StevenSeGallery:
return new StevenSeGallery();
case ImageSource.BaconMockup:
return new BaconMockup();
//case ImageSource.Normal:
//case ImageSource.PlaceholdIt:
default:
return new PlaceholdIt();
}
}
示例14: Dial_ViewImagen
public Dial_ViewImagen(ImageSource imagen){
InitializeComponent();
this.img_documento.Source = imagen;
this.vb_contenido.Width = imagen.Width;
this.vb_contenido.Height = imagen.Height;
}
示例15: ImageToggle
/// <summary>
/// Defaults to the off state and the image from displayedImage
/// </summary>
public ImageToggle(ImageSource otherImage, ref Image displayedImage)
{
_img1 = otherImage;
_img2 = displayedImage.Source;
_displayedImage = displayedImage;
Toggled = false;
}