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


C# Windows.PresentationSource类代码示例

本文整理汇总了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;
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:28,代码来源:RawStylusInputReport.cs

示例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);
        }
开发者ID:Microsoft,项目名称:RTVS,代码行数:7,代码来源:WpfUnitsConversion.cs

示例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;
        }
开发者ID:jugemjugem,项目名称:libShootTheSpeed,代码行数:7,代码来源:PointUtil.cs

示例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);
        }
开发者ID:Microsoft,项目名称:RTVS,代码行数:7,代码来源:WpfUnitsConversion.cs

示例5: KinectTouchDevice

 public KinectTouchDevice(int id, PresentationSource source)
     : base(id)
 {
     this.Position = new Point();
     this.TouchState = TouchState.Up;
     this.SetActiveSource(source);
 }
开发者ID:aabrohi,项目名称:kinect-kollage,代码行数:7,代码来源:KinectTouchDevice.cs

示例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;
		}
开发者ID:zhuangfangwang,项目名称:ise,代码行数:8,代码来源:PointUtil.cs

示例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;
        }
开发者ID:Microsoft,项目名称:RTVS,代码行数:8,代码来源:WpfUnitsConversion.cs

示例8: PresentationSourceTreeItem

        public PresentationSourceTreeItem(PresentationSource presentationSource, TreeModel model, TreeType treeType)
            : base(presentationSource, null, model, 0)
        {
            Name = "PresentationSource";
            IsExpanded = true;

            _treeType = treeType;
            _presentationSource = presentationSource;
        }
开发者ID:bdurrani,项目名称:WPF-Inspector,代码行数:9,代码来源:PresentationSourceTreeItem.cs

示例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);
 }
开发者ID:an83,项目名称:KinectTouch2,代码行数:9,代码来源:KinectMultiTouchDevice.cs

示例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;
        }
开发者ID:jugemjugem,项目名称:libShootTheSpeed,代码行数:10,代码来源:PointUtil.cs

示例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;
 }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:10,代码来源:SourceChangedEventArgs.cs

示例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;
 }
开发者ID:JianwenSun,项目名称:cc,代码行数:30,代码来源:RawAppCommandInputReport.cs

示例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);
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:11,代码来源:PenContexts.cs

示例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;
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:12,代码来源:InputReport.cs

示例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;
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:12,代码来源:PointUtil.cs


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