Background
Recently, a Winform applet needs to use paging, because we have been usingTonyPagerForWinForm. dllBut the library does not have the source code, and the online search is not comprehensive, so you have to prepare your own transformation. I flipped through the garden and found that a paging control was written many years ago by the fall. This is a practical article on Winform universal paging control (source code download is provided ). Standing on the shoulders of the gods is fast, and it will be changed in a moment.
The functions are quite complete, but in terms of style, the landlord prefers the list paging style of easyUI or ext. So I changed several buttons and added the icon to see the current effect.
The control source code is at the bottom of the body.
Introduction
That's the feeling of web paging. For specific usage, simply paste a post. For more details, you can go to the autumn blog and see the link on it.
StartForm_Load(, , [] { , , ( i = ; i < ; i++) (MAction action = MAction(, , +, +, i%==+= pagerControl1_OnPageChanged( (MAction action = MAction(, .Empty,
About Winform
Plug in off-questions. If you haven't done Winform for a long time, some will gradually forget it. Here are some points.
1. The control is adaptive to the window. The anchor attribute is set with top left right down, which is set as needed.
2. To bind data to a Datagrid, if you need to bind a special column, slice, or drop-down box, specify the column header, and then create rows and cells cyclically.
DataGridViewRow row = = = i++ state = reader[].ToString().AsInt(= = state > ? : _dval = reader[].ToString().AsInt(= = _dmin = reader[].ToString().AsInt(= = DataGridViewImageCell t2 = = _dval > _dmin ?
3. The DataGrid automatically adjusts the column width as the window is maximized.
=.dataGridView.DataSource = ds.Tables[.dataGridView.Columns[].FillWeight = ; .dataGridView.Columns[].FillWeight = ; .dataGridView.Columns[].FillWeight = ; .dataGridView.Columns[].HeaderText = .dataGridView.Columns[].HeaderText = .dataGridView.Columns[].HeaderText = ;
Page Control source code download