//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);
        }
Example #2
1
        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;
            }
        }
Example #3
0
 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;
 }
 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;
     }
 }
 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;
     }
 }
 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;
 }
Example #7
0
 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);
 }
        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();
            }
          

        }
Example #9
0
		public static void SetStretch(ImageBrush brush, Stretch stretch)
		{
			if (brush == null)
				return;

			brush.Stretch = stretch;
		}
Example #10
0
		public static void OnStretch(DependencyPropertyChangedEventArgs e, ImageBrush brush)
		{
			if (e.NewValue == e.OldValue)
				return;

			SetStretch(brush, (Stretch)e.NewValue);
		}
Example #11
0
		public static void SetImageBrush(ImageBrush brush, ImageSource imageSource)
		{
			if (brush == null)
				return;

			brush.ImageSource = imageSource;
		}
Example #12
0
		public static void OnImageChange(DependencyPropertyChangedEventArgs e, ImageBrush brush)
		{ 
            if (e.NewValue == e.OldValue)
                return;

            SetImageBrush(brush, e.NewValue as ImageSource);
		}
Example #13
0
 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;
     }
 }
Example #14
0
 public OptionsWindow()
 {
     InitializeComponent();
     ImageBrush ib = new ImageBrush();
     ib.ImageSource = new BitmapImage(new Uri(startupPath + "/images/OptionsScreen.png", UriKind.Absolute));
     OptionsBackgrnd.Background = ib;
 }
		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);
		}
Example #16
0
		static PainterCache()
		{
            UseTransparentImage = true;
			try
			{
				TransparentBrush = new SolidColorBrush(Colors.Transparent);
				TransparentBrush.Freeze();
				BlackBrush = new SolidColorBrush(Colors.Black);
				BlackBrush.Freeze();
				WhiteBrush = new SolidColorBrush(Colors.White);
				WhiteBrush.Freeze();
				ZonePen = new Pen(BlackBrush, 1);
				GridLineBrush = new SolidColorBrush(Colors.Orange);
				GridLineBrush.Freeze();
				GridLinePen = new Pen(GridLineBrush, 1);
				GridLinePen.EndLineCap = PenLineCap.Square;
				GridLinePen.StartLineCap = PenLineCap.Square;
				GridLinePen.DashStyle = DashStyles.Dash;
				PointGeometry = new RectangleGeometry(new Rect(-15, -15, 30, 30));
				_transparentBackgroundBrush = CreateTransparentBackgroundBrush();
			}
			catch (Exception e)
			{
				Logger.Error(e, "PainterCache.PainterCache()");
			}
		}
Example #17
0
 public Letter(string letter, string word, ImageBrush image = null)
 {
     SmallLetter = letter.ToLower();
     BigLetter = letter.ToUpper();
     Word = word;
     Image = image;
 }
        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;
        }
Example #19
0
 public DemandeEnCours()
 {
     
     InitializeComponent();
     ImageBrush myBrush = new ImageBrush();
     
 }
        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);
        }
Example #21
0
        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);
        }
Example #22
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            _ui_txtTitle = (TextBlock)GetTemplateChild("_ui_txtTitle");
            if (null != (_ui_btnOpenClose = (Button)GetTemplateChild("_ui_btnOpenClose")))
                _ui_btnOpenClose.Click += new RoutedEventHandler(_ui_btnOpenClose_Click);
            _ui_rectOpenClose = (Rectangle)GetTemplateChild("_ui_rectOpenClose");
            _ui_brdContent = (Border)GetTemplateChild("_ui_brdContent");
            _ui_cntContent = (ContentControl)GetTemplateChild("_ui_cntContent");

            if (null != (_ui_dpHeader = (DockPanel)GetTemplateChild("_ui_dpHeader")))
                _ui_dpHeader.MouseLeftButtonDown += new MouseButtonEventHandler(_ui_dpHeader_MouseLeftButtonDown);


            //            Image cImg = new Image();
            ImageBrush cIB = new ImageBrush();
            cIB.ImageSource = new System.Windows.Media.Imaging.BitmapImage(new Uri("/controls.sl;component/Images/rp_open.png", UriKind.Relative));
            cIB.Stretch = Stretch.None;
            _cOpenSymbol = cIB;               // = cImg;
            cIB = new ImageBrush();
            cIB.ImageSource = new System.Windows.Media.Imaging.BitmapImage(new Uri("/controls.sl;component/Images/rp_close.png", UriKind.Relative));
            cIB.Stretch = Stretch.None;
            _cCloseSymbol = cIB;              //= cImg;
            if(Title.IsNullOrEmpty())
                Title = g.Common.sName;
            ProcessTitle();
            ProcessIsOpen();
        }
Example #23
0
 public HelpScreen1()
 {
     InitializeComponent();
     ImageBrush ib = new ImageBrush();
     ib.ImageSource = new BitmapImage(new Uri(startupPath + "/images/HelpScreenBackground.jpg", UriKind.Absolute));
     HelpBackground.Background = ib;
 }
Example #24
0
        public void floor(double l, double h, double w)
        {
            DiffuseMaterial material1 = new DiffuseMaterial();
            ImageBrush brush = new ImageBrush();
            brush.ImageSource = new BitmapImage(new Uri(@"floor15.jpg", UriKind.Relative));
            brush.Viewport = new Rect(0, 0, 0.1, 0.1);
            brush.TileMode = TileMode.Tile;
            material1.Brush = brush;

            Model3DGroup cube = new Model3DGroup();
            material[0] = material1;
            material[1] = material1;
            material[2] = material1;
            material[3] = material1;
            material[4] = material1;
            material[5] = material1;
            material[6] = material1;
            material[7] = material1;
            material[8] = material1;
            material[9] = material1;
            material[10] = material1;
            material[11] = material1;
            cubegroup(l, h, w,ref cube,  material);
            this.Content = cube;  
        }
Example #25
0
        public Lobby(Menu parent)
        {
            InitializeComponent();

            ImageBrush myBrush = new ImageBrush();
            myBrush.ImageSource = new BitmapImage(new Uri(".\\Resources\\icon_backarrow.png", UriKind.Relative));
            bekk.Background = myBrush;

            ImageBrush myBrush2 = new ImageBrush();
            myBrush2.ImageSource = new BitmapImage(new Uri(".\\Resources\\icon_closebutton.png", UriKind.Relative));
            klóz.Background = myBrush2;

            this.parent = parent;

            chatbox.Items.Clear();

            refreshworker = new BackgroundWorker();
            refreshworker.WorkerSupportsCancellation = true;
            refreshworker.WorkerReportsProgress = true;
            refreshworker.DoWork += refresh;
            refreshworker.ProgressChanged += refreshUI;

            activityworker = new BackgroundWorker();
            activityworker.WorkerSupportsCancellation = true;
            activityworker.DoWork += wait;
            activityworker.RunWorkerCompleted += doActivity;
        }
 public RibbionControl()
 {
     InitializeComponent();
     ImageSource imgSrc = new BitmapImage(new Uri("../../Resources/Images/bigstock-satellite.jpg", UriKind.RelativeOrAbsolute));
     ImageBrush imgBrush = new ImageBrush(imgSrc);
     MainMdiContainer.Background = imgBrush;
 }
Example #27
0
        public FullIdeaResource()
        {
            ImageSource imageResource = (ImageSource)Application.Current.Resources[FullIdeaResourceName];

            _brushResource = new ImageBrush();
            _brushResource.ImageSource = imageResource;
        }
        private void wdw1_Loaded(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;
                wdw1.Background = myBrush;

                if (status == "View")
                {
                    using (var ctx = new finalContext())
                    {
                        Domain.Position pos = ctx.Positions.Find(pID);
                        txtPosition.Text = pos.PositionName;
                        txtDesc.Text = pos.Description;
                        btnSave.Content = "Save";
                    }
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show("Runtime Error: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
        }
        public CardStack InitCards()
        {
            images['T'] = 11;
            images['V'] = 2;
            images['Q'] = 3;
            images['K'] = 4;

            for (int j = 0; j < imagesM.Length; j++)
            {
                for (int i = 0; i < values.Length; i++)
                {

                    ImageBrush backForCanvas = new ImageBrush() { ImageSource = new BitmapImage(new Uri(String.Format(@"\CardsImage\{0}{1}.png", values[i], imagesM[j]), UriKind.Relative)) };
                    tempStack.AddCard(new Card(values[i], String.Format("{0}{1}", values[i], imagesM[j])));
                }
                foreach (KeyValuePair<char, int> item in images)
                {

                    ImageBrush backForCanvas = new ImageBrush() { ImageSource = new BitmapImage(new Uri(String.Format(@"\CardsImage\{0}{1}.png", item.Key, imagesM[j]), UriKind.Relative)) };
                    tempStack.AddCard(new Card(item.Value, String.Format("{0}{1}", item.Key, imagesM[j])));
                }

            }
            return tempStack;
        }
        public CompactQuestionResource()
        {
            ImageSource imageResource = (ImageSource)Application.Current.Resources[CompactQuestionResourceName];

            _brushResource = new ImageBrush();
            _brushResource.ImageSource = imageResource;
        }