SubClass() public method

public SubClass ( IntPtr owner ) : void
owner System.IntPtr
return void
示例#1
0
        private void Show()
        {
            if (InputManager.Current.IsInMenuMode)
            {
                return;
            }

            if (_hintWindow != null)
            {
                throw new NotSupportedException("Hint already shown");
            }

            // subclass
            _hintSource           = new HintSource();
            _hintSource.Activate += Close;
            _hintSource.SubClass();

            // create hint window
            var ht = HintRoot.Create(PlacementRect, _hintSource);

            _hintWindow = new HintWindow(this, ht)
            {
                Text = _text
            };

            if (BackgroundResourceReference != null)
            {
                _hintWindow.border.SetResourceReference(Border.BackgroundProperty, BackgroundResourceReference);
            }

            if (ForegroundResourceReference != null)
            {
                _hintWindow._textBlock.SetResourceReference(TextBlock.ForegroundProperty, ForegroundResourceReference);
            }

            _hintSource.HintWindow = _hintWindow;
            //new WindowInteropHelper(_hintWindow) { Owner = _hintSource.Owner };
            _hintWindow.Closed   += HintWindowClosed;
            _hintWindow.MaxHeight = 1200.0;//System.Windows.Forms.Screen.FromRectangle(PlacementRect).WorkingArea.
            _wrapWidth            = 1200.0;

            _hintWindow.WrapWidth = _wrapWidth;
            _hintWindow.Show();
        }
示例#2
0
文件: Hint.cs 项目: JetBrains/Nitra
        private void Show(IntPtr owner)
        {
            if (InputManager.Current.IsInMenuMode)
            return;

              if (_hintWindow != null)
            throw new NotSupportedException("Hint already shown");

              // subclass
              _hintSource = new HintSource();
              _hintSource.Activate += Close;
              _hintSource.SubClass(owner);

              // create hint window
              var ht = HintRoot.Create(PlacementRect, _hintSource);
              _hintWindow = new HintWindow(this, ht) { Text = _text };

              if (BackgroundResourceReference != null)
            _hintWindow.border.SetResourceReference(Border.BackgroundProperty, BackgroundResourceReference);

              if (ForegroundResourceReference != null)
            _hintWindow._textBlock.SetResourceReference(TextBlock.ForegroundProperty, ForegroundResourceReference);

              _hintSource.HintWindow = _hintWindow;
              //new WindowInteropHelper(_hintWindow) { Owner = _hintSource.Owner };
              _hintWindow.Closed += HintWindowClosed;
              _hintWindow.MaxHeight = 1200.0;//System.Windows.Forms.Screen.FromRectangle(PlacementRect).WorkingArea.
              _wrapWidth = 1200.0;

              _hintWindow.WrapWidth = _wrapWidth;
              _hintWindow.Show();
        }