本文整理汇总了C#中System.Windows.Media.Visual类的典型用法代码示例。如果您正苦于以下问题:C# Visual类的具体用法?C# Visual怎么用?C# Visual使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Visual类属于System.Windows.Media命名空间,在下文中一共展示了Visual类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: CreateMeshModel
private ModelUIElement3D CreateMeshModel(Visual visual)
{
var model3D = ((GeometryModel3D) InternalResources["ElementModel"]).Clone();
var brush = new VisualBrush(visual);
RenderOptions.SetCachingHint(brush, CachingHint.Cache);
RenderOptions.SetBitmapScalingMode(brush, BitmapScalingMode.LowQuality);
((DiffuseMaterial) model3D.Material).Brush = brush;
((MeshGeometry3D) model3D.Geometry).Positions = CreateMeshPositions();
var model = new ModelUIElement3D {Model = model3D};
return model;
}
开发者ID:Ghawken,项目名称:FrontView,代码行数:13,代码来源:VirtElementFlow.Internal.cs
示例17: GetAdornerLayer
public static AdornerLayer GetAdornerLayer(Visual visual)
{
while (visual != null)
{
if (visual is IAdornerLayerHost)
{
return ((IAdornerLayerHost)visual).AdornerLayer;
}
visual = visual.VisualParent;
}
return null;
}
开发者ID:highzion,项目名称:Granular,代码行数:14,代码来源:AdornerLayer.cs
示例18: SaveToImage
public static void SaveToImage(Visual visual, int width, int height)
{
Debug.WriteLine($"width: {width}, height: {height}");
var filePath = ChoosePathToSave();
if (filePath == null) return;
using (var fs = new FileStream(filePath, FileMode.Create))
{
var renderer = new RenderTargetBitmap(width, height, Dpi, Dpi, PixelFormat);
renderer.Render(visual);
var encoder = ChooseBitmapEncoder(Path.GetExtension(filePath));
encoder.Frames.Add(BitmapFrame.Create(renderer));
encoder.Save(fs);
}
SelectFileInExplorer(filePath);
}
开发者ID:CuteITGuy,项目名称:ProgrammerUtilitiesCOOL,代码行数:16,代码来源:ImageFileHander.cs
示例19: XpsDocumentGenerator
internal XpsDocumentGenerator(
Visual mainPrintContent,
IEnumerable<PrintContent> additionalPrintContent,
IViewDrawingState viewDrawingState,
int width,
int height,
int pageMargin)
{
_mainPrintContent = mainPrintContent;
_additionalPrintContent = additionalPrintContent;
_viewDrawingState = viewDrawingState;
PageMargin = pageMargin;
Width = width;
Height = height;
InitializeComponent();
}
开发者ID:Bruhankovi4,项目名称:Emotyper,代码行数:17,代码来源:XpsDocumentGenerator.xaml.cs
示例20: WriteAsync
public abstract void WriteAsync(Visual visual, PrintTicket printTicket, object userState);
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:1,代码来源:SerializerWriterCollator.cs
注:本文中的System.Windows.Media.Visual类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论