本文整理汇总了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;
}
示例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;
}