本文整理汇总了C#中ISelectable.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# ISelectable.GetType方法的具体用法?C# ISelectable.GetType怎么用?C# ISelectable.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISelectable
的用法示例。
在下文中一共展示了ISelectable.GetType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ListBoxItem
public ListBoxItem(ISelectable target)
{
this.target = target;
var attr = target.GetType().GetCustomAttributes(typeof(CustomSelectedTypeNameAttribute), false);
if(attr.Length > 0)
{
Name = (attr[0] as CustomSelectedTypeNameAttribute).TypeName;
}
else
{
Name = target.GetType().Name;
}
Name = string.Format("{0,-20} {1}", Name, target.NameInObjectList);
}
示例2: ShowProperties
List<PropertyInfo> ShowProperties(ISelectable obj, PropertyInfo[] properties)
{
this._obj = obj;
List<PropertyInfo> showList = new List<PropertyInfo>();
foreach (PropertyInfo property in properties)
{
System.Attribute[] attrs =
System.Attribute.GetCustomAttributes(property);
bool isShowable = false;
foreach (Attribute attr in attrs)
isShowable |= (attr is MyShowProperty) ?
true : false;
if (!isShowable)
continue;
if//Escape when existing same property
(showList.Exists(
delegate(PropertyInfo matcher)
{
return matcher.Name == property.Name ? true : false;
})
)
continue;
showList.Add(property);
}
for (int row = 0; row<showList.Count;row++)
{
Label label = new Label();
TextBox textBox = new TextBox();
label.AutoSize = true;
label.Location = new System.Drawing.Point(0, 0);
label.Size = new System.Drawing.Size(139, 20);
label.Location = new System.Drawing.Point(0, 0);
label.TabIndex = 1;
//label.Text = property.Name;
label.Text = LanguagePack.GetNm(obj.GetType(), row);
textBox.Location = new System.Drawing.Point(0, 0);
textBox.Name = "textBox_" + showList[row].Name;
textBox.Size = new System.Drawing.Size(90, 30);
if (showList[row].Name == "ObjColor")
{
textBox.Click += this.TextBoxClick;
}
Binding b = new Binding("Text", obj, showList[row].Name, true, DataSourceUpdateMode.OnValidation);
b.Format+=new ConvertEventHandler(b_Format);
b.Parse +=new ConvertEventHandler(b_Parse);
b.BindingComplete +=new BindingCompleteEventHandler(b_BindingComplete);
textBox.DataBindings.Add(b);
textBox.Validated+=new EventHandler(textBox_Validated);
textBox.Validating += new CancelEventHandler(textBox_Validating);
_table.Controls.Add(label, 0, row);
_table.Controls.Add(textBox, 1, row);
}// end of foreach property
return showList;
}
示例3: Info_SetSelcectedObject
public void Info_SetSelcectedObject(ISelectable obj)
{
var preview = selectedObject as IPreviewable;
if (preview != null) preview.PreviewDeactive();
if (selectedObjectControls.Count > 0)
{
for (int i = selectedObjectControls.Count - 1; i >= 0; --i)
{
RemoveControl(selectedObjectControls[i]);
}
selectedObjectControls.Clear();
}
selectedObject = obj;
if (selectedObject != null)
{
{
var str = string.Format("{0}({1})", selectedObject.NameInObjectList, selectedObject.GetType().Name);
var label = new SelectionTargetHeader(str);
AddControl(label);
selectedObjectControls.Add(label);
}
var controls = selectedObject.Controls;
if (controls != null)
{
for (int i = 0; i < controls.Length; ++i)
{
AddControl(controls[i]);
selectedObjectControls.Add(controls[i]);
}
}
else
{
var c = new Label("Warning", () => "Selected object don't have any control.(" + obj.ToString() + ")");
AddControl(c);
selectedObjectControls.Add(c);
}
}
preview = selectedObject as IPreviewable;
if (preview != null) preview.PreviewActive();
}
示例4: Show
void Show(ISelectable obj)
{
this.Initialize();
PropertyInfo[] properties = obj.GetType().GetProperties();
//row = showList.Count - 1;
List<PropertyInfo>showList=
ShowProperties( obj, properties);
_table.ColumnCount = 2;
_table.RowCount = showList.Count;
_table.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle
(System.Windows.Forms.SizeType.Percent, 50F));
_table.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle
(System.Windows.Forms.SizeType.Percent, 50F));
this.Controls.Add(_table);
this._table.ResumeLayout(false);
this._table.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}