本文整理汇总了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.
}
}
示例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();
}
示例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;
}
示例4: AddVisual
public void AddVisual(Visual visual)
{
visuals.Add(visual);
base.AddVisualChild(visual);
base.AddLogicalChild(visual);
}
示例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;
}
示例6: DeleteVisual
public void DeleteVisual(Visual visual)
{
visuals.Remove(visual);
base.RemoveVisualChild(visual);
base.RemoveLogicalChild(visual);
}
示例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);
}
示例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);
}
}
示例9: VisualCollection
/// <summary>
/// Creates a VisualCollection.
/// </summary>
public VisualCollection(Visual parent)
{
if (parent == null)
{
throw new ArgumentNullException("parent");
}
_owner = parent;
}
示例10: GetClip
public static Geometry GetClip(Visual reference)
{
Contract.Requires(reference != null);
// May return null
return default(Geometry);
}
示例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);
}
}
示例12: GetPopupLayer
public static PopupLayer GetPopupLayer(Visual target)
{
if (target == null)
{
return null;
}
return target is IPopupLayerHost ? ((IPopupLayerHost)target).PopupLayer : GetPopupLayer(target.VisualParent);
}
示例13: DirectPrinter
public DirectPrinter(
Visual mainPrintContent,
IEnumerable<PrintContent> additionalPrintContent,
IViewDrawingState viewDrawingState,
int pageMargin)
{
_mainPrintContent = mainPrintContent;
_additionalPrintContent = additionalPrintContent;
_viewDrawingState = viewDrawingState;
_pageMargin = pageMargin;
}
示例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;
}
示例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;
}