本文整理汇总了C#中ImageSource类的典型用法代码示例。如果您正苦于以下问题:C# ImageSource类的具体用法?C# ImageSource怎么用?C# ImageSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImageSource类属于命名空间,在下文中一共展示了ImageSource类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
});
});
}
开发者ID:ysjr-2002,项目名称:QuickDoor,代码行数:31,代码来源:CompareResultWindow.xaml.cs
示例2: SetCover
private void SetCover(ImageSource img)
{
Dispatcher.BeginInvoke(new Action(delegate
{
Cover.Source = img;
}));
}
开发者ID:Balthizar01,项目名称:Mango,代码行数:7,代码来源:MangaBox.xaml.cs
示例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;
}
开发者ID:netintellect,项目名称:PluralsightSpaJumpStartFinal,代码行数:28,代码来源:ExampleViewModel.cs
示例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;
}
开发者ID:gAdrev,项目名称:monodevelop,代码行数:26,代码来源:SearchBar.xaml.cs
示例5: ShowImageSource
public void ShowImageSource(ImageSource source)
{
this.videoImage.Dispatcher.Invoke(new Action(() =>
{
this.videoImage.Source = source;
}));
}
开发者ID:aabrohi,项目名称:kinect-kollage,代码行数:7,代码来源:WpfVideoControl.xaml.cs
示例6: ImagePackage
public ImagePackage(IImageDecoder decoder, ImageSource source, double width, double height)
{
this.Decoder = decoder;
this.ImageSource = source;
this.PixelWidth = width;
this.PixelHeight = height;
}
开发者ID:chenrensong,项目名称:ImageLib.UWP,代码行数:7,代码来源:ImagePackage.cs
示例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;
}
}
开发者ID:naturenet,项目名称:nature-net-ppi,代码行数:30,代码来源:image_frame.xaml.cs
示例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;
}
}
开发者ID:andrey-kozyrev,项目名称:LinguaSpace,代码行数:33,代码来源:GreyImage.cs
示例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);
}
开发者ID:Gulpener,项目名称:MediaSyncControl,代码行数:26,代码来源:MediaPlayerControl.xaml.cs
示例10: NumericControl
public NumericControl(Func<string, Task> sendCommandAction, ImageSource signalIcon, DataType type)
{
SendCommandAction = sendCommandAction;
Type = type;
InitializeComponent();
SignalImg.Source = signalIcon;
}
开发者ID:m19brandon,项目名称:zVirtualScenes,代码行数:7,代码来源:NumericControl.xaml.cs
示例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;
}
开发者ID:Karthikeyan-kkk,项目名称:whatsapp-shower,代码行数:28,代码来源:ImgView.xaml.cs
示例12: imageSource_NewDataAvailable
void imageSource_NewDataAvailable(ImageSource data)
{
this.videoControl.Dispatcher.BeginInvoke(new Action(() =>
{
this.videoControl.ShowImageSource(data);
}));
}
开发者ID:an83,项目名称:KinectTouch2,代码行数:7,代码来源:DisplayControl.xaml.cs
示例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();
}
}
开发者ID:WiredUK,项目名称:Mvc.Placeholders,代码行数:28,代码来源:ImageHelpers.cs
示例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;
}
开发者ID:noedelarosa,项目名称:SIC,代码行数:7,代码来源:Dial_ViewImagen.xaml.cs
示例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;
}
开发者ID:jfelts1,项目名称:SoftwareEngineering,代码行数:10,代码来源:ImageToggle.cs
示例16: SetImageBrush
public static void SetImageBrush(ImageBrush brush, ImageSource imageSource)
{
if (brush == null)
return;
brush.ImageSource = imageSource;
}
开发者ID:sheeeng,项目名称:wolwp,代码行数:7,代码来源:ButtonBaseHelper.cs
示例17: SaveDrawingImage
private static MemoryStream SaveDrawingImage(ImageSource drawingImage)
{
var image = new Image
{
Source = drawingImage
};
image.Arrange(new Rect(0, 0, drawingImage.Width, drawingImage.Height));
var settings = Settings.Default;
var renderTargetBitmap = new RenderTargetBitmap((int)drawingImage.Width, (int)drawingImage.Height, settings.ImageDPI, settings.ImageDPI, PixelFormats.Default);
renderTargetBitmap.Render(image);
Settings.Default.Save();
var encoder = new JpegBitmapEncoder
{
QualityLevel = settings.JpgQuality
};
encoder.Frames.Add(BitmapFrame.Create(renderTargetBitmap));
var memoryStream = new MemoryStream();
encoder.Save(memoryStream);
return memoryStream;
}
开发者ID:Jo3-16,项目名称:FMA,代码行数:29,代码来源:FlyerCreator.cs
示例18: PhotoThread
public PhotoThread( ImageSource src, DateTime dateTime )
{
InitializeComponent ();
Content = src;
Date = dateTime;
}
开发者ID:Daramkun,项目名称:MemoThread,代码行数:7,代码来源:PhotoThread.xaml.cs
示例19: ChangeSource
/// <summary>
/// Change cette image avec une transition en fondu
/// </summary>
/// <param name="image">L'image à modifier</param>
/// <param name="source">La source de la prochaine image</param>
/// <param name="beginTime">Le délai en seconde après lequel la transition commence</param>
/// <param name="fadeTime">Le durée de la transition</param>
public static void ChangeSource(this Image image, ImageSource source, double beginTime, double fadeTime)
{
var fadeInAnimation = new DoubleAnimation
{
To = 1,
BeginTime = TimeSpan.FromSeconds(fadeTime),
Duration = TimeSpan.FromSeconds(beginTime)
};
if (image.Source != null)
{
var fadeOutAnimation = new DoubleAnimation
{
To = 0,
BeginTime = TimeSpan.FromSeconds(0.05),
Duration = TimeSpan.FromSeconds(fadeTime)
};
fadeOutAnimation.Completed += (o, e) =>
{
image.Source = source;
image.BeginAnimation(Image.OpacityProperty, fadeInAnimation);
};
image.BeginAnimation(Image.OpacityProperty, fadeOutAnimation);
}
else
{
image.Opacity = 0d;
image.Source = source;
image.BeginAnimation(Image.OpacityProperty, fadeInAnimation);
}
}
开发者ID:Tks-Dev,项目名称:AnimeManager,代码行数:40,代码来源:Helper.cs
示例20: OnDisplayFullImage
/// <summary>
/// Overlay the full screen view of the image
/// </summary>
private void OnDisplayFullImage(object sender, RoutedEventArgs e)
{
// Always go to normal state before a transition
this.SelectedImage = ((ContentControl)e.OriginalSource).Content as ImageSource;
VisualStateManager.GoToElementState(OverlayGrid, NormalState, false);
VisualStateManager.GoToElementState(OverlayGrid, FadeInTransitionState, false);
}
开发者ID:flyfj,项目名称:KinectStudio,代码行数:10,代码来源:ArticleView.xaml.cs
注:本文中的ImageSource类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论