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


C# GridEntry.GetPropertyTextValue方法代码示例

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


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

示例1: CommitValue

        internal bool CommitValue(GridEntry ipeCur, object value) {

            Debug.WriteLineIf(CompModSwitches.DebugGridView.TraceVerbose,  "PropertyGridView:CommitValue(" + (value==null ? "null" :value.ToString()) + ")");

            int propCount = ipeCur.ChildCount;
            bool capture = Edit.HookMouseDown;
            object originalValue = null;

            try {
                originalValue = ipeCur.PropertyValue;
            }
            catch {
                // if the getter is failing, we still want to let
                // the set happen.
            }

            try {
                try {
                    SetFlag(FlagInPropertySet, true);

                    //if this propentry is enumerable, then once a value is selected from the editor,
                    //we'll want to close the drop down (like true/false).  Otherwise, if we're
                    //working with Anchor for ex., then we should be able to select different values
                    //from the editor, without having it close every time.
                    if (ipeCur != null &&
                        ipeCur.Enumerable) {
                           CloseDropDown();
                    }

                    try {
                        Edit.DisableMouseHook = true;
                        ipeCur.PropertyValue = value;
                    }
                    finally {
                        Edit.DisableMouseHook = false;
                        Edit.HookMouseDown = capture;
                    }
                }
                catch (Exception ex) {
                    SetCommitError(ERROR_THROWN);
                    ShowInvalidMessage(ipeCur.PropertyLabel, value, ex);
                    return false;
                }
            }
            finally {
                SetFlag(FlagInPropertySet, false);
            }

            SetCommitError(ERROR_NONE);

            string text = ipeCur.GetPropertyTextValue();
            if (!String.Equals(text, Edit.Text)) {
                Edit.Text = text;
                Edit.SelectionStart = 0;
                Edit.SelectionLength = 0;
            }
            originalTextValue = text;

            // Update our reset command.
            //
            UpdateResetCommand(ipeCur);

            if (ipeCur.ChildCount != propCount) {
                ClearGridEntryEvents(allGridEntries, 0, -1);
                allGridEntries = null;
                SelectGridEntry(ipeCur, true);
            }

            // in case this guy got disposed...
            if (ipeCur.Disposed) {
                bool editfocused = (edit != null && edit.Focused);
                
                // reselect the row to find the replacement.
                //
                SelectGridEntry(ipeCur, true);
                ipeCur = selectedGridEntry;

                if (editfocused && edit != null) {
                    edit.Focus();
                }
            }

            this.ownerGrid.OnPropertyValueSet(ipeCur, originalValue);

            return true;
        }
开发者ID:mind0n,项目名称:hive,代码行数:86,代码来源:PropertyGridView.cs

示例2: CommitValue

 internal bool CommitValue(GridEntry ipeCur, object value)
 {
     int childCount = ipeCur.ChildCount;
     bool hookMouseDown = this.Edit.HookMouseDown;
     object oldValue = null;
     try
     {
         oldValue = ipeCur.PropertyValue;
     }
     catch
     {
     }
     try
     {
         this.SetFlag(0x10, true);
         if ((ipeCur != null) && ipeCur.Enumerable)
         {
             this.CloseDropDown();
         }
         try
         {
             this.Edit.DisableMouseHook = true;
             ipeCur.PropertyValue = value;
         }
         finally
         {
             this.Edit.DisableMouseHook = false;
             this.Edit.HookMouseDown = hookMouseDown;
         }
     }
     catch (Exception exception)
     {
         this.SetCommitError(1);
         this.ShowInvalidMessage(ipeCur.PropertyLabel, value, exception);
         return false;
     }
     finally
     {
         this.SetFlag(0x10, false);
     }
     this.SetCommitError(0);
     string propertyTextValue = ipeCur.GetPropertyTextValue();
     if (!string.Equals(propertyTextValue, this.Edit.Text))
     {
         this.Edit.Text = propertyTextValue;
         this.Edit.SelectionStart = 0;
         this.Edit.SelectionLength = 0;
     }
     this.originalTextValue = propertyTextValue;
     this.UpdateResetCommand(ipeCur);
     if (ipeCur.ChildCount != childCount)
     {
         this.ClearGridEntryEvents(this.allGridEntries, 0, -1);
         this.allGridEntries = null;
         this.SelectGridEntry(ipeCur, true);
     }
     if (ipeCur.Disposed)
     {
         bool flag2 = (this.edit != null) && this.edit.Focused;
         this.SelectGridEntry(ipeCur, true);
         ipeCur = this.selectedGridEntry;
         if (flag2 && (this.edit != null))
         {
             this.edit.Focus();
         }
     }
     this.ownerGrid.OnPropertyValueSet(ipeCur, oldValue);
     return true;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:69,代码来源:PropertyGridView.cs


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