本文整理汇总了C#中System.Windows.PresentationSource类的典型用法代码示例。如果您正苦于以下问题:C# PresentationSource类的具体用法?C# PresentationSource怎么用?C# PresentationSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PresentationSource类属于System.Windows命名空间,在下文中一共展示了PresentationSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RawStylusInputReport
internal RawStylusInputReport(
InputMode mode,
int timestamp,
PresentationSource inputSource,
PenContext penContext,
RawStylusActions actions,
int tabletDeviceId,
int stylusDeviceId,
int[] data)
: base(inputSource, InputType.Stylus, mode, timestamp)
{
// Validate parameters
if (!RawStylusActionsHelper.IsValid(actions))
{
throw new InvalidEnumArgumentException(SR.Get(SRID.Enum_Invalid, "actions"));
}
if (data == null && actions != RawStylusActions.InRange)
{
throw new ArgumentNullException("data");
}
_penContext = new SecurityCriticalDataClass<PenContext>(penContext);
_actions = actions;
_tabletDeviceId = tabletDeviceId;
_stylusDeviceId = stylusDeviceId;
_data = data;
_isSynchronize = false;
}
示例2: FromPixels
public static Size FromPixels(PresentationSource source, Size pixelSize) {
if (source == null) {
throw new ArgumentNullException(nameof(source));
}
return (Size)source.CompositionTarget.TransformFromDevice.Transform((Vector)pixelSize);
}
示例3: ElementToRoot
internal static Rect ElementToRoot(Rect rectElement, Visual element, PresentationSource presentationSource)
{
GeneralTransform transformElementToRoot = element.TransformToAncestor(presentationSource.RootVisual);
Rect rectRoot = transformElementToRoot.TransformBounds(rectElement);
return rectRoot;
}
示例4: ToPixels
public static Point ToPixels(PresentationSource source, Point wpfSize) {
if (source == null) {
throw new ArgumentNullException(nameof(source));
}
return (Point)source.CompositionTarget.TransformToDevice.Transform((Vector)wpfSize);
}
示例5: KinectTouchDevice
public KinectTouchDevice(int id, PresentationSource source)
: base(id)
{
this.Position = new Point();
this.TouchState = TouchState.Up;
this.SetActiveSource(source);
}
示例6: TryClientToRoot
public static Point TryClientToRoot(Point point, PresentationSource source, bool throwOnError, out bool success)
{
success = default(bool);
object[] parameters = new object[] { point, source, throwOnError, success };
Point result = (Point)tryClientToRootMethod.Invoke(null, parameters);
success = (bool)parameters[3];
return result;
}
示例7: GetResolution
public static int GetResolution(PresentationSource source) {
if (source == null) {
throw new ArgumentNullException(nameof(source));
}
int res = (int)(96 * source.CompositionTarget.TransformToDevice.M11);
return res;
}
示例8: PresentationSourceTreeItem
public PresentationSourceTreeItem(PresentationSource presentationSource, TreeModel model, TreeType treeType)
: base(presentationSource, null, model, 0)
{
Name = "PresentationSource";
IsExpanded = true;
_treeType = treeType;
_presentationSource = presentationSource;
}
示例9: KinectMultiTouchDevice
public KinectMultiTouchDevice(IHandDataSource handDataSource, FrameworkElement area)
{
this.touchDevices = new Dictionary<int, KinectTouchDevice>();
this.TargetSize = new Size(area.ActualWidth, area.ActualHeight);
this.presentationSource = PresentationSource.FromVisual(area);
this.handDataSource = handDataSource;
handDataSource.NewDataAvailable += new Core.NewDataHandler<HandCollection>(handDataSource_NewDataAvailable);
area.SizeChanged += new SizeChangedEventHandler(area_SizeChanged);
}
示例10: RootToClient
internal static Rect RootToClient(Rect rectRoot, PresentationSource presentationSource)
{
CompositionTarget target = presentationSource.CompositionTarget;
Matrix matrixRootTransform = PointUtil.GetVisualTransform(target.RootVisual);
Rect rectRootUntransformed = Rect.Transform(rectRoot, matrixRootTransform);
Matrix matrixDPI = target.TransformToDevice;
Rect rectClient = Rect.Transform(rectRootUntransformed, matrixDPI);
return rectClient;
}
示例11: SourceChangedEventArgs
public SourceChangedEventArgs(PresentationSource oldSource,
PresentationSource newSource,
IInputElement element,
IInputElement oldParent)
{
_oldSource = new SecurityCriticalData<PresentationSource>(oldSource);
_newSource = new SecurityCriticalData<PresentationSource>(newSource);
_element = element;
_oldParent = oldParent;
}
示例12: RawAppCommandInputReport
/// <summary>
/// Constructs ad instance of the RawAppCommandInputReport class.
/// </summary>
/// <param name="inputSource">
/// The input source that provided this input.
/// </param>
/// <param name="mode">
/// The mode in which the input is being provided.
/// </param>
/// <param name="timestamp">
/// The time when the input occured.
/// </param>
/// <param name="appCommand">
/// The Application Command associated.
/// </param>
/// <param name="device">
/// The device that generated the app command.
/// </param>
/// <param name="inputType">the input device that generated the input event</param>
internal RawAppCommandInputReport(
PresentationSource inputSource,
InputMode mode,
int timestamp,
int appCommand,
InputType device,
InputType inputType) : base(inputSource, inputType, mode, timestamp)
{
_appCommand = appCommand;
_device = device;
}
示例13: PenContexts
internal PenContexts(StylusLogic stylusLogic, PresentationSource inputSource)
{
HwndSource hwndSource = inputSource as HwndSource;
if(hwndSource == null || IntPtr.Zero == (hwndSource).CriticalHandle)
{
throw new InvalidOperationException(SR.Get(SRID.Stylus_PenContextFailure));
}
_stylusLogic = stylusLogic;
_inputSource = new SecurityCriticalData<HwndSource>(hwndSource);
}
示例14: InputReport
protected InputReport(PresentationSource inputSource, InputType type, InputMode mode, int timestamp)
{
if (inputSource == null)
throw new ArgumentNullException("inputSource");
Validate_InputType( type );
Validate_InputMode( mode );
_inputSource= new SecurityCriticalData<PresentationSource>(inputSource);
_type = type;
_mode = mode;
_timestamp = timestamp;
}
示例15: RootToClient
public static Point RootToClient(Point point, PresentationSource presentationSource)
{
//
point = ApplyVisualTransform(point, presentationSource.RootVisual, false);
// Convert from measure units into pixels.
point = presentationSource.CompositionTarget.TransformToDevice.Transform(point);
return point;
}