本文整理汇总了C#中System.Windows.Media.ImageBrush类的典型用法代码示例。如果您正苦于以下问题:C# ImageBrush类的具体用法?C# ImageBrush怎么用?C# ImageBrush使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImageBrush类属于System.Windows.Media命名空间,在下文中一共展示了ImageBrush类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:naturenet,项目名称:nature-net-ppi,代码行数:26,代码来源:image_frame.xaml.cs
示例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;
}
}
开发者ID:kse-jp,项目名称:RM-3000,代码行数:31,代码来源:EllipseModel.cs
示例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;
}
开发者ID:BenjBoug,项目名称:INSA-SmallWorld,代码行数:35,代码来源:ImageFactory.cs
示例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;
}
}
开发者ID:HamzaElgarrab,项目名称:LeGarage_Client,代码行数:31,代码来源:popup.xaml.cs
示例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;
}
}
开发者ID:stisf-g1,项目名称:LoanManagement,代码行数:28,代码来源:wpfSelectApplication.xaml.cs
示例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;
}
开发者ID:kris4o1993,项目名称:Telerik-Academy,代码行数:7,代码来源:Instructions.xaml.cs
示例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);
}
开发者ID:serioja90,项目名称:labirynth,代码行数:26,代码来源:Wall.cs
示例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();
}
}
开发者ID:nicholasvdb,项目名称:Bivolino_WP8,代码行数:26,代码来源:ResultPage.xaml.cs
示例9: SetStretch
public static void SetStretch(ImageBrush brush, Stretch stretch)
{
if (brush == null)
return;
brush.Stretch = stretch;
}
开发者ID:sheeeng,项目名称:wolwp,代码行数:7,代码来源:ButtonBaseHelper.cs
示例10: OnStretch
public static void OnStretch(DependencyPropertyChangedEventArgs e, ImageBrush brush)
{
if (e.NewValue == e.OldValue)
return;
SetStretch(brush, (Stretch)e.NewValue);
}
开发者ID:sheeeng,项目名称:wolwp,代码行数:7,代码来源:ButtonBaseHelper.cs
示例11: SetImageBrush
public static void SetImageBrush(ImageBrush brush, ImageSource imageSource)
{
if (brush == null)
return;
brush.ImageSource = imageSource;
}
开发者ID:sheeeng,项目名称:wolwp,代码行数:7,代码来源:ButtonBaseHelper.cs
示例12: OnImageChange
public static void OnImageChange(DependencyPropertyChangedEventArgs e, ImageBrush brush)
{
if (e.NewValue == e.OldValue)
return;
SetImageBrush(brush, e.NewValue as ImageSource);
}
开发者ID:sheeeng,项目名称:wolwp,代码行数:7,代码来源:ButtonBaseHelper.cs
示例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;
}
}
开发者ID:wolfoerster,项目名称:WFTools3D,代码行数:29,代码来源:Airplane.cs
示例14: OptionsWindow
public OptionsWindow()
{
InitializeComponent();
ImageBrush ib = new ImageBrush();
ib.ImageSource = new BitmapImage(new Uri(startupPath + "/images/OptionsScreen.png", UriKind.Absolute));
OptionsBackgrnd.Background = ib;
}
开发者ID:bradleypaul,项目名称:Kulami,代码行数:7,代码来源:OptionsWindow.xaml.cs
示例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);
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:7,代码来源:DevicePictureSourceCache.cs
示例16: Letter
public Letter(string letter, string word, ImageBrush image = null)
{
SmallLetter = letter.ToLower();
BigLetter = letter.ToUpper();
Word = word;
Image = image;
}
开发者ID:guozanhua,项目名称:KinectMiniGames,代码行数:7,代码来源:Letter.cs
示例17: Convert
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value is Project)
{
Project item = (Project)value;
if (item != null && item.name.Contains("Inbox"))
{
ImageBrush background = new ImageBrush();
background.ImageSource =
new System.Windows.Media.Imaging.BitmapImage(
new Uri("/MetroistLib;component/Images/MetroistInbox.png", UriKind.Relative));
return background;
}
else
{
return App.Current.Resources["ProjectColor" + item.color] as SolidColorBrush;
}
}
else if (value is string)
{
return App.Current.Resources["ProjectColor" + (string)value] as SolidColorBrush;
}
return value;
}
开发者ID:richardaum,项目名称:Metroist-for-Windows-Phone,代码行数:26,代码来源:ConverterProjectColor.cs
示例18: DemandeEnCours
public DemandeEnCours()
{
InitializeComponent();
ImageBrush myBrush = new ImageBrush();
}
开发者ID:rastiti,项目名称:ATOM,代码行数:7,代码来源:DemandeEnCours.xaml.cs
示例19: CreateBackFace
private void CreateBackFace(int width, int height, BitmapImage bitmapImage)
{
;
MeshGeometry3D mesh = new MeshGeometry3D();
mesh.Positions.Add(new Point3D(-width, -height, -10));
mesh.Positions.Add(new Point3D(width, -height, -10));
mesh.Positions.Add(new Point3D(width, height, -10));
mesh.Positions.Add(new Point3D(-width, height, -10));
mesh.TriangleIndices.Add(0);
mesh.TriangleIndices.Add(1);
mesh.TriangleIndices.Add(3);
mesh.TriangleIndices.Add(1);
mesh.TriangleIndices.Add(2);
mesh.TriangleIndices.Add(3);
// These are the lines you need to allow an image to be painted onto the 3d model
mesh.TextureCoordinates.Add(new Point(0, 0));
mesh.TextureCoordinates.Add(new Point(1, 0));
mesh.TextureCoordinates.Add(new Point(1, 1));
mesh.TextureCoordinates.Add(new Point(0, 1));
ImageBrush imageBrush = new ImageBrush(bitmapImage);
GeometryModel3D geometry = new GeometryModel3D(mesh, new DiffuseMaterial(imageBrush));
//GeometryModel3D geometry = new GeometryModel3D(mesh, new DiffuseMaterial(new SolidColorBrush(Colors.Red)));
group.Children.Add(geometry);
}
开发者ID:jefflequeux,项目名称:DarkangeUtils,代码行数:31,代码来源:MainWindow.xaml.cs
示例20: LoadImage
internal static async Task LoadImage(this Canvas canvas, WindowData data, int imageIndex)
{
var image = await Task.Run(delegate
{
var im = new BitmapImage(new Uri(data.FileList[imageIndex].FileName));
im.Freeze();
return im;
});
data.ScaleX = image.Width / image.PixelWidth;
data.ScaleY = image.Height / image.PixelHeight;
//if (image.PixelWidth != FileAccess.imageWidth || image.PixelHeight != FileAccess.imageHeight) throw new Exception();
var bg = new ImageBrush
{
ImageSource = image
};
data.WindowTitle = Path.GetFileName(data.FileList[imageIndex].FileName) + " (" + bg.ImageSource.Width + "x" + bg.ImageSource.Height + ")";
canvas.Background = bg;
canvas.Width = bg.ImageSource.Width;
canvas.Height = bg.ImageSource.Height;
canvas.Scale(data.Zoom);
Keyboard.Focus(canvas);
}
开发者ID:zbxzc35,项目名称:Classifier,代码行数:29,代码来源:WindowCanvas.cs
注:本文中的System.Windows.Media.ImageBrush类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论