當前位置: 首頁>>代碼示例>>C#>>正文


C# Media.Visual類代碼示例

本文整理匯總了C#中System.Windows.Media.Visual的典型用法代碼示例。如果您正苦於以下問題:C# Visual類的具體用法?C# Visual怎麽用?C# Visual使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Visual類屬於System.Windows.Media命名空間,在下文中一共展示了Visual類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: OnRootChanged

 public void OnRootChanged(Visual oldRoot, Visual newRoot)
 {
     if(_active && newRoot != null) 
     {
         Keyboard.Focus(null); // internally we will set the focus to the root. 
     } 
 }
開發者ID:sjyanxin,項目名稱:WPFSource,代碼行數:7,代碼來源:HwndKeyboardInputProvider.cs

示例2: PrintPreviewWindow

        internal PrintPreviewWindow(
			Visual mainPrintContent,
			IEnumerable<PrintContent> additionalPrintContent,
			IViewDrawingState viewDrawingState)
        {
            _mainPrintContent = mainPrintContent;
            _additionalPrintContent = additionalPrintContent;
            _viewDrawingState = viewDrawingState;

            PrintCommand = new RelayCommand(DoPrint);

            PaperFormats = new[]
                {
                    new PaperFormatViewModel("DIN A3", PaperFormat.A3),
                    new PaperFormatViewModel("DIN A4", PaperFormat.A4),
                };
            _selectedPaperFormat = PaperFormats.ElementAt(1);

            PaperOrientations = new[]
                {
                    new PaperOrientationViewModel(MlResources.PaperOrientationPortrait, PaperOrientation.Portrait),
                    new PaperOrientationViewModel(MlResources.PaperOrientationLandscape, PaperOrientation.Landscape),
                };
            _selectedPaperOrientation = PaperOrientations.ElementAt(1);

            InitializeComponent();
        }
開發者ID:Bruhankovi4,項目名稱:Emotyper,代碼行數:27,代碼來源:PrintPreviewWindow.xaml.cs

示例3: GenerateImage

        public MemoryStream GenerateImage(Visual vsual, int widhth, int height, ImageFormat format)
        {
            BitmapEncoder encoder = null;

            switch (format)
            {
                case ImageFormat.JPG :
                    encoder = new JpegBitmapEncoder();
                    break;
                case ImageFormat.PNG:
                    encoder = new PngBitmapEncoder();
                    break;
                case ImageFormat.BMP:
                    encoder = new BmpBitmapEncoder();
                    break;
                case ImageFormat.GIF:
                    encoder = new GifBitmapEncoder();
                    break;
                case ImageFormat.TIF:
                    encoder = new TiffBitmapEncoder();
                    break;

            }

            if (encoder == null) return null;

            RenderTargetBitmap rtb = this.RenderVisaulToBitmap(vsual, widhth, height);
            MemoryStream file = new MemoryStream();
            encoder.Frames.Add(BitmapFrame.Create(rtb));
            encoder.Save(file);

            return file;
        }
開發者ID:enesyteam,項目名稱:EChess,代碼行數:33,代碼來源:Model.cs

示例4: AddVisual

        public void AddVisual(Visual visual)
        {
            visuals.Add(visual);

            base.AddVisualChild(visual);
            base.AddLogicalChild(visual);
        }
開發者ID:gazzyt,項目名稱:GaryScope,代碼行數:7,代碼來源:DrawingCanvas.cs

示例5: DocumentPage

 /// <summary>
 /// Public constructor.
 /// </summary>
 /// <param name="visual">The visual representation of this page.</param>
 /// <param name="pageSize">The size of the page, including margins.</param>
 /// <param name="bleedBox">The bounds the ink drawn by the page.</param>
 /// <param name="contentBox">The bounds of the content within the page.</param>
 public DocumentPage(Visual visual, Size pageSize, Rect bleedBox, Rect contentBox)
 {
     _visual = visual;
     _pageSize = pageSize;
     _bleedBox = bleedBox;
     _contentBox = contentBox;
 }
開發者ID:JianwenSun,項目名稱:cc,代碼行數:14,代碼來源:DocumentPage.cs

示例6: DeleteVisual

        public void DeleteVisual(Visual visual)
        {
            visuals.Remove(visual);

            base.RemoveVisualChild(visual);
            base.RemoveLogicalChild(visual);
        }
開發者ID:gazzyt,項目名稱:GaryScope,代碼行數:7,代碼來源:DrawingCanvas.cs

示例7: GetBitmapEffectInput

 public static System.Windows.Media.Effects.BitmapEffectInput GetBitmapEffectInput(Visual reference)
 {
   Contract.Requires(reference != null);
   
   // May return null
   return default(System.Windows.Media.Effects.BitmapEffectInput);
 }
開發者ID:asvishnyakov,項目名稱:CodeContracts,代碼行數:7,代碼來源:System.Windows.Media.VisualTreeHelper.cs

示例8: AddSnoopVisualTreeRoot

 /// <summary>
 /// Adds given visual as a root of Snoop visual tree.
 /// </summary>
 internal static void AddSnoopVisualTreeRoot(Visual root)
 {
     if (!_registeredSnoopVisualTreeRoots.Contains(root))
     {
         _registeredSnoopVisualTreeRoots.Add(root);
     }
 }
開發者ID:noamkfir,項目名稱:snoopwpf,代碼行數:10,代碼來源:SnoopPartsRegistry.cs

示例9: VisualCollection

 /// <summary>
 /// Creates a VisualCollection.
 /// </summary>
 public VisualCollection(Visual parent)
 {
     if (parent == null)
     {
         throw new ArgumentNullException("parent");
     }
     _owner = parent;
 }
開發者ID:krytht,項目名稱:DotNetReferenceSource,代碼行數:11,代碼來源:VisualCollection.cs

示例10: GetClip

    public static Geometry GetClip(Visual reference)
    {
      Contract.Requires(reference != null);

      // May return null

      return default(Geometry);
    }
開發者ID:asvishnyakov,項目名稱:CodeContracts,代碼行數:8,代碼來源:System.Windows.Media.VisualTreeHelper.cs

示例11: UpdateReferences

		static void UpdateReferences(Visual visual)
		{
			foreach (var glyph in visual.FindVisualChildren<Glyphs>())
				if (!glyph.FontUri.IsAbsoluteUri)
				{
					var glyphGuid = glyph.FontUri.ToString();
					glyph.FontUri = new Uri(ServiceFactoryBase.ContentService.GetContentFileName(glyphGuid), UriKind.Absolute);
				}
		}
開發者ID:xbadcode,項目名稱:Rubezh,代碼行數:9,代碼來源:ImageHelper.cs

示例12: GetPopupLayer

        public static PopupLayer GetPopupLayer(Visual target)
        {
            if (target == null)
            {
                return null;
            }

            return target is IPopupLayerHost ? ((IPopupLayerHost)target).PopupLayer : GetPopupLayer(target.VisualParent);
        }
開發者ID:highzion,項目名稱:Granular,代碼行數:9,代碼來源:PopupLayer.cs

示例13: DirectPrinter

        public DirectPrinter(
			Visual mainPrintContent, 
			IEnumerable<PrintContent> additionalPrintContent, 
			IViewDrawingState viewDrawingState, 
			int pageMargin)
        {
            _mainPrintContent = mainPrintContent;
            _additionalPrintContent = additionalPrintContent;
            _viewDrawingState = viewDrawingState;
            _pageMargin = pageMargin;
        }
開發者ID:Bruhankovi4,項目名稱:Emotyper,代碼行數:11,代碼來源:DirectPrinter.cs

示例14: CreateMeshModel

		private ModelUIElement3D CreateMeshModel(Visual visual)
		{
			var model3d = InternalResources["ElementModel"] as ModelUIElement3D;
			VisualBrush brush = new VisualBrush(visual);
			RenderOptions.SetCachingHint(brush, CachingHint.Cache);

			var geom3D = model3d.Model as GeometryModel3D;
			(geom3D.Material as DiffuseMaterial).Brush = brush;
			(geom3D.Geometry as MeshGeometry3D).Positions = CreateMeshPositions();

			return model3d;
		}
開發者ID:Ghawken,項目名稱:FrontView,代碼行數:12,代碼來源:ElementFlow.Internal.cs

示例15: CreateMeshModel

        private ModelUIElement3D CreateMeshModel(Visual visual)
        {
            GeometryModel3D model3d = (InternalResources["ElementModel"] as GeometryModel3D).Clone();
            VisualBrush brush = new VisualBrush(visual);
            RenderOptions.SetCachingHint(brush, CachingHint.Cache);
            (model3d.Material as DiffuseMaterial).Brush = brush;
            (model3d.Geometry as MeshGeometry3D).Positions = CreateMeshPositions();

            ModelUIElement3D model = new ModelUIElement3D();
            model.Model = model3d;

            return model;
        }
開發者ID:fivesixty,項目名稱:StandaloneMB,代碼行數:13,代碼來源:ElementFlow.Internal.cs


注:本文中的System.Windows.Media.Visual類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。