imagesource

WPF - converting Bitmap to ImageSource

前提是你 提交于 2019-11-28 23:18:50
问题 I need to convert a System.Drawing.Bitmap into System.Windows.Media.ImageSource class in order to bind it into a HeaderImage control of a WizardPage (Extended WPF toolkit). The bitmap is set as a resource of the assembly I write. It is being referenced like that: public Bitmap GetBitmap { get { Bitmap bitmap = new Bitmap(Resources.my_banner); return bitmap; } } public ImageSource HeaderBitmap { get { ImageSourceConverter c = new ImageSourceConverter(); return (ImageSource) c.ConvertFrom

WPF Binding Image Source

南笙酒味 提交于 2019-11-28 14:34:36
maybe stupid question, but I don't know anymore... I have ViewModel class like this: public class MainWindowsViewModel : INotifyPropertyChanged { private ImageSource _img; public ImageSource StatusImage { get { return _img; } set { _img = value; NotifyPropertyChanged(); } } public event PropertyChangedEventHandler PropertyChanged; private void NotifyPropertyChanged([CallerMemberName]String propertyName = "") { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } Binding in XAML looks like this: <Window.DataContext> <VM:MainWindowsViewModel /> <

Set image source

删除回忆录丶 提交于 2019-11-28 12:51:50
I am trying to set image source to something from my computer (not in the assets). This is how I am trying to do this: Uri uri = new Uri(@"D:\Riot Games\about.png", UriKind.Absolute); ImageSource imgSource = new BitmapImage(uri); this.image1.Source = imgSource; I tried almost everything I could find in the internet but nothing seem to work. Any idea why? XAML: <UserControl x:Class="App11.VideoPreview" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:App11" xmlns:d="http://schemas.microsoft.com/expression

Loading images source dynamically with IValueConverter

本小妞迷上赌 提交于 2019-11-28 09:22:12
问题 I've problems with IValueconverter and dynamically load a row grid image: public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string Type = (string)value; Uri uri; try { uri = new Uri("/XConsole;component/Images/" + Type + ".png", UriKind.Relative); return new System.Windows.Media.Imaging.BitmapImage(uri) { CacheOption = BitmapCacheOption.None }; } catch (Exception e) { //donothing } uri = new Uri("/XConsole;component/Images/Type

Get an image through jQuery AJAX

六眼飞鱼酱① 提交于 2019-11-28 07:23:14
问题 The following image tag is in my Login Page <img id="CaptchaImg" alt="Captcha" src="@url.action("Captcha","Login")" style="" /> Now when I refresh my login Page, it works fine, and gets the image from the controller, but when I logOut and the login Page renders .the controller method is not being called.Problem is only in IE works fine on Chrome.Is there are work around? Can I do something with jQuery Ajax call to the controller, I tried this but the success method is not called. Is there any

@media queries and image swapping

喜你入骨 提交于 2019-11-27 12:28:47
I'm new to CSS and to this forum. But I've been working on a little project where I want the image in my site to completely change when the browser is resized. I've been using media-queries? but I can't seem to get it right. any thoughts/tips? In the future please add code you've tried. if it's an image tag you can use a class. Hide the second image on page load and show + hide image 1 at a certain screen size like so: HTML <img src="image.jpg" class="image1"/> <img src="image.jpg" class="image2"/> CSS .image2{ display: none; } @media only screen and (max-width: 500px){ //some value .image1{

WPF Binding Image Source

梦想与她 提交于 2019-11-27 08:29:01
问题 maybe stupid question, but I don't know anymore... I have ViewModel class like this: public class MainWindowsViewModel : INotifyPropertyChanged { private ImageSource _img; public ImageSource StatusImage { get { return _img; } set { _img = value; NotifyPropertyChanged(); } } public event PropertyChangedEventHandler PropertyChanged; private void NotifyPropertyChanged([CallerMemberName]String propertyName = "") { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs

Python Scrapy: Convert relative paths to absolute paths

余生颓废 提交于 2019-11-27 07:51:42
I have amended the code based on solutions offered below by the great folks here; I get the error shown below the code here. from scrapy.spider import BaseSpider from scrapy.selector import HtmlXPathSelector from scrapy.utils.response import get_base_url from scrapy.utils.url import urljoin_rfc from dmoz2.items import DmozItem class DmozSpider(BaseSpider): name = "namastecopy2" allowed_domains = ["namastefoods.com"] start_urls = [ "http://www.namastefoods.com/products/cgi-bin/products.cgi?Function=show&Category_Id=4&Id=1", "http://www.namastefoods.com/products/cgi-bin/products.cgi?Function

Set image source

懵懂的女人 提交于 2019-11-27 07:17:51
问题 I am trying to set image source to something from my computer (not in the assets). This is how I am trying to do this: Uri uri = new Uri(@"D:\Riot Games\about.png", UriKind.Absolute); ImageSource imgSource = new BitmapImage(uri); this.image1.Source = imgSource; I tried almost everything I could find in the internet but nothing seem to work. Any idea why? XAML: <UserControl x:Class="App11.VideoPreview" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas

Embedding resources (images, sound bits, etc) into a Java project then use those resources

你说的曾经没有我的故事 提交于 2019-11-27 07:06:05
I have searched for a method of embedding a resource in a java project (using Eclipse v3.6.0) then using that embedded resource within a control (e.g., JLabel ). I have seen methods of referencing resources from the file system. Once the project has been developed I would like to publish the application as an executable. It should be noted these executables will be deployed/launched to Windows, *NIX, and Linux platforms. I know this can be done in the Visual Studio world, but I'm very unfamiliar how to do this in Java/Eclipse IDE. As a side question, how do I get Eclipse to create the project