Can CListCtrl display dynamic width images
up vote
0
down vote
favorite
CListCtrl can show image with image list like following code.
m_imList.Create(64,64,ILC_COLOR24,10,20);
CBitmap * pBmp = NULL;
pBmp = new CBitmap();
pBmp->LoadBitmapW(IDB_BITMAP1);
m_imList.Add(pBmp,RGB(0,0,0));
delete pBmp;
m_list.SetImageList(&m_imList,LVSIL_SMALL);
But can i show variable width size image?
mfc clistctrl
add a comment |
up vote
0
down vote
favorite
CListCtrl can show image with image list like following code.
m_imList.Create(64,64,ILC_COLOR24,10,20);
CBitmap * pBmp = NULL;
pBmp = new CBitmap();
pBmp->LoadBitmapW(IDB_BITMAP1);
m_imList.Add(pBmp,RGB(0,0,0));
delete pBmp;
m_list.SetImageList(&m_imList,LVSIL_SMALL);
But can i show variable width size image?
mfc clistctrl
1
I think you are looking for custom drawCListCtrl
, where you manually draw each image, for example to preview an image directory.
– Barmak Shemirani
Nov 11 at 5:59
1
You don't give much information about your use case. A sketch of what you want the result to look like, could be helpful. I'm assuming you want to show thumbnails of a set of images. Create the image list with the maximum size of the thumbnails. Before adding each image to the image list, scale it proportionally so that it "fills" the dimensions of the thumbnail image in the best possible way without clipping. Fill the remaining space with a background color or set the alpha value to zero to make it "transparent".
– zett42
Nov 11 at 17:35
1
Say original image size = 1024 x 768, max. thumbnail size = 50 x 50. Scaled image width = 50, scaled image height = 50 * 768 / 1024 = 37.BitBlt()
scaled image of 50 x 37 to temporary image of 50 x 50, centering it. Fill border on top and bottom with background color or set alpha value to zero. Add temporary image to image list.
– zett42
Nov 11 at 17:46
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
CListCtrl can show image with image list like following code.
m_imList.Create(64,64,ILC_COLOR24,10,20);
CBitmap * pBmp = NULL;
pBmp = new CBitmap();
pBmp->LoadBitmapW(IDB_BITMAP1);
m_imList.Add(pBmp,RGB(0,0,0));
delete pBmp;
m_list.SetImageList(&m_imList,LVSIL_SMALL);
But can i show variable width size image?
mfc clistctrl
CListCtrl can show image with image list like following code.
m_imList.Create(64,64,ILC_COLOR24,10,20);
CBitmap * pBmp = NULL;
pBmp = new CBitmap();
pBmp->LoadBitmapW(IDB_BITMAP1);
m_imList.Add(pBmp,RGB(0,0,0));
delete pBmp;
m_list.SetImageList(&m_imList,LVSIL_SMALL);
But can i show variable width size image?
mfc clistctrl
mfc clistctrl
edited Nov 11 at 5:19
asked Nov 11 at 4:51
MomAndDad
3181414
3181414
1
I think you are looking for custom drawCListCtrl
, where you manually draw each image, for example to preview an image directory.
– Barmak Shemirani
Nov 11 at 5:59
1
You don't give much information about your use case. A sketch of what you want the result to look like, could be helpful. I'm assuming you want to show thumbnails of a set of images. Create the image list with the maximum size of the thumbnails. Before adding each image to the image list, scale it proportionally so that it "fills" the dimensions of the thumbnail image in the best possible way without clipping. Fill the remaining space with a background color or set the alpha value to zero to make it "transparent".
– zett42
Nov 11 at 17:35
1
Say original image size = 1024 x 768, max. thumbnail size = 50 x 50. Scaled image width = 50, scaled image height = 50 * 768 / 1024 = 37.BitBlt()
scaled image of 50 x 37 to temporary image of 50 x 50, centering it. Fill border on top and bottom with background color or set alpha value to zero. Add temporary image to image list.
– zett42
Nov 11 at 17:46
add a comment |
1
I think you are looking for custom drawCListCtrl
, where you manually draw each image, for example to preview an image directory.
– Barmak Shemirani
Nov 11 at 5:59
1
You don't give much information about your use case. A sketch of what you want the result to look like, could be helpful. I'm assuming you want to show thumbnails of a set of images. Create the image list with the maximum size of the thumbnails. Before adding each image to the image list, scale it proportionally so that it "fills" the dimensions of the thumbnail image in the best possible way without clipping. Fill the remaining space with a background color or set the alpha value to zero to make it "transparent".
– zett42
Nov 11 at 17:35
1
Say original image size = 1024 x 768, max. thumbnail size = 50 x 50. Scaled image width = 50, scaled image height = 50 * 768 / 1024 = 37.BitBlt()
scaled image of 50 x 37 to temporary image of 50 x 50, centering it. Fill border on top and bottom with background color or set alpha value to zero. Add temporary image to image list.
– zett42
Nov 11 at 17:46
1
1
I think you are looking for custom draw
CListCtrl
, where you manually draw each image, for example to preview an image directory.– Barmak Shemirani
Nov 11 at 5:59
I think you are looking for custom draw
CListCtrl
, where you manually draw each image, for example to preview an image directory.– Barmak Shemirani
Nov 11 at 5:59
1
1
You don't give much information about your use case. A sketch of what you want the result to look like, could be helpful. I'm assuming you want to show thumbnails of a set of images. Create the image list with the maximum size of the thumbnails. Before adding each image to the image list, scale it proportionally so that it "fills" the dimensions of the thumbnail image in the best possible way without clipping. Fill the remaining space with a background color or set the alpha value to zero to make it "transparent".
– zett42
Nov 11 at 17:35
You don't give much information about your use case. A sketch of what you want the result to look like, could be helpful. I'm assuming you want to show thumbnails of a set of images. Create the image list with the maximum size of the thumbnails. Before adding each image to the image list, scale it proportionally so that it "fills" the dimensions of the thumbnail image in the best possible way without clipping. Fill the remaining space with a background color or set the alpha value to zero to make it "transparent".
– zett42
Nov 11 at 17:35
1
1
Say original image size = 1024 x 768, max. thumbnail size = 50 x 50. Scaled image width = 50, scaled image height = 50 * 768 / 1024 = 37.
BitBlt()
scaled image of 50 x 37 to temporary image of 50 x 50, centering it. Fill border on top and bottom with background color or set alpha value to zero. Add temporary image to image list.– zett42
Nov 11 at 17:46
Say original image size = 1024 x 768, max. thumbnail size = 50 x 50. Scaled image width = 50, scaled image height = 50 * 768 / 1024 = 37.
BitBlt()
scaled image of 50 x 37 to temporary image of 50 x 50, centering it. Fill border on top and bottom with background color or set alpha value to zero. Add temporary image to image list.– zett42
Nov 11 at 17:46
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
draft saved
draft discarded
draft saved
draft discarded
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245948%2fcan-clistctrl-display-dynamic-width-images%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
I think you are looking for custom draw
CListCtrl
, where you manually draw each image, for example to preview an image directory.– Barmak Shemirani
Nov 11 at 5:59
1
You don't give much information about your use case. A sketch of what you want the result to look like, could be helpful. I'm assuming you want to show thumbnails of a set of images. Create the image list with the maximum size of the thumbnails. Before adding each image to the image list, scale it proportionally so that it "fills" the dimensions of the thumbnail image in the best possible way without clipping. Fill the remaining space with a background color or set the alpha value to zero to make it "transparent".
– zett42
Nov 11 at 17:35
1
Say original image size = 1024 x 768, max. thumbnail size = 50 x 50. Scaled image width = 50, scaled image height = 50 * 768 / 1024 = 37.
BitBlt()
scaled image of 50 x 37 to temporary image of 50 x 50, centering it. Fill border on top and bottom with background color or set alpha value to zero. Add temporary image to image list.– zett42
Nov 11 at 17:46