本文整理汇总了C#中System.Windows.Forms.Integration.PropertyMap.Item属性的典型用法代码示例。如果您正苦于以下问题:C# PropertyMap.Item属性的具体用法?C# PropertyMap.Item怎么用?C# PropertyMap.Item使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类System.Windows.Forms.Integration.PropertyMap
的用法示例。
在下文中一共展示了PropertyMap.Item属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExtendBackColorMapping
// The ExtendBackColorMapping method adds a property
// translator if a mapping already exists.
private void ExtendBackColorMapping()
{
if (elemHost.PropertyMap["BackColor"] != null)
{
elemHost.PropertyMap["BackColor"] +=
new PropertyTranslator(OnBackColorChange);
}
}
// The OnBackColorChange method assigns a specific image
// to the hosted element's Background property.
private void OnBackColorChange(object h, String propertyName, object value)
{
ElementHost host = h as ElementHost;
System.Windows.Controls.Button wpfButton =
host.Child as System.Windows.Controls.Button;
ImageBrush b = new ImageBrush(new BitmapImage(
new Uri(@"file:///C:\WINDOWS\Santa Fe Stucco.bmp")));
wpfButton.Background = b;
}
示例2: ExtendBackgroundMapping
// The ExtendBackgroundMapping method adds a property
// translator if a mapping already exists.
private void ExtendBackgroundMapping()
{
if (wfHost.PropertyMap["Background"] != null)
{
wfHost.PropertyMap["Background"] += new PropertyTranslator(OnBackgroundChange);
}
}
// The OnBackgroundChange method assigns a specific image
// to the hosted control's BackgroundImage property.
private void OnBackgroundChange(object h, String propertyName, object value)
{
WindowsFormsHost host = h as WindowsFormsHost;
System.Windows.Forms.CheckBox cb = host.Child as System.Windows.Forms.CheckBox;
ImageBrush b = value as ImageBrush;
if (b != null)
{
cb.BackgroundImage = new System.Drawing.Bitmap(@"C:\WINDOWS\Santa Fe Stucco.bmp");
}
}