当前位置: 首页>>代码示例>>C#>>正文


C# Controls.Image类代码示例

本文整理汇总了C#中System.Windows.Controls.Image的典型用法代码示例。如果您正苦于以下问题:C# Image类的具体用法?C# Image怎么用?C# Image使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Image类属于System.Windows.Controls命名空间,在下文中一共展示了Image类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: switch

 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.myimage = ((System.Windows.Controls.Image)(target));
     
     #line 9 "..\..\..\UserControls\MyCheckUC.xaml"
     this.myimage.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.myimage_MouseLeftButtonDown);
     
     #line default
     #line hidden
     
     #line 9 "..\..\..\UserControls\MyCheckUC.xaml"
     this.myimage.MouseEnter += new System.Windows.Input.MouseEventHandler(this.myimage_MouseEnter);
     
     #line default
     #line hidden
     
     #line 9 "..\..\..\UserControls\MyCheckUC.xaml"
     this.myimage.MouseLeave += new System.Windows.Input.MouseEventHandler(this.myimage_MouseLeave);
     
     #line default
     #line hidden
     return;
     }
     this._contentLoaded = true;
 }
开发者ID:UEChip,项目名称:UENSimulation,代码行数:27,代码来源:MyCheckUC.g.i.cs

示例2: DirectoryListItem

        public DirectoryListItem(int width, int height, songInfo info)
        {
            itemInfo = info;

            _isPressed = false;
            _background = new System.Windows.Controls.Image();
            _background.Stretch = Stretch.Fill;
            _background.Width = width;
            _background.Height = height;
            this.Children.Add(_background);

            _artist = new System.Windows.Controls.Label();
            _artist.Content = info.artist;
            _artist.Margin = new Thickness(0, 0, 0, 0);
            _artist.FontFamily = new System.Windows.Media.FontFamily("Calibri");
            _artist.FontSize = 20.0;
            _artist.Foreground = System.Windows.Media.Brushes.White;
            this.Children.Add(_artist);

            _title = new System.Windows.Controls.Label();
            _title.Content = info.title;
            _title.FontFamily = new System.Windows.Media.FontFamily("Calibri");
            _title.FontSize = 16.0;
            _title.Foreground = System.Windows.Media.Brushes.White;
            _title.Margin = new Thickness(0, 30, 0, 0);
            this.Children.Add(_title);

            itemInfo = info;
        }
开发者ID:GunioRobot,项目名称:Project-Volcano,代码行数:29,代码来源:DirectoryListItem.cs

示例3: OnApplyTemplate

 public override void OnApplyTemplate()
 {
     base.OnApplyTemplate();
     _currentImageReference = (Image)GetTemplateChild("ImagePresenter");
     _currentImageReference.ImageOpened += GetImageSourceImageOpened;
     _currentImageReference.ImageFailed += GetImageSourceImageFailed;
 }
开发者ID:brbulic,项目名称:Where.Common,代码行数:7,代码来源:SimpleTile.cs

示例4: CreateVisuals

        /// <summary>
        /// Within the given line add the scarlet box behind the a
        /// </summary>
        private void CreateVisuals(ITextViewLine line)
        {
            //grab a reference to the lines in the current TextView 
            IWpfTextViewLineCollection textViewLines = _view.TextViewLines;
            int start = line.Start;
            int end = line.End;

            //Loop through each character, and place a box around any a 
            for (int i = start; (i < end); ++i)
            {
                if (_view.TextSnapshot[i] == 'a')
                {
                    SnapshotSpan span = new SnapshotSpan(_view.TextSnapshot, Span.FromBounds(i, i + 1));
                    Geometry g = textViewLines.GetMarkerGeometry(span);
                    if (g != null)
                    {
                        GeometryDrawing drawing = new GeometryDrawing(_brush, _pen, g);
                        drawing.Freeze();

                        DrawingImage drawingImage = new DrawingImage(drawing);
                        drawingImage.Freeze();

                        Image image = new Image();
                        image.Source = drawingImage;

                        //Align the image with the top of the bounds of the text geometry
                        Canvas.SetLeft(image, g.Bounds.Left);
                        Canvas.SetTop(image, g.Bounds.Top);

                        _layer.AddAdornment(AdornmentPositioningBehavior.TextRelative, span, null, image, null);
                    }
                }
            }
        }
开发者ID:AlmatoolboxCE,项目名称:AlmaStyleFix,代码行数:37,代码来源:TextAdornment1.cs

示例5: wdw1_Loaded

        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;
            }
        }
开发者ID:stisf-g1,项目名称:LoanManagement,代码行数:28,代码来源:wpfPositionInfo.xaml.cs

示例6: AsImage

        public static Image AsImage(BitmapImage bitmapImage)
        {
            Image image = new Image();
            image.Source = bitmapImage;

            return image;
        }
开发者ID:villj2,项目名称:ch.bfh.bti7301.searchrobot,代码行数:7,代码来源:BitmapConverter.cs

示例7: OnApplyTemplate

        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            icon = GetTemplateChild("PART_Icon") as Image;

            if (icon != null)
            {
                icon.MouseLeftButtonDown += icon_MouseLeftButtonDown;
                icon.MouseUp += icon_MouseUp;
            }

            minButton = GetTemplateChild("PART_MinButton") as Button;
            maxButton = GetTemplateChild("PART_MaxButton") as Button;
            closeButton = GetTemplateChild("PART_CloseButton") as Button;

            if (minButton != null)
                minButton.Click += button_Click;

            if (maxButton != null)
                maxButton.Click += button_Click;

            if (closeButton != null)
                closeButton.Click += button_Click;
        }
开发者ID:KiselevKN,项目名称:BootMega,代码行数:25,代码来源:MainWindow.cs

示例8: TcpViewModelDataType

 public TcpViewModelDataType(TcpRow data)
 {
     Data = data;
     ProccessIcon = new Image();
     ImageName = "Skipped";
     FullPath = "Skipped";
 }
开发者ID:tailored,项目名称:netwatch,代码行数:7,代码来源:DataTypes.cs

示例9: btnRun_Click

        private void btnRun_Click(object sender, RoutedEventArgs e)
        {
            Workbook workbook = new Workbook();
            workbook.LoadFromFile(@"..\..\..\..\..\Data\ImageSample.xls");
            Worksheet sheet = workbook.Worksheets[0];
            //get picture
            ExcelPicture pic = sheet.Pictures[0];

            //save memoryStream
            System.Windows.Controls.Image img = new System.Windows.Controls.Image();
            System.IO.MemoryStream mem = new System.IO.MemoryStream();
            pic.Picture.Save(mem, System.Drawing.Imaging.ImageFormat.Png);
            img.Source = GetBitmapSourceFromStream(mem);
            //create window
            Window imgWindow = new Window();
            imgWindow.Title = "ImageSample";
            imgWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            imgWindow.Width = pic.Picture.Width;
            imgWindow.Height = pic.Picture.Height;
            imgWindow.ResizeMode = ResizeMode.NoResize;
            //set margin
            Thickness thick = new Thickness(0,0,0,0);
            img.Margin = thick;
            imgWindow.Content = img;
            imgWindow.ShowDialog();
        }
开发者ID:e-iceblue,项目名称:Spire.Office-for-.NET,代码行数:26,代码来源:MainWindow.xaml.cs

示例10: CardPack

        public CardPack()
        {
            _pack = new List<Card>();
            Uri uri = new Uri("./Images/cards.png", UriKind.Relative);
            source = new BitmapImage(uri);
            _cardFronts = new List<CroppedBitmap>();
            CardBack = new Image();

            int w = source.PixelWidth / 13;
            int h = source.PixelHeight/5;

            for (int s = 0; s < 4; s++)
            {
                for (int v = 0; v < 13; v++)
                {
                    int imageIndex = (s*13) + v;

                    int fx = imageIndex % 13;
                    int fy = imageIndex / 13;

                    Int32Rect sourceRect = new Int32Rect(fx * w, fy * h, w, h);
                    CroppedBitmap front = new CroppedBitmap(source, sourceRect);

                    sourceRect = new Int32Rect(2 * w, 4 * h, w, h);
                    CroppedBitmap back = new CroppedBitmap(source, sourceRect);

                    Image frontImage = new Image {Source = front};
                    Image backImage = new Image { Source = back };

                    Card card = new Card((CardSuit)s, (CardValue)v, frontImage, backImage);
                    _pack.Add(card);
                }
            }
        }
开发者ID:RedHobbit,项目名称:ClockPatience,代码行数:34,代码来源:CardPack.cs

示例11: CheckImage

        void CheckImage(BitmapImage img)
        {
            if(img.IsDownloading)
            {
                Dispatcher.InvokeAsync(() => CheckImage(img), DispatcherPriority.Background);
            }
            else
            {
                var el = new System.Windows.Controls.Image()
                {
                    Source = img,
                    SnapsToDevicePixels = true,
                    UseLayoutRounding = true,
                    MinWidth = LedBadgeLib.BadgeCaps.Width,
                    MinHeight = LedBadgeLib.BadgeCaps.Height,
                    Width = img.Width * ((BitmapSource)img).DpiX / 96,
                    Stretch = Stretch.UniformToFill,
                };
                RenderOptions.SetBitmapScalingMode(img, BitmapScalingMode.NearestNeighbor);
                el.Measure(new Size(LedBadgeLib.BadgeCaps.Width, LedBadgeLib.BadgeCaps.Height));
                el.Arrange(new Rect(0, 0, LedBadgeLib.BadgeCaps.Width, LedBadgeLib.BadgeCaps.Height));

                m_messageQueue.Enqueue(new LedBadgeLib.MessageQueueItem(new LedBadgeLib.WpfVisual(el, dither : Dither)));
            };
        }
开发者ID:Effix,项目名称:LedBadge,代码行数:25,代码来源:ImageProvider.cs

示例12: SetCurrentRoom

 public void SetCurrentRoom(Image image)
 {
     CurrentRoom.Selected = false;
     var room = _rooms.FirstOrDefault(a => a.Image == image);
     if (room != null) CurrentRoom = room;
     CurrentRoom.Selected = true;
 }
开发者ID:xeonixen,项目名称:DungeonEditor,代码行数:7,代码来源:Level.cs

示例13: AddFriend

 public void AddFriend(Image userIcon, string userName, string userStatus, int userID, bool isOnline)
 {
     Friend friend = new Friend(userIcon, userName, userStatus, userID, isOnline);
     friend.RequestShare += friend_RequestShare;
     _friends.Add(friend);
     Update();
 }
开发者ID:sczk,项目名称:collab-project,代码行数:7,代码来源:FriendList.xaml.cs

示例14: ImageTransitionControl

        public ImageTransitionControl()
        {
            InitializeComponent();

            _currentImage = Image1;
            _newImage = Image2;
        }
开发者ID:ZyshchykMaksim,项目名称:meridian,代码行数:7,代码来源:ImageTransitionControl.xaml.cs

示例15: Window_Loaded_1

        private void Window_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;
                wdw1.Background = myBrush;
                resetGrid();

                if (status == false)//maintenance
                {
                    btnView.Visibility = Visibility.Hidden;
                    btnAdd.Visibility = Visibility.Hidden;
                    btnRet.Visibility = Visibility.Visible;
                    myLbL.Content = "Bank Retrieval";
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show("Runtime Error: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
        }
开发者ID:stisf-g1,项目名称:LoanManagement,代码行数:26,代码来源:wpfBank.xaml.cs


注:本文中的System.Windows.Controls.Image类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。