Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Analysis of abnormal phenomena of ListView in C #

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

The main content of this article is "Analysis of ListView anomalies in C#". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "Analysis of ListView anomalies in C#".

In the load event of the form:

This.listView1.Columns.Add ("id", 120, HorizontalAlignment.Left); / / add this.listView1.Columns.Add ("name", 120, HorizontalAlignment.Left) in one step; / add this.listView1.Columns.Add ("age", 120, HorizontalAlignment.Left) in one step; / / add this.listView1.BeginUpdate () in one step / / data update, UI temporarily suspended until EndUpdate drawing control, which can effectively avoid flicker and greatly improve loading speed for (int I = 0; I < 10; iTunes +) / / add 10 rows of data {ListViewItem lvi = new ListViewItem (); lvi.ImageIndex = I / / display item I icon in imageList lvi.Text = "subitem" + I; lvi.SubItems.Add ("column 2, row" + I + "row"); lvi.SubItems.Add (column 3, line "+ I +"); this.listView1.Items.Add (lvi) by binding with imageList } this.listView1.EndUpdate (); / / finish the data processing, and draw the UI interface at one time. ListView1.View = View.Details

The above code feels normal, with three columns of headers: id,name,age, and then adds 10 rows of data. However, when I started the program, I found that listview was empty. When debugging, it is found that after the execution of this.listView1.Items.Add (lvi); (at this time iTunes 0), iTune1 will not be executed again. Wait for the logic, and form's load event function jumps out.

At this point, I believe you have a deeper understanding of the "Analysis of ListView anomalies in C#". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report