本文整理汇总了C#中System.Windows.Media.ImageBrush类的典型用法代码示例。如果您正苦于以下问题:C# ImageBrush类的具体用法?C# ImageBrush怎么用?C# ImageBrush使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImageBrush类属于System.Windows.Media命名空间,在下文中一共展示了ImageBrush类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: image_frame
//public window_content win_content;
public image_frame()
{
InitializeComponent();
//this.title_bar.Background = configurations.contribution_view_title_bar_color;
//Static Configuration Values:
this.the_item.Width = configurations.frame_width;
this.the_item.Height = 300;
this.the_content.Width = configurations.frame_width;
this.the_media.Margin = new Thickness(0, -1 * configurations.frame_title_bar_height, 0, 0);
//this.title_bar.Background = new SolidColorBrush(Color.;
//this.frame.BorderBrush = new SolidColorBrush(Color.;
this.title_bar.Height = configurations.frame_title_bar_height;
var b1 = new ImageBrush();
b1.ImageSource = configurations.img_close_icon;
this.close.Background = b1;
if (configurations.response_to_mouse_clicks)
this.close.Click += new RoutedEventHandler(close_Click);
//this.change_view.Click += new RoutedEventHandler(change_view_Click);
this.close.PreviewTouchDown += new EventHandler<TouchEventArgs>(close_Click);
RenderOptions.SetBitmapScalingMode(the_item, configurations.scaling_mode);
}
示例2: Create
public Model3DGroup Create(Color modelColor,string pictureName, Point3D startPos, double maxHigh)
{
try
{
Uri inpuri = new Uri(@pictureName, UriKind.Relative);
BitmapImage bi = new BitmapImage();
bi.BeginInit();
bi.UriSource = inpuri;
bi.EndInit();
ImageBrush imagebrush = new ImageBrush(bi);
imagebrush.Opacity = 100;
imagebrush.Freeze();
Point[] ptexture0 = { new Point(0, 0), new Point(0, 1), new Point(1, 0) };
Point[] ptexture1 = { new Point(1, 0), new Point(0, 1), new Point(1, 1) };
SolidColorBrush modelbrush = new SolidColorBrush(modelColor);
Model3DGroup cube = new Model3DGroup();
Point3D uppercircle = startPos;
modelbrush.Freeze();
uppercircle.Y = startPos.Y + maxHigh;
cube.Children.Add(CreateEllipse2D(modelbrush, uppercircle, _EllipseHigh, new Vector3D(0, 1, 0)));
cube.Children.Add(CreateEllipse2D(modelbrush, startPos, _EllipseHigh, new Vector3D(0, -1, 0)));
cube.Children.Add(CreateEllipse3D(imagebrush, startPos, _EllipseHigh, maxHigh, ptexture0));
return cube;
}
catch (Exception ex)
{
throw ex;
}
}
示例3: getViewTile
public override Brush getViewTile(ICase tile)
{
ImageBrush brush = new ImageBrush();
if (tile is CaseDesert)
{
if (tileDesert == null)
tileDesert = new BitmapImage(new Uri("../../Resources/" + styleName + "/caseDesert.png", UriKind.Relative));
brush.ImageSource = tileDesert;
}
else if (tile is CaseEau)
{
if (tileEau == null)
tileEau = new BitmapImage(new Uri("../../Resources/" + styleName + "/caseEau.png", UriKind.Relative));
brush.ImageSource = tileEau;
}
else if (tile is CaseForet)
{
if (tileForet == null)
tileForet = new BitmapImage(new Uri("../../Resources/" + styleName + "/caseForet.png", UriKind.Relative));
brush.ImageSource = tileForet;
}
else if (tile is CaseMontagne)
{
if (tileMontagne == null)
tileMontagne = new BitmapImage(new Uri("../../Resources/" + styleName + "/caseMontagne.png", UriKind.Relative));
brush.ImageSource = tileMontagne;
}
else if (tile is CasePlaine)
{
if (tilePlaine == null)
tilePlaine = new BitmapImage(new Uri("../../Resources/" + styleName + "/casePlaine.png", UriKind.Relative));
brush.ImageSource = tilePlaine;
}
return brush;
}
示例4: design
public void design(int type)
{
Uri uri = null;
var image = new ImageBrush();
switch(type)
{
case Constants.GENERAL_ERROR_POPUP:
this.title.Content = "Humm... ";
this.message.Content = "Une erreur s'est produite!";
uri = new Uri("pack://application:,,,/assets/img/popups/error_msg_bg.png", UriKind.Absolute);
image.ImageSource = new BitmapImage(uri);
this.Background = image;
break;
case Constants.LOGIN_ERROR_POPUP:
this.title.Content = "Humm...";
this.message.Content = "Informations incorrectes.";
uri = new Uri("pack://application:,,,/assets/img/popups/error_msg_bg.png", UriKind.Absolute);
image.ImageSource = new BitmapImage(uri);
this.Background = image;
break;
case Constants.LOGIN_WARNING_POPUP:
this.title.Foreground = new SolidColorBrush(Colors.Red);
this.message.Foreground = new SolidColorBrush(Colors.Red);
this.title.Content = "Humm... ";
this.message.Content = "Pas de connexion!";
uri = new Uri("pack://application:,,,/assets/img/popups/warning_msg_bg.png", UriKind.Absolute);
image.ImageSource = new BitmapImage(uri);
this.Background = image;
break;
}
}
示例5: MetroWindow_Loaded_1
private void MetroWindow_Loaded_1(object sender, RoutedEventArgs e)
{
try
{
ImageBrush myBrush = new ImageBrush();
System.Windows.Controls.Image image = new System.Windows.Controls.Image();
image.Source = new BitmapImage(
new Uri(AppDomain.CurrentDomain.BaseDirectory + "\\Icons\\bg5.png"));
myBrush.ImageSource = image.Source;
//Grid grid = new Grid();
wdw1.Background = myBrush;
if (status == "Approval")
{
lbl1.Content = "View all Applied Loans";
lbl2.Content = "Update Loans";
}
else if (status == "Releasing")
{
lbl1.Content = "View all Approved Loans";
lbl2.Content = "Update Released Loans";
}
}
catch (Exception ex)
{
System.Windows.MessageBox.Show("Runtime Error: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
}
示例6: LoadBackgroundImage
private void LoadBackgroundImage()
{
ImageBrush myBrush = new ImageBrush();
var path = System.IO.Path.GetFullPath(@"..\..\Resources\Other_graphics\Instructions.png");
myBrush.ImageSource = new BitmapImage(new Uri(path, UriKind.Absolute));
this.Background = myBrush;
}
示例7: Wall
public Wall(Canvas container, Point position, double width, double height) {
this.container = container;
this.position = position;
this.width = width;
this.height = height;
this.image = new ImageBrush();
Debug.WriteLine("IMG width: " + imageSource.PixelWidth + ", height: " + imageSource.PixelHeight);
this.image.ImageSource = imageSource;
this.image.Stretch = Stretch.None;
transform = new TranslateTransform();
transform.X = -this.position.X;
transform.Y = -this.position.Y;
st = new ScaleTransform();
st.ScaleX = 1.55;
st.ScaleY = 2;
this.image.RelativeTransform = st;
this.image.Transform = transform;
this.imageContainer = new Canvas();
this.imageContainer.Width = width;
this.imageContainer.Height = height;
this.imageContainer.Background = this.image;
this.container.Children.Add(this.imageContainer);
Canvas.SetLeft(this.imageContainer, this.position.X);
Canvas.SetTop(this.imageContainer, this.position.Y);
Canvas.SetZIndex(this.imageContainer, 2);
}
示例8: ResultPage
public ResultPage()
{
InitializeComponent();
System.Windows.Media.ImageBrush myBrush = new System.Windows.Media.ImageBrush();
Image image = new Image();
image.ImageFailed += (s, i) => MessageBox.Show("Failed to load: " + i.ErrorException.Message);
image.Source = new BitmapImage(new Uri("/Images/bg_hdpi.jpg", UriKind.Relative));
myBrush.ImageSource = image.Source;
LayoutRoot.Background = myBrush;
m = (Measure)PhoneApplicationService.Current.State["Data"];
pgrLoader.Visibility = Visibility.Visible;
RequestServer();
if (IsolatedStorageSettings.ApplicationSettings.Contains("login"))
{
email = IsolatedStorageSettings.ApplicationSettings["login"] as string;
password = IsolatedStorageSettings.ApplicationSettings["password"] as string;
LoggedIn();
}
}
示例9: SetStretch
public static void SetStretch(ImageBrush brush, Stretch stretch)
{
if (brush == null)
return;
brush.Stretch = stretch;
}
示例10: OnStretch
public static void OnStretch(DependencyPropertyChangedEventArgs e, ImageBrush brush)
{
if (e.NewValue == e.OldValue)
return;
SetStretch(brush, (Stretch)e.NewValue);
}
示例11: SetImageBrush
public static void SetImageBrush(ImageBrush brush, ImageSource imageSource)
{
if (brush == null)
return;
brush.ImageSource = imageSource;
}
示例12: OnImageChange
public static void OnImageChange(DependencyPropertyChangedEventArgs e, ImageBrush brush)
{
if (e.NewValue == e.OldValue)
return;
SetImageBrush(brush, e.NewValue as ImageSource);
}
示例13: Airplane
static Airplane()
{
try
{
Assembly assembly = Assembly.GetExecutingAssembly();
string[] names = assembly.GetManifestResourceNames();
string name = names.FirstOrDefault(x => x.Contains("WFTools3D.jpg"));
if (name != null)
{
Stream stream = assembly.GetManifestResourceStream(name);
if (stream != null)
{
BitmapImage bitmap = new BitmapImage();
bitmap.BeginInit();
bitmap.StreamSource = stream;
bitmap.EndInit();
ImageBrush imbrush = new ImageBrush(bitmap);
imbrush.TileMode = TileMode.Tile;
imbrush.Viewport = new Rect(0, 0, 0.5, 1);
imbrush.Freeze();
brush = imbrush;
}
}
}
catch
{
brush = Brushes.Silver;
}
}
示例14: OptionsWindow
public OptionsWindow()
{
InitializeComponent();
ImageBrush ib = new ImageBrush();
ib.ImageSource = new BitmapImage(new Uri(startupPath + "/images/OptionsScreen.png", UriKind.Absolute));
OptionsBackgrnd.Background = ib;
}
示例15: RegisterBrush
private static void RegisterBrush(LibraryDevice libraryDevice)
{
var imageSource = GetImageSource(libraryDevice == null ? Guid.Empty : libraryDevice.DriverId);
var brush = new ImageBrush(imageSource);
brush.Freeze();
_brushes.Add(libraryDevice == null ? Guid.Empty : libraryDevice.DriverId, brush);
}