How to display a DWG preview using MFC function ??

How to display a DWG preview using MFC function ??

Anonymous
Not applicable
588 Views
3 Replies
Message 1 of 4

How to display a DWG preview using MFC function ??

Anonymous
Not applicable
Can't found on article 5298 the downloadfile 5298.zip
any idear for a example ??

Best regards

Georg
0 Likes
589 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
I'll give you a sample on how to show the preview image in a dialog

-Create a dialog using ClassWizard.
-Create a Picture object in your dialog. In the properties, set the type to
rectangle and the color to black.
-Change the ID of the picture from IDC_STATIC to IDC_PREVIEW (for example)
-Using ClassWizard, create a member variable of the type CStatic to this
control. Name it as m_preview
-Create a button in your dialog and put the cond below on it:

CFileDialog fileDlg( TRUE, ".dwg", NULL, OFN_OVERWRITEPROMPT, "AutoCAD
Drawings (*.dwg)|*.dwg||", this);

if ( fileDlg.DoModal() == IDOK )
{
CString szDwg;
szDwg = fileDlg.GetPathName();
Adesk::UInt32 color = 0;
acdbDisplayPreviewFromDwg(szDwg, m_preview.m_hWnd, &color);
}

-Include stdarx.h in your dialog.

I tested it before post here and it worked.

Vinicius


Georg Erlenhoff escreveu nas notícias de
mensagem:300A67A26326DB18DAF3EF47A78B39EC@in.WebX.maYIadrTaRb...
Can't found on article 5298 the downloadfile 5298.zip
any idear for a example ??

Best regards

Georg
0 Likes
Message 3 of 4

Anonymous
Not applicable
This will work, but it will be erased the first time
your window is repainted.

To do this, you either need to call acdbDisplayPreviewFromDwg()
from your OnPaint() handler (ouch!), or better, cache the image
in a memory DC and bitblt to the window DC from OnPaint().

So it may be better to get the bitmap directly by calling
acdbGetPreviewBitmapFromDwg() and then display it in your
OnPaint() handler.

"Vinicius Pontes" wrote in message
news:03D2AA9B98590B8F6302180AB78C6E25@in.WebX.maYIadrTaRb...
> I'll give you a sample on how to show the preview image in a dialog
>
> -Create a dialog using ClassWizard.
> -Create a Picture object in your dialog. In the properties, set the type
to
> rectangle and the color to black.
> -Change the ID of the picture from IDC_STATIC to IDC_PREVIEW (for example)
> -Using ClassWizard, create a member variable of the type CStatic to this
> control. Name it as m_preview
> -Create a button in your dialog and put the cond below on it:
>
> CFileDialog fileDlg( TRUE, ".dwg", NULL, OFN_OVERWRITEPROMPT, "AutoCAD
> Drawings (*.dwg)|*.dwg||", this);
>
> if ( fileDlg.DoModal() == IDOK )
> {
> CString szDwg;
> szDwg = fileDlg.GetPathName();
> Adesk::UInt32 color = 0;
> acdbDisplayPreviewFromDwg(szDwg, m_preview.m_hWnd, &color);
> }
>
> -Include stdarx.h in your dialog.
>
> I tested it before post here and it worked.
>
> Vinicius
>
>
> Georg Erlenhoff escreveu nas notícias de
> mensagem:300A67A26326DB18DAF3EF47A78B39EC@in.WebX.maYIadrTaRb...
> Can't found on article 5298 the downloadfile 5298.zip
> any idear for a example ??
>
> Best regards
>
> Georg
>
>
>
>
>
>
>
0 Likes
Message 4 of 4

Anonymous
Not applicable
How I can get the Bitmap to create a BitmapButton ??
Some source there ??

Thanks
Georg

"Tony Tanzillo" schrieb im Newsbeitrag
news:E113F7F83ED7F49F57121BCB615DA347@in.WebX.maYIadrTaRb...
> This will work, but it will be erased the first time
> your window is repainted.
>
> To do this, you either need to call acdbDisplayPreviewFromDwg()
> from your OnPaint() handler (ouch!), or better, cache the image
> in a memory DC and bitblt to the window DC from OnPaint().
>
> So it may be better to get the bitmap directly by calling
> acdbGetPreviewBitmapFromDwg() and then display it in your
> OnPaint() handler.
>
> "Vinicius Pontes" wrote in message
> news:03D2AA9B98590B8F6302180AB78C6E25@in.WebX.maYIadrTaRb...
> > I'll give you a sample on how to show the preview image in a dialog
> >
> > -Create a dialog using ClassWizard.
> > -Create a Picture object in your dialog. In the properties, set the type
> to
> > rectangle and the color to black.
> > -Change the ID of the picture from IDC_STATIC to IDC_PREVIEW (for
example)
> > -Using ClassWizard, create a member variable of the type CStatic to this
> > control. Name it as m_preview
> > -Create a button in your dialog and put the cond below on it:
> >
> > CFileDialog fileDlg( TRUE, ".dwg", NULL, OFN_OVERWRITEPROMPT, "AutoCAD
> > Drawings (*.dwg)|*.dwg||", this);
> >
> > if ( fileDlg.DoModal() == IDOK )
> > {
> > CString szDwg;
> > szDwg = fileDlg.GetPathName();
> > Adesk::UInt32 color = 0;
> > acdbDisplayPreviewFromDwg(szDwg, m_preview.m_hWnd, &color);
> > }
> >
> > -Include stdarx.h in your dialog.
> >
> > I tested it before post here and it worked.
> >
> > Vinicius
> >
> >
> > Georg Erlenhoff escreveu nas notícias
de
> > mensagem:300A67A26326DB18DAF3EF47A78B39EC@in.WebX.maYIadrTaRb...
> > Can't found on article 5298 the downloadfile 5298.zip
> > any idear for a example ??
> >
> > Best regards
> >
> > Georg
> >
> >
> >
> >
> >
> >
> >
>
>
0 Likes