pcat 发表于 2005-4-5 14:25:00

[ARX]请教预览功能怎么实现

autocad block命令中,对话框中有个预览功能,请问在arx中如何实现这种功能?谢谢!<br>
实现的思路和方法是什么.<br>
<br>

pandoram 发表于 2005-4-7 15:26:00

..? 上次不是回答了你一个关于动态生成预览图的问题了么? 思路是一样的啊..


如果不想用BITMAP结构那么麻烦, 就直接建造临时块, 输出成.bmp再加载回来..

freejustin 发表于 2005-4-28 19:06:00

本帖最后由 作者 于 2005-4-29 14:40:39 编辑

<P class=signature>bool acdbGetPreviewBitmapFromDwg( const char* pszDwgfilename, HBITMAP* pPreviewBmp, HPALETTE* pRetPal);


pszDwgfilename The DWG file name that you want to get the preview bitmap from. pPreviewBmp Returned bitmap from the DWG. pRetPal Returned palette used to draw the bitmap correctly.This function returns the preview bitmap from a DWG file.


The following sample shows how to use this function:


<PRE>HBITMAP hBitmap;
HPALETTE hPal;
acdbGetPreviewBitmapFromDwg("foo.dwg", &amp;hBitmap, &amp;hPal);

// Palette
CPalette* oldPal = pDC-&gt;SelectPalette(CPalette::FromHandle(hPal),TRUE);
pDC-&gt;RealizePalette();

CBitmap bm;
bm.Attach(hBitmap);

CDC dcMem;
dcMem.CreateCompatibleDC(pDC);

CBitmap *pOldBitmap = dcMem.SelectObject(&amp;bm);

pDC-&gt;BitBlt(0, 0, 1000,1000, &amp;dcMem, 0, 0, SRCCOPY);

dcMem.SelectObject(pOldBitmap);

pDC-&gt;SelectPalette(oldPal,TRUE );
pDC-&gt;RealizePalette();

bm.DeleteObject();
DeleteObject(hBitmap);
DeleteObject(hPal);</PRE><PRE>请问这段代码到底怎么用?单文档?要是对话框的怎么用呀</PRE>
页: [1]
查看完整版本: [ARX]请教预览功能怎么实现