Home > Software engineering >  MFC dialog box how to display thumbnail, consult
MFC dialog box how to display thumbnail, consult

Time:10-10

In MFC dialog box shown in the thumbnail, show a blank, use the following code helps
don't know why,Add the following code in OnInitDialog ()
M_nail_llist. SetExtendedStyle (LVS_ALIGNTOP | LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
M_imagelist. Create (130130, ILC_COLOR32 | ILC_MASK, m_PicList. The size (), m_PicList. The size ());
M_nail_llist. SetImageList (& amp; M_imagelist, LVSIL_NORMAL ());
DrawThumbnail ();

Void CPicTest1Dlg: : DrawThumbnail (void)
{

For (auto it=m_PicList. The begin (); it!=m_PicList. End (); It++)
{
Bitmap BMP ((* it). AllocSysString ());
Int width=BMP. GetWidth ();
Int height=BMP. GetHeight ();
Bitmap * pThumbnail=(Bitmap *) (BMP) GetThumbnailImage (130130, NULL, NULL));

HBITMAP hBmp;
PThumbnail - & gt; GetHBITMAP (Color (255255255), & amp; HBmp);

CBitmap * pImage=CBitmap: : FromHandle (hBmp);

M_imagelist. Add (pImage, RGB (255255255));

}
M_nail_llist. SetRedraw ();
}

CodePudding user response:

Need InsertItem add project

M_nail_llist. InsertItem (0, _T (" Test "), 0).//show the zeroth figure

CodePudding user response:

The OnInitDialog () inside the code in ontouch () inside a try