- UID
- 658062
- 积分
- 2147
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2008-10-22
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
Drawing preview in WPF palette By Balaji Ramamoorthy
As you may already know, the BlockView .Net sample demonstrates the use of Graphics system to preview a drawing in a Windows form. The migrated sample that works with AutoCAD 2015 is available here.
To get the preview displayed inside a WPF user control hosted in an AutoCAD palette, poses a small problem. In that sample, as the "GraphicsManager.CreateAutoCADDevice" requires a Window handle to display the graphics, there is no direct way to get the display in a WPF user control. In a WPF window, the controls are managed by the top level window and there are no individual handles assigned separately for the controls. Because of this difference, the only way to get this working in WPF is to host the Windows user control that displays the preview in a WindowsFormsHost.
The attached sample is a modified version of the BlockView .Net sample that demonstrates this. Download Modified BlockView.NET
To try it, netload the dll and run the "bviewpal" command. To preview a drawing, click on the button in the palette and browse to a drawing.
Here is a screenshot of the WPF palette previewing a drawing :
|
|