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


C# HwndSource.?.AddHook方法代码示例

本文整理汇总了C#中System.Windows.Interop.HwndSource.?.AddHook方法的典型用法代码示例。如果您正苦于以下问题:C# HwndSource.?.AddHook方法的具体用法?C# HwndSource.?.AddHook怎么用?C# HwndSource.?.AddHook使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Interop.HwndSource的用法示例。


在下文中一共展示了HwndSource.?.AddHook方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnSourceInitialized

 protected override void OnSourceInitialized(EventArgs e)
 {
     _hwndSource = (HwndSource) PresentationSource.FromVisual(this);
     _hwndSource?.AddHook(WndProcHook);
     UpdateWindowStyle();
     base.OnSourceInitialized(e);
 }
开发者ID:vebin,项目名称:ModernApplicationFramework,代码行数:7,代码来源:WindowBase.cs

示例2: OnSourceInitialized

        private void OnSourceInitialized(object sender, EventArgs e)
        {
            _source = (HwndSource)PresentationSource.FromVisual(this);

            // calculate the DPI used by WPF; this is the same as the system DPI
            if (_source?.CompositionTarget != null)
            {
                var matrix = _source.CompositionTarget.TransformToDevice;

                DpiInformation = new DpiInformation(96D * matrix.M11, 96D * matrix.M22);
            }

            if (!_isPerMonitorDpiAware) return;
            _source?.AddHook(WndProc);

            RefreshMonitorDpi();
        }
开发者ID:leovard,项目名称:Istar.ModernUI,代码行数:17,代码来源:DpiAwareWindow.cs

示例3: AddHook

 private void AddHook(Visual window)
 {
     if (_hwndSource != null) return;
     _hwndSource = PresentationSource.FromVisual(window) as HwndSource;
     _hwndSource?.AddHook(HwndSourceHook);
 }
开发者ID:farshad-sadri,项目名称:Windows-10-Login-Background-Changer,代码行数:6,代码来源:SystemMenuHelper.cs

示例4: OnLoaded

 private void OnLoaded(object sender, RoutedEventArgs e)
 {
     Loaded -= OnLoaded;
     OnThemeChanged(null, null);
     this.SetParentToMainWindowOf(Model.Root.Manager);
     _hwndSrc = PresentationSource.FromDependencyObject(this) as HwndSource;
     _hwndSrcHook = FilterMessage;
     _hwndSrc?.AddHook(_hwndSrcHook);
 }
开发者ID:vebin,项目名称:ModernApplicationFramework,代码行数:9,代码来源:LayoutFloatingWindowControl.cs

示例5: OnSourceInitialized

        //--------------------------------------------------------------
        /// <summary>
        /// Raises the <see cref="Window.SourceInitialized"/> event.
        /// </summary>
        /// <param name="e">An <see cref="EventArgs"/> that contains the event data.</param>
        protected override void OnSourceInitialized(EventArgs e)
        {
            // Add hook to intercept window messages.
            _hwndSource = HwndSource.FromHwnd(new WindowInteropHelper(this).Handle);
            _hwndSource?.AddHook(WindowMessageHandler);

            base.OnSourceInitialized(e);
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:13,代码来源:FloatWindow.cs


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