HIconicDisplayObjectWPF类学习
HIconicDisplayObjectWPF属于HalconDotNet命名空间下的一个子类,继承于HDisplayObjectWPF。
1.关于HDisplayObjectWPF
继承FrameworkElement,实现了IDisposable接口。
主要函数应该是 public abstract void Display(HWindow hWindow);
2.HIconicDisplayObjectWPF类中有以下依赖性属性:
2.1 public HObject IconicObject { get; set; }
Can contain a HImage, HRegion or HContXLD object to display.
2.2 public string HColor { get; set; }
应该是指定窗口中HRegion或HContXLD对象的颜色,注释中有这么一句话“Color for displaying HRegion and HXLDCont objects. If HColor is set, HColored is set to null”,应该是如果指定了HColored的数量(对于多个HRegion或HContXLD),则HColor属性无效,毕竟HColored指定了多个颜色,HColor要去哪个颜色也不好取。
2.3 public int? HColored { get; set; }
Defines the colors that are used when the HRegion or HContXLD object is an iconic tuple. Overwrites default colored property of the HWindow
the object is displayed in.应该是指定可以显示多个颜色吧。
2.4 public HLineStyleWPF LineStyle { get; set; }
Line style used for drawing the margin of the HRegion or the HContXLD object.Overwrites default line style of the HWindow the object is displayed in.
2.5 public double? LineWidth { get; set; }
Line width used for drawing the margin of the HRegion or the HContXLD object.
Overwrites default line width of the HWindow the object is displayed in.
Line width of the margin of HRegion objects and of HXLDCont objects.
2.6 public string HDraw { get; set; }
Drawing mode of HRegion objects. Can either be 'margin' or 'fill'.
Overwrites default drawing mode of the HWindow the object is displayed in.
2.7 public override void Display(HWindow hWindow);
Draw this object with the specified style into a HWindow.
2.8 protected override void Dispose(bool disposing);
通过XAML中使用HIconicDisplayObjectWPF,如下
<HalconDotNet:HSmartWindowControlWPF x:Name="WindowControl"> <HalconDotNet:HIconicDisplayObjectWPF IconicObject="{Binding DisplayImage}"/> <HalconDotNet:HIconicDisplayObjectWPF IconicObject="{Binding DisplayRegion}" HDraw="{Binding ElementName=DrawSelect,Path=Text}" HColor="{Binding ElementName=ColorSelect,Path=Text}"/> <HalconDotNet:HIconicDisplayObjectWPF IconicObject="{Binding DispRectangle}"/> <HalconDotNet:HMessageDisplayObjectWPF HMessageText="{Binding DisplayText}"/> </HalconDotNet:HSmartWindowControlWPF>

浙公网安备 33010602011771号