纯自绘实现的winform下卡片列表

列表完全使用自绘,没有使用任何控件,减少句柄占用,提高绘制效率,双缓冲减少闪烁,前二年为某大型医药软件公司开发,如果有需要类似功能的朋友可以联系,模拟数据全是肺炎病例,当前新冠病毒肆虐全球,当初是不是有点先知的意思呢。

1、界面

 2、设计器

 3、TitleView

 4、单个卡片配置文件

{
  "BackColor": "White",
  "Width": 280,
  "Height": 110,
  "CardItemList": [
    {
      "LineWidth": 0,
      "TextFont": "宋体, 11pt, style=Bold",
      "Rect": "2, 2, 200, 30",
      "BackColor": "DarkGreen",
      "ForeColor": "DarkOrange",
      "Img": "",
      "IsClickable": false,
      "IsHaveTip": false,
      "IsCanCheck": false,
      "IsChecked": false,
      "Name": "head",
      "Text": "",
      "TextAlign": "Near",
      "TextLineAlign": "Near",
      "Visible": false,
      "ToolTipText": "",
      "Shape": "",
      "Group": "",
      "ItemType": "Label",
      "Tag": "",
      "FeildName": ""
    },
    {
      "LineWidth": 0,
      "TextFont": "宋体, 11pt, style=Bold",
      "Rect": "2, 6, 24, 24",
      "BackColor": "White",
      "ForeColor": "DarkOrange",
      "Img": "uncheck",
      "IsClickable": true,
      "IsHaveTip": false,
      "IsCanCheck": true,
      "IsChecked": false,
      "Name": "collect",
      "Text": "",
      "TextAlign": "Near",
      "TextLineAlign": "Near",
      "Visible": true,
      "ToolTipText": "",
      "Shape": "",
      "Group": "",
      "ItemType": "Label",
      "Tag": "",
      "FeildName": ""
    },
    {
      "LineWidth": 0,
      "TextFont": "宋体, 12pt, style=Bold",
      "Rect": "30, 10, 40, 20",
      "BackColor": "White",
      "ForeColor": "Black",
      "Img": "",
      "IsClickable": false,
      "IsHaveTip": false,
      "IsCanCheck": false,
      "IsChecked": false,
      "Name": "PatientName",
      "Text": "姓名",
      "TextAlign": "Near",
      "TextLineAlign": "Near",
      "Visible": true,
      "ToolTipText": "",
      "Shape": "",
      "Group": "",
      "ItemType": "Label",
      "Tag": "",
      "FeildName": "PatientName"
    },
    {
      "LineWidth": 0,
      "TextFont": "宋体, 11pt",
      "Rect": "80, 10, 120, 20",
      "BackColor": "Transparent",
      "ForeColor": "106, 212, 221",
      "Img": "",
      "IsClickable": false,
      "IsHaveTip": false,
      "IsCanCheck": false,
      "IsChecked": false,
      "Name": "PatientGender",
      "Text": "性别",
      "TextAlign": "Near",
      "TextLineAlign": "Near",
      "Visible": true,
      "ToolTipText": "",
      "Shape": "",
      "Group": "",
      "ItemType": "Label",
      "Tag": "",
      "FeildName": "PatientGender"
    },
    {
      "LineWidth": 0,
      "TextFont": "宋体, 11pt",
      "Rect": "120, 10, 120, 20",
      "BackColor": "White",
      "ForeColor": "Black",
      "Img": "",
      "IsClickable": false,
      "IsHaveTip": false,
      "IsCanCheck": false,
      "IsChecked": false,
      "Name": "PatientAge",
      "Text": "年龄",
      "TextAlign": "Near",
      "TextLineAlign": "Near",
      "Visible": true,
      "ToolTipText": "",
      "Shape": "",
      "Group": "",
      "ItemType": "Label",
      "Tag": "",
      "FeildName": "PatientAge"
    },
    {
      "LineWidth": 0,
      "TextFont": "宋体, 11pt",
      "Rect": "200, 10, 60, 20",
      "BackColor": "White",
      "ForeColor": "Black",
      "Img": "",
      "IsClickable": false,
      "IsHaveTip": false,
      "IsCanCheck": false,
      "IsChecked": false,
      "Name": "PatientBed",
      "Text": "3F-01001",
      "TextAlign": "Near",
      "TextLineAlign": "Near",
      "Visible": true,
      "ToolTipText": "",
      "Shape": "",
      "Group": "",
      "ItemType": "Label",
      "Tag": "",
      "FeildName": ""
    },
    {
      "LineWidth": 1,
      "TextFont": "宋体, 11pt, style=Bold",
      "Rect": "10, 30, 250, 5",
      "BackColor": "222, 222, 222",
      "ForeColor": "222, 222, 222",
      "Img": "",
      "IsClickable": false,
      "IsHaveTip": false,
      "IsCanCheck": false,
      "IsChecked": false,
      "Name": "line1",
      "Text": "",
      "TextAlign": "Near",
      "TextLineAlign": "Near",
      "Visible": true,
      "ToolTipText": "",
      "Shape": "",
      "Group": "",
      "ItemType": "Line",
      "Tag": "",
      "FeildName": ""
    },
    {
      "LineWidth": 0,
      "TextFont": "宋体, 11pt",
      "Rect": "10, 35, 40, 20",
      "BackColor": "White",
      "ForeColor": "Black",
      "Img": "",
      "IsClickable": false,
      "IsHaveTip": false,
      "IsCanCheck": false,
      "IsChecked": false,
      "Name": "labelDiseaseType",
      "Text": "肺炎",
      "TextAlign": "Center",
      "TextLineAlign": "Center",
      "Visible": true,
      "ToolTipText": "",
      "Shape": "",
      "Group": "",
      "ItemType": "Label",
      "Tag": "",
      "FeildName": ""
    },
    {
      "LineWidth": 0,
      "TextFont": "宋体, 10pt",
      "Rect": "210, 35, 22, 22",
      "BackColor": "251, 92, 110",
      "ForeColor": "White",
      "Img": "",
      "IsClickable": false,
      "IsHaveTip": true,
      "IsCanCheck": false,
      "IsChecked": false,
      "Name": "labelState1",
      "Text": "危",
      "TextAlign": "Center",
      "TextLineAlign": "Center",
      "Visible": true,
      "ToolTipText": "心力衰竭",
      "Shape": "",
      "Group": "",
      "ItemType": "RoundDigit",
      "Tag": "",
      "FeildName": ""
    },
    {
      "LineWidth": 0,
      "TextFont": "宋体, 10pt",
      "Rect": "235, 35, 22, 22",
      "BackColor": "251, 92, 110",
      "ForeColor": "White",
      "Img": "",
      "IsClickable": false,
      "IsHaveTip": true,
      "IsCanCheck": false,
      "IsChecked": false,
      "Name": "labelState2",
      "Text": "敏",
      "TextAlign": "Center",
      "TextLineAlign": "Center",
      "Visible": true,
      "ToolTipText": "头孢过敏",
      "Shape": "",
      "Group": "",
      "ItemType": "RoundDigit",
      "Tag": "",
      "FeildName": ""
    },
    {
      "LineWidth": 0,
      "TextFont": "宋体, 11pt",
      "Rect": "10, 55, 150, 20",
      "BackColor": "White",
      "ForeColor": "Black",
      "Img": "",
      "IsClickable": false,
      "IsHaveTip": false,
      "IsCanCheck": false,
      "IsChecked": false,
      "Name": "HospitalDay",
      "Text": "住院天数",
      "TextAlign": "Near",
      "TextLineAlign": "Near",
      "Visible": true,
      "ToolTipText": "",
      "Shape": "",
      "Group": "",
      "ItemType": "Label",
      "Tag": "",
      "FeildName": ""
    },
    {
      "LineWidth": 0,
      "TextFont": "宋体, 11pt",
      "Rect": "10, 75, 120, 20",
      "BackColor": "White",
      "ForeColor": "Black",
      "Img": "",
      "IsClickable": false,
      "IsHaveTip": false,
      "IsCanCheck": false,
      "IsChecked": false,
      "Name": "label1",
      "Text": "职工医保",
      "TextAlign": "Near",
      "TextLineAlign": "Near",
      "Visible": true,
      "ToolTipText": "",
      "Shape": "",
      "Group": "",
      "ItemType": "Label",
      "Tag": "",
      "FeildName": ""
    },
    {
      "LineWidth": 0,
      "TextFont": "宋体, 11pt",
      "Rect": "80, 75, 100, 20",
      "BackColor": "White",
      "ForeColor": "Black",
      "Img": "",
      "IsClickable": false,
      "IsHaveTip": false,
      "IsCanCheck": false,
      "IsChecked": false,
      "Name": "labelMedicalInsurance",
      "Text": "¥1256.00",
      "TextAlign": "Near",
      "TextLineAlign": "Near",
      "Visible": true,
      "ToolTipText": "",
      "Shape": "",
      "Group": "",
      "ItemType": "Label",
      "Tag": "",
      "FeildName": ""
    },
    {
      "LineWidth": 0,
      "TextFont": "宋体, 10pt",
      "Rect": "165, 75, 100, 100",
      "BackColor": "88, 156, 229",
      "ForeColor": "White",
      "Img": "",
      "IsClickable": false,
      "IsHaveTip": false,
      "IsCanCheck": false,
      "IsChecked": false,
      "Name": "label2",
      "Text": "检查检验 5",
      "TextAlign": "Near",
      "TextLineAlign": "Near",
      "Visible": true,
      "ToolTipText": "",
      "Shape": "",
      "Group": "",
      "ItemType": "RoundRect",
      "Tag": "",
      "FeildName": ""
    }
  ]
}
原文地址:https://www.cnblogs.com/zhaogaojian/p/12742095.html