Skip to content

david0718/WinForm.UI

 
 

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

About

WinForm 皮肤,自定义控件

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%