public static void SetImageBrushMultiResSource(ImageBrush obj, string value) { if (obj == null) { throw new ArgumentException("obj"); } obj.SetValue(ImageLoader.ImageBrushMultiResSourceProperty, (object)value); }
private void UpdateImageBrush() { imageBrush.Viewbox = new Rect(0, 0, (double)imageWidth * pixelsPerDIPixel / (double)bufferWidth, (double)imageHeight * pixelsPerDIPixel / (double)bufferHeight); imageBrush.ViewportUnits = BrushMappingMode.RelativeToBoundingBox; imageBrush.TileMode = TileMode.None; imageBrush.Stretch = Stretch.Fill; imageBrush.SetValue(RenderOptions.BitmapScalingModeProperty, BitmapScalingMode.HighQuality); }
private void AddImage(Canvas canvas, int i) { try { ImageBrush b1 = new ImageBrush(); Uri uri = new Uri((i == 100) ? (imagepath + i.ToString() + imageending) : content[i], UriKind.Absolute); ImageSource img = new System.Windows.Media.Imaging.BitmapImage(uri); b1.SetValue(ImageBrush.ImageSourceProperty, img); b1.Stretch = Stretch.None; canvas.Background = b1; } catch (Exception e) { MessageBox.Show(e.Message, "Check the location and name of " + imagepath + "folder"); } }
private void PickTextureButton_Click(object sender, RoutedEventArgs e) { OpenFileDialog ofd = new OpenFileDialog() { Multiselect = false, Filter = "Png Images | *.png" }; string newFilePath = ""; NonTopMostPopup.IsOpenedByDialog = true; if (ofd.ShowDialog().GetValueOrDefault()) { string directory = TexturePickerViewModel.GetTextureImagesFolder(); string newFileName = Guid.NewGuid().ToString().Replace("-", "") + Path.GetExtension(ofd.FileName); newFilePath = Path.Combine(directory, newFileName); try { File.Copy(ofd.FileName, newFilePath, true); BitmapImage imageSource = new BitmapImage(); imageSource.BeginInit(); imageSource.UriSource = new Uri("file://" + newFilePath); imageSource.EndInit(); ImageBrush brush = new ImageBrush(imageSource); brush.SetValue(Canvas.TagProperty, newFilePath); textureColorPicker.ImageBrushes.Add(brush); Dispatcher.BeginInvoke(new Action(() => { ((Popup)((FrameworkElement)this.Parent)).IsOpen = true; e.Handled = true; })); } catch (IOException ex) { GisEditor.LoggerManager.Log(LoggerLevel.Debug, ex.Message, new ExceptionInfo(ex)); System.Windows.Forms.MessageBox.Show(ex.Message, "IOException"); } catch (Exception ex) { string originalExceptionMessage = ex.Message; string newExceptionMessage = Regex.IsMatch(originalExceptionMessage, accessDeniedPattern) ? string.Format(CultureInfo.InvariantCulture, accessDeniedMessageFormat, newFilePath) : originalExceptionMessage; System.Windows.Forms.MessageBox.Show(newExceptionMessage, "Warning"); } } }
public static ImageBrush Convert(GeoTextureBrush geoTextureBrush) { string fileName = geoTextureBrush.GeoImage.GetPathFilename(); ImageBrush imageBrush = new ImageBrush(); if (File.Exists(fileName)) { imageBrush.ImageSource = new BitmapImage(new Uri("file://" + fileName)); imageBrush.SetValue(Canvas.TagProperty, fileName); return(imageBrush); } else { return(imageBrush); } }
private void ConversationPage_LayoutUpdated(object sender, EventArgs e) { this.LayoutUpdated -= ConversationPage_LayoutUpdated; string id = NavigationContext.QueryString["id"]; ViewModel = new ConversationViewModel(id); DataContext = ViewModel.Match; _profileName.Text = ViewModel.Match.Name; ImageBrush fillBrush = new ImageBrush(); BitmapImage image = new BitmapImage(ViewModel.Match.ProfilePhoto); image.CreateOptions = BitmapCreateOptions.BackgroundCreation; fillBrush.SetValue(ImageBrush.ImageSourceProperty, image); fillBrush.Stretch = Stretch.UniformToFill; _profilePhotoCircle.Fill = fillBrush; }
private void InitializePredefinedBrushes() { string directoryPath = GetTextureImagesFolder(); if (Directory.Exists(directoryPath)) { string[] fileNames = Directory.GetFiles(directoryPath, "*.png"); foreach (string fileName in fileNames) { string fullFileName = new FileInfo(fileName).FullName; BitmapImage imageSource = new BitmapImage(); imageSource.BeginInit(); imageSource.UriSource = new Uri("file://" + fullFileName); imageSource.EndInit(); ImageBrush brush = new ImageBrush(imageSource); brush.SetValue(Canvas.TagProperty, fullFileName); imageBrushes.Add(brush); } } }
public static void SetLazyImageSource(ImageBrush element, Uri value) => element.SetValue(LazyImageSourceProperty, value);
public static void SetAuthorizationToken(ImageBrush obj, string value) { obj.SetValue(AuthorizationTokenProperty, value); }
public static void SetSource(ImageBrush obj, object value) { obj.SetValue(SourceProperty, value); }
public static void SetImageBrushOpenedStoryboard(ImageBrush element, Storyboard value) { element.SetValue(ImageBrushOpenedStoryboardProperty, value); }
public static void SetShader(ImageBrush brush, BrushShader value) { brush.SetValue(ShaderProperty, value); }