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


C# PropertyEnumerator.GetVisibleDeepEnumerator方法代码示例

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


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

示例1: ExpandProperty

        public void ExpandProperty(PropertyEnumerator propEnum, bool expand)
        {
            if (propEnum == propEnum.RightBound)
                return;

            Property property = propEnum.Property;

            // Do nothing if the expand state won't change
            if (expand == property.Expanded)
                return;

            InvalidateVisibleItemCount();

            // Hide the inplace control if it is a child of the closed category
            if (property.Expanded && !expand)
            {
                if (SelectedPropertyEnumerator.IsDescendantOf(propEnum))
                    SelectProperty(propEnum);

                if (FirstDisplayedProperty.IsDescendantOf(propEnum))
                    FirstDisplayedProperty = propEnum.GetVisibleDeepEnumerator();
            }

            property.ExpandedInternal = expand;

            _parentCtrl.OnPropertyExpanded(new PropertyExpandedEventArgs(propEnum, expand));

            if (IsHandleCreated)
            {
                // We call OnSizeChanged here because this method checks to see if there
                // is some space left at the bottom of the grid and scrolls it accordingly.
                // It also calls CheckScrollbar()
                Rectangle rect = ClientRectangle;
                OnSizeChanged(rect.Width, rect.Height);

                Invalidate();
            }
        }
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:38,代码来源:InternalGrid.cs

示例2: EnsureVisible

        public bool EnsureVisible(PropertyEnumerator propEnum)
        {
	        if (propEnum == propEnum.RightBound)
		        return false;

	        if (_displayMode == PropertyGrid.DisplayModes.Categorized)
	        {
		        // Ensure that all ancestors are expanded and visible
                PropertyEnumerator parentEnum = propEnum;
                while(parentEnum.HasParent)
                {
                    parentEnum = parentEnum.Parent;
                    if (parentEnum.Property.Expanded == false)
                    {
                        ShowProperty(parentEnum, true);
                        ExpandProperty(parentEnum, true);
                    }
                }
	        }

	        Rectangle itemRect = GetAbsoluteItemRect(propEnum);
	        Rectangle clientRect = ClientRectangle;

	        // Make the item the first visible one at the top if it is above the control
	        if (itemRect.Top < clientRect.Top)
	        {
                _firstDisplayedLine = 1;
		        FirstDisplayedProperty = propEnum.GetVisibleDeepEnumerator();
	        }
	        // Make the item the last visible one at the bottom if it is below the control
	        else
	        {
		        while(itemRect.Bottom > clientRect.Bottom)
		        {
                    Win32Calls.SendMessage(Handle, Win32Calls.WM_VSCROLL, Win32Calls.MakeLong(Win32Calls.SB_LINEDOWN, 0), 0);
			        itemRect = GetAbsoluteItemRect(propEnum);
		        }
                Win32Calls.SendMessage(Handle, Win32Calls.WM_VSCROLL, Win32Calls.MakeLong(Win32Calls.SB_ENDSCROLL, 0), 0);
            }

	        // We call OnSizeChanged here because this method checks to see if there
	        // is some space left at the bottom of the grid and scrolls it accordingly.
	        // It also calls CheckScrollbar()
	        OnSizeChanged(clientRect.Width, clientRect.Height);
            Refresh();

	        return true;
        }
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:48,代码来源:InternalGrid.cs

示例3: SelectProperty

        private void SelectProperty(PropertyEnumerator enumerator, Point mousePos)
        {
            if ((enumerator.Property != null) && (CheckPropertyVisibility(enumerator) == false))
                throw new ArgumentException("The property enumerator passed to SelectProperty must point to a visible property.", "enumerator");

	        // Clear multi selected items
	        bool multiSelectionCleared = false;
	        if (!_clickWithControl && (_multiSelectedItems.Count > 0))
	        {
                foreach(PropertyVisibleDeepEnumerator currentEnum in _multiSelectedItems)
		        {
                    if (currentEnum != _selectedPropertyEnum)
                        currentEnum.Property.SelectedInternal = false;
                }

		        _multiSelectedItems.Clear();
		        multiSelectionCleared = true;
	        }

            bool selectedPropertyChanged = ((_selectedPropertyEnum != enumerator) || multiSelectionCleared);
            PropertyEnumerator previousSelectedPropertyEnum = _selectedPropertyEnum;

            if ((enumerator != enumerator.RightBound) && (enumerator.RightBound != null))
            {
                if (selectedPropertyChanged)
                {
                    if (_selectedPropertyEnum != _selectedPropertyEnum.RightBound)
                        _selectedPropertyEnum.Property.SelectedInternal = false;

                    _selectedPropertyEnum = enumerator.GetVisibleDeepEnumerator();

                    if (IsHandleCreated)
                    {
                        Rectangle clientRect = ClientRectangle;
                        Rectangle rect = GetItemRect(enumerator);

                        // Show the inplace control, even if partially visible
                        if ((rect.Top < clientRect.Bottom) && (rect.Bottom > clientRect.Top))
                            ShowInPlaceControl(enumerator, mousePos);
                    }

                    if (selectedPropertyChanged)
                        _selectedPropertyEnum.Property.SelectedInternal = true;
                }
                else
                {
                    // If the selected property didn't change we must still ensure that the text will be selected
                    // if the navigation mode says so
                    if ((_parentCtrl.NavigationKeyMode == PropertyGrid.NavigationKeyModes.TabKey) &&
                        ((_parentCtrl.TabKeyNavigationMode & PropertyGrid.TabKeyNavigationModes.TabKeyWithAutoFocus) != 0))
                    {
                        if (_currentInPlaceControl != null)
                        {
                            if (!_currentInPlaceControl.ContainsFocus)
                                FocusTextBox();
                            SelectAllText();
                        }
                    }
                }
            }
		    else if (selectedPropertyChanged)	// No item selected
		    {
                if (IsHandleCreated)
                {
				    // We hide the in-place control
    			    HideInPlaceControl();
			    }

                if (_selectedPropertyEnum.Property != null)
                    _selectedPropertyEnum.Property.SelectedInternal = false;

                _selectedPropertyEnum = enumerator.GetVisibleDeepEnumerator();
            }

            if (selectedPropertyChanged)
            {
                if (IsHandleCreated)
                {
                    if (_parentCtrl.CommentsVisibility)
                        _parentCtrl.Refresh();
                    else
                        Refresh();
                }

                // Notify the derived class
                if (_selectedPropertyEnum != RightBound)
                    _parentCtrl.OnPropertySelected(new PropertySelectedEventArgs(_selectedPropertyEnum,
                        previousSelectedPropertyEnum));
            }
        }
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:90,代码来源:InternalGrid.cs


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