Skip to content

YuanJianTing/WinForm.UI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Feb 24, 2022
c520e9c · Feb 24, 2022

History

55 Commits
Feb 24, 2022
Oct 14, 2020
Feb 24, 2022
Oct 14, 2020
Jan 11, 2018
Jan 11, 2018
Jan 15, 2018
Oct 16, 2020
Oct 14, 2020

Repository files navigation

WinForm.UI

WinForm 皮肤,自定义控件

使用方式:
BaseForm:
public partial class MainForm : BaseForm //修改父类 Form 为 BaseForm
Table :

table支持列、行 拖动;点击标题排序;

当数据源更改时,需调用以下方法:

table.NotifyDataSetChanged();
RecyclerView 使用如下
//需要配合自定义适配器使用,继承 BaseAdapter:
//重写 OnCreateViewHolder(Control control, int offset, int position)
//     OnDrawItem(Graphics g, ViewHolder viewHolder, int position)
public class ContactsAdapter : BaseAdapter<ContactsViewModel>{

   public override ViewHolder OnCreateViewHolder(Control control, int offset, int position)
   {
      ViewHolder viewHolder = GetViewHolder(position);
      y = position * ITEM_HEIGHT;
      if (viewHolder == null)
       {
            viewHolder = new ViewHolder(control, new Rectangle(x, y + offset, control.Width, ITEM_HEIGHT), position);
            CacheViewHolder(viewHolder);//缓存 ViewHolder
        }
        else
        {
            viewHolder.Bounds = new Rectangle(x, y + offset, control.Width, ITEM_HEIGHT);
        }
      return viewHolder;
   }

   public override void OnDrawItem(Graphics g, ViewHolder viewHolder, int position)
   {
        ContactsViewModel viewModel = GetItem(position);
        //...
   }
   

}

效果图:

Form 、RecyclerView、TreeView

image

Table

image image