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 3945340
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T01:00:21+00:00 2026-05-20T01:00:21+00:00

Above is an image for a custom control that I’m working on. It’s actually

  • 0

Custom list style control

Above is an image for a custom control that I’m working on. It’s actually three separate controls in a windows form. It’s a container control which holds multiple instances of a “Platform/console” control. The “Platform” control holds multiple instances of a “Game” control. The consoles are collapsible which will hide the games in the list.

Now the problem I’m having is the fact that when a person has say 3000 game titles, the memory usage is up around 500MB, and the control is very sluggish. Now I haven’t optimized the creation out of the application thread yet, but even after creation it’s a pig.

How would a person go about freeing resources on controls that have moved off screen? Is there a quicker way than testing each control to see if it’s in some visible area? Is there a different way I should be designing this control?

I don’t have extensive knowledge in C# so any advice would be greatly appreciated.

  • 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-05-20T01:00:21+00:00Added an answer on May 20, 2026 at 1:00 am

    If you make your Control “Virtualized” you might reduce the memory footprint. Have a look at ListView, if you set ownerDrawn = true and VirtualMode =true and VirtualListSize =3000 the following code will create items (and store them) and do custom drawing.

    You might be in for some extra programming because on your owner drawn control nothing comes for free…

    // should be a cache of some sort, WeakReference'd etc, this is NOT reducing memory load (it is adding memory load)
            Dictionary<Int32, ListViewItem> dict = new Dictionary<int, ListViewItem>();
    
            private void listView1_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
            {
    
                ListViewItem lvi = null;
                if (dict.ContainsKey(e.ItemIndex))
                {
    
                    Debug.WriteLine(String.Format("from cache:{0}", e.ItemIndex));
                    lvi = dict[e.ItemIndex];
                }
                else
                {
                    Debug.WriteLine(String.Format("created:{0}", e.ItemIndex));
                    lvi = new ListViewItem { Text = String.Format("item:{0}", e.ItemIndex) };
                    lvi.SubItems.Add( new ListViewItem.ListViewSubItem{Text = String.Format("si:{0}", e.ItemIndex)});
                    dict.Add(e.ItemIndex, lvi);
                }
                e.Item = lvi; 
            }
    
            private void listView1_DrawItem(object sender, DrawListViewItemEventArgs e)
            {
                // you can draw yourself...
                // e.Graphics.DrawString(e.Item.Text, System.Drawing.SystemFonts.DefaultFont, new SolidBrush(Color.Red), 0f, 0f);
                e.DrawText();
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a custom TaskButton control that takes an image and text. The
I would like to create a set of custom controls that are basically image
The image above is from Wikipedia's entry on AVL trees which Wikipedia indicates is
I have a TemplateField that is dynamically added to a custom GridView. void ITemplate.InstantiateIn(System.Web.UI.Control
I wanted to create Custom Dialog like the following image which can be called
http://biochrom.fivesite.co.uk/catalogue4.asp On the page above there is an image floated to the left. To
In Java 5 and above you have the foreach loop, which works magically on
I keep getting tasks that are above my skill level. How can I address this without coming accross as grossly incompetent?
How do I do the above? There is mktime function but that treats the
I want my errors to float above, left-justified, the input field that doesn't validate.

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.