本文整理汇总了C#中VisualHint.SmartPropertyGrid.PropertyEnumerator类的典型用法代码示例。如果您正苦于以下问题:C# PropertyEnumerator类的具体用法?C# PropertyEnumerator怎么用?C# PropertyEnumerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PropertyEnumerator类属于VisualHint.SmartPropertyGrid命名空间,在下文中一共展示了PropertyEnumerator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowControl
public override Control ShowControl(Rectangle valueRect, PropertyEnumerator propEnum)
{
// if (propEnum.Property.Value.IsReadOnly(propEnum))
// return null;
PropInPlaceUITypeEditor inPlaceCtrl;
if (mInPlaceCtrl == null)
{
inPlaceCtrl = new PropInPlaceUITypeEditor(_editor, true);
inPlaceCtrl.Visible = false;
inPlaceCtrl.Parent = mParentWnd;
mInPlaceCtrl = inPlaceCtrl;
}
else
inPlaceCtrl = (PropInPlaceUITypeEditor)mInPlaceCtrl;
NotifyInPlaceControlCreated(propEnum);
/*
if (propEnum.Property.Value.HasMultipleValues)
inPlaceCtrl.Text = "";
else
inPlaceCtrl.Text = propEnum.Property.Value.DisplayString;
*/
inPlaceCtrl.OwnerPropertyEnumerator = propEnum;
inPlaceCtrl.Font = propEnum.Property.Value.Font;
MoveControl(valueRect, propEnum);
return base.ShowControl(valueRect, propEnum);
}
示例2: MoveControl
public override void MoveControl(Rectangle valueRect, PropertyEnumerator propEnum)
{
if (mInPlaceCtrl == null)
return;
mInPlaceCtrl.BackColor = propEnum.Property.Value.BackColor;
// Find where the string is actually displayed (a look instance could place it anywhere)
Graphics graphics = mParentWnd.CreateGraphics();
Rectangle strRect = propEnum.Property.Value.GetStringValueRect(graphics, valueRect, Point.Empty /* not used */);
strRect.X -= (propEnum.Property.Value.EditboxLeftMargin == -1 ?
propEnum.Property.ParentGrid.GlobalTextMargin :
propEnum.Property.Value.EditboxLeftMargin);
strRect.Width = valueRect.Right - strRect.Left;
// Calculate the height of the editbox, based on the font height
Rectangle editRect = strRect;
editRect.Inflate(0,-1);
Win32Calls.TEXTMETRIC tm = new Win32Calls.TEXTMETRIC();
Win32Calls.GetTextMetrics(graphics, mInPlaceCtrl.Font, ref tm);
graphics.Dispose();
int extraHeight = editRect.Height - tm.tmHeight;
editRect.Y += extraHeight / 2;
editRect.Height -= extraHeight;
if (mInPlaceCtrl.Bounds != editRect)
mInPlaceCtrl.Bounds = editRect;
}
示例3: ValueValidationEventArgs
public ValueValidationEventArgs(PropertyEnumerator propEnum, PropertyEnumerator invalidPropEnum, object value, PropertyValue.ValueValidationResult result)
: base(propEnum)
{
_valueValidationResult = result;
_valueToValidate = value;
_invalidPropEnum = invalidPropEnum;
}
示例4: ShowControl
public override System.Windows.Forms.Control ShowControl(Rectangle valueRect, PropertyEnumerator propEnum)
{
PropInPlaceTextbox edit = null;
if (mInPlaceCtrl == null)
{
edit = new PropInPlaceTextbox(false);
edit.Visible = false;
edit.Parent = mParentWnd;
edit.Multiline = true;
mInPlaceCtrl = edit;
}
else
edit = (PropInPlaceTextbox)mInPlaceCtrl;
NotifyInPlaceControlCreated(propEnum);
edit.OwnerPropertyEnumerator = propEnum;
edit.Font = propEnum.Property.Value.Font;
MoveControl(valueRect, propEnum);
if (edit.Focused == false) // are we already being editing ? If yes, don't touch the edit content
{
if (edit.Text != propEnum.Property.Value.DisplayString)
edit.Text = propEnum.Property.Value.DisplayString;
}
return base.ShowControl(valueRect, propEnum);
}
示例5: ShowControl
public override Control ShowControl(Rectangle valueRect, PropertyEnumerator propEnum)
{
if (DontShowInPlaceCtrl(propEnum))
return null;
PropInPlaceList list;
if (mInPlaceCtrl == null)
{
list = new PropInPlaceList(_editable);
list.Visible = false;
list.Parent = mParentWnd;
mInPlaceCtrl = list;
}
else
list = (PropInPlaceList)mInPlaceCtrl;
NotifyInPlaceControlCreated(propEnum);
// list.Text = propEnum.Property.Value.DisplayString;
list.OwnerPropertyEnumerator = propEnum;
list.Font = propEnum.Property.Value.Font;
MoveControl(valueRect, propEnum);
return base.ShowControl(valueRect, propEnum);
}
示例6: DrawCategoryLabelBackground
public override void DrawCategoryLabelBackground(Graphics graphics, Rectangle rect, PropertyEnumerator enumSelf)
{
Rectangle fillRect = Rectangle.Intersect(rect, Rectangle.Round(graphics.ClipBounds));
if (fillRect.IsEmpty)
return;
Brush brush;
if (enumSelf.Property.Selected) // if selected
{
Color bkgColor;
if (Grid.GridContainsFocus)
bkgColor = Grid.SelectedBackColor;
else
{
// If the control has not the focus, the background is light
bkgColor = Grid.SelectedNotFocusedBackColor;
}
brush = new SolidBrush(bkgColor);
}
else
brush = new SolidBrush(Grid.GridBackColor);
graphics.FillRectangle(brush, rect);
}
示例7: ShowControl
public override Control ShowControl(Rectangle valueRect, PropertyEnumerator propEnum)
{
if ((propEnum.Property.Value.IsReadOnly(propEnum)) && !_editable)
return null;
PropInPlaceButton button;
if (mInPlaceCtrl == null)
{
button = new PropInPlaceButton(_editable);
button.Visible = false;
button.Parent = mParentWnd;
mInPlaceCtrl = button;
}
else
button = (PropInPlaceButton)mInPlaceCtrl;
NotifyInPlaceControlCreated(propEnum);
// button.Text = propEnum.Property.Value.DisplayString;
button.OwnerPropertyEnumerator = propEnum;
button.Font = propEnum.Property.Value.Font;
MoveControl(valueRect, propEnum);
return base.ShowControl(valueRect, propEnum);
}
示例8: OnDraw
public override void OnDraw(Graphics graphics, Rectangle valueRect, Color textColor, PropertyEnumerator propEnum, string drawAnotherString)
{
valueRect.Height++;
Rectangle colorRect = GetColorRect(valueRect);
// Draw the color box
Color color;
try
{
color = (Color)Value.GetActualValue(drawAnotherString);
}
catch (Exception)
{
color = (Color)Value.GetValue();
}
Brush brush = new SolidBrush(color);
graphics.FillRectangle(brush, colorRect);
if (propEnum.Property.Value.HasMultipleValues)
graphics.DrawLine(SystemPens.GrayText, colorRect.Left, colorRect.Bottom, colorRect.Right, colorRect.Top);
// Draw a black frame around
Pen pen = new Pen(Color.Black);
graphics.DrawRectangle(pen, colorRect);
pen.Dispose();
Rectangle strRect = GetDisplayStringRect(graphics, valueRect, Point.Empty /* not used */);
strRect.Width = valueRect.Right - strRect.Left;
Win32Calls.DrawText(graphics, (drawAnotherString == null ? DisplayString : drawAnotherString),
ref strRect, Value.Font, textColor,
Win32Calls.DT_VCENTER | Win32Calls.DT_SINGLELINE | Win32Calls.DT_END_ELLIPSIS | Win32Calls.DT_NOPREFIX);
}
示例9: ShowControl
public override Control ShowControl(Rectangle valueRect, PropertyEnumerator propEnum)
{
if ((propEnum.Property.Value.IsReadOnly(propEnum)) && !_editable)
return null;
PropInPlaceTrackbar trackbar;
if (mInPlaceCtrl == null)
{
trackbar = new PropInPlaceTrackbar(_editable);
trackbar.Visible = false;
trackbar.Parent = mParentWnd;
mInPlaceCtrl = trackbar;
}
else
trackbar = (PropInPlaceTrackbar)mInPlaceCtrl;
NotifyInPlaceControlCreated(propEnum);
trackbar.OwnerPropertyEnumerator = propEnum;
trackbar.Font = propEnum.Property.Value.Font;
MoveControl(valueRect, propEnum);
return base.ShowControl(valueRect, propEnum);
}
示例10: ShowControl
public override Control ShowControl(Rectangle valueRect, PropertyEnumerator propEnum)
{
if ((propEnum.Property.Value.IsReadOnly(propEnum)) && !_editable)
return null;
PropInPlaceColorChooser colorChooser;
if (mInPlaceCtrl == null)
{
colorChooser = new PropInPlaceColorChooser(_editable);
colorChooser.Visible = false;
colorChooser.Parent = mParentWnd;
mInPlaceCtrl = colorChooser;
}
else
colorChooser = (PropInPlaceColorChooser)mInPlaceCtrl;
colorChooser.Font = propEnum.Property.Value.Font;
colorChooser.Text = propEnum.Property.Value.DisplayString;
MoveControl(valueRect, propEnum, false);
colorChooser.OwnerPropertyEnumerator = propEnum;
return base.ShowControl(valueRect, propEnum);
}
示例11: ShowControl
public override System.Windows.Forms.Control ShowControl(Rectangle valueRect, PropertyEnumerator propEnum)
{
if ((propEnum.Property.Value.IsReadOnly(propEnum)) && !_editable)
return null;
PropInPlaceUpDown upDown;
if (mInPlaceCtrl == null)
{
upDown = new PropInPlaceUpDown(_editable);
upDown.Visible = false;
upDown.Parent = mParentWnd;
mInPlaceCtrl = upDown;
}
else
upDown = (PropInPlaceUpDown)mInPlaceCtrl;
NotifyInPlaceControlCreated(propEnum);
// upDown.Text = propEnum.Property.Value.DisplayString;
upDown.OwnerPropertyEnumerator = propEnum;
upDown.Font = propEnum.Property.Value.Font;
MoveControl(valueRect, propEnum);
return base.ShowControl(valueRect, propEnum);
}
示例12: DrawCategoryLabelBackground
public override void DrawCategoryLabelBackground(Graphics graphics, Rectangle rect, PropertyEnumerator enumSelf)
{
Rectangle fillRect = Rectangle.Intersect(rect, Rectangle.Round(graphics.ClipBounds));
if (fillRect.IsEmpty)
return;
Rectangle labelRect = enumSelf.Property.GetLabelColumnRect(rect, enumSelf);
rect.Y++;
rect.Height -= 3;
fillRect = rect;
int margin = enumSelf.Property.ParentGrid.GlobalTextMargin;
fillRect.X = labelRect.Left + margin / 2;
fillRect.Width = rect.Right - fillRect.Left;
Brush brush;
if (enumSelf.Property.Selected) // if selected
brush = new SolidBrush(Grid.GridContainsFocus ? Grid.SelectedBackColor : Grid.SelectedNotFocusedBackColor);
else
brush = new LinearGradientBrush(fillRect, _categoryBkgColor1, _categoryBkgColor2, 0.0f);
graphics.FillRectangle(brush, fillRect);
brush.Dispose();
}
示例13: GetLabelColumnRect
public override Rectangle GetLabelColumnRect(Rectangle itemRect, PropertyEnumerator enumerator)
{
Rectangle labelRect = itemRect;
labelRect.X = ParentGrid.LeftColumnWidth + 1;
labelRect.Width = itemRect.Right - labelRect.Left;
return labelRect;
}
示例14: PropertyTypeDescriptorContext
public PropertyTypeDescriptorContext(PropertyDescriptor descriptor, object instance,
PropertyEnumerator propEnum, PropertyGrid propGrid)
{
_descriptor = descriptor;
_targetInstance = instance;
_propEnum = propEnum;
_propertyGrid = propGrid;
}
示例15: DrawLeftColumnBackground
public override void DrawLeftColumnBackground(Graphics graphics, Rectangle rect, PropertyEnumerator propEnum)
{
Rectangle fillRect = Rectangle.Intersect(rect, Rectangle.Round(graphics.ClipBounds));
if (fillRect.IsEmpty)
return;
using(SolidBrush brush = new SolidBrush(Grid.GridColor))
graphics.FillRectangle(brush, fillRect);
}