Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8421779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:14:35+00:00 2026-06-10T03:14:35+00:00

I have ListView with the View type LargeIcon. The ListView has assigned LargeImageList. The

  • 0

I have ListView with the View type LargeIcon. The ListView has assigned LargeImageList. The assigned ImageList has ImageSize 200×200.
Images that will be added to the ImageList have size that doesn’t match to 200×200 ImageList size. They can have a lesser width or height. In both cases I want images to be aligned by center, i.e. MiddleCenter property for Winforms.Label class

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T03:14:37+00:00Added an answer on June 10, 2026 at 3:14 am

    ImageList will resize the image to fit the ImageSize. To get the image at its original size, and centered, you’ll need to create a new image with the desired properties. Sample code to do this (untested):

    public static void AddCenteredImage(ImageList list, Image image) {
        using (var bmp = new Bitmap(list.ImageSize.Width, list.ImageSize.Height))
        using (var gr = Graphics.FromImage(bmp)) {
            gr.Clear(Color.Transparent);   // Change background if necessary
            var size = image.Size;
            if (size.Width > list.ImageSize.Width || size.Height > list.ImageSize.Height) {
                // Image too large, rescale to fit the image list
                double wratio = list.ImageSize.Width / size.Width;
                double hratio = list.ImageSize.Height / size.Height;
                double ratio = Math.Min(wratio, hratio);
                size = new Size((int)(ratio * size.Width), (int)(ratio * size.Height));
            }
            var rc = new Rectangle(
                (list.ImageSize.Width - size.Width) / 2,
                (list.ImageSize.Height - size.Height) / 2,
                size.Width, size.Height);
            gr.DrawImage(image, rc);
            list.Images.Add(bmp);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a tab view which has a listview in one of these tabs.
In my View, which is a UserControl I have a ListView which has a
I have the following ListView: <ListView Name=listView> <ListView.View> <GridView> <GridView.ColumnHeaderContainerStyle> <Style TargetType={x:Type GridViewColumnHeader}> <Setter
I have an EditText that I'm using as the footer View for my ListView
I have a listview <ListView Name=listView2> <ListView.View> <GridView> <!-- First Column --> <GridViewColumn Width=105
In a WPF application I have a ListView: <ListView Name=ItemSelList ItemsSource={Binding ItemColl} SelectionChanged=ItemSelList_SelectionChanged> <ListView.View>
I have a ListView whose size is fixed to maximum of 10 items View
I have a listview in c# with three columns and the view is details.
I have a listview with 200 items. I use a custom view for each
I have a ListView with an onItemonClick listener: @Override public void onItemClick(AdapterView<?> arg0, View

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.