In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how to use ComponentOne to improve the loading speed in .NET DataMap, which has a certain reference value. Interested friends can refer to it. I hope you can learn a lot after reading this article.
Overview
FlexGrid for WinForm uses the latest data binding technology and integrates seamlessly with Microsoft .NET Framework. As a result, you can get easy-to-use flexible grid controls to create a user-friendly interface to display, edit, format, organize, summarize, and print tabular data.
The DataMap property of FlexGrid allows you to implement "translated" rows or columns. In the converted row or column, the grid does not display the values stored in the cell. Instead, it looks for these values in the DataMap of the column and displays the mapped values.
Sometimes you may need to use DataMap in C1FlexGrid / C1FlexGridClassic to display a list of projects. Even if the list contains a large amount of data, its load is smooth and instant. In this article, we will discuss how to use a custom ComboBox editor to speed up the loading time of the DataMap grid.
Create an editor and host it in Grid
All built-in grid editors implement the IC1EmbeddedEditor interface, as do controls in the ComponentOne Input library. If we want to use a third-party editor with C1FlexGrid, we need to create a derived class and implement this interface.
Implementation steps
Create a model class MyComboItem to bind ComboBox.
Public class MyComboItem
{public int Id {get; set;} public string Display {get; set;}}
Create a custom control MyComboBox that inherits the ComboBox class and implements the IC1EmbeddedEditor interface.
Public partial class MyComboBox: ComboBox, IC1EmbeddedEditor {public MyComboBox () {InitializeComponent ();} # region IC1EmbeddedEditor-Members / / Initialize editor: select transferred value public void C1EditorInitialize (object value, IDictionary editorAttributes) {this.SelectedValue = value } / / Get value from editor public object C1EditorGetValue () {return (base.SelectedItem as MyComboItem)? .ID;} / / Value is always TRUE public bool C1EditorValueIsValid () {return true } / / Adjust editor size public void C1EditorUpdateBounds (Rectangle rc) {if (rc.Height! =-1 & & rc.Width! =-1) {this.Location = new Point (rc.X, rc.Y); this.Width = rc.Width; this.Height = this.DefaultSize.Height } else {/ / Editor has scrolled out of the picture. Take over the height / width of-1. This.Width =-1; this.Height =-1;}} / / TRUE if Escape or Enter public bool C1EditorKeyDownFinishEdit (KeyEventArgs e) {if (e.KeyCode = = Keys.Escape | | e.KeyCode = = Keys.Enter) return true; return false } / / Format and editor value public string C1EditorFormat (object value, string mask) {return null;} / / Style of Editors public UITypeEditorEditStyle C1EditorGetStyle () {return UITypeEditorEditStyle.DropDown;} # endregion}}
Create an instance of the MyComboBox class and assign it to the grid's column editor, as follows:
Dictionary DMap = new Dictionary (); ComboBox C1 = new MyComboBox (); List _ list = new List (); c1.DataSource = _ list; c1.ValueMember = "Id"; c1.DisplayMember = "Display"; _ flex.Cols [2] .Editor = C1; _ flex.Cols [2] .DataMap = DMap / / use DataMap to show IDs as values. Thank you for reading this article carefully. I hope the article "how to use ComponentOne to improve the loading speed in .NET DataMap" shared by the editor will be helpful to you. At the same time, I also hope that you will support and follow the industry information channel. More related knowledge is waiting for you 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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.