protected ucontrol getuc(Control c, int rowPosition, int columnPosition, int rowSpan, int columnSpan) { ucontrol uc = new ucontrol() { c = c, rowPosition = rowPosition, columnPosition = columnPosition, rowSpan = rowSpan, columnSpan = columnSpan }; return(uc); }
/// <summary> /// 简单构造ucontrol对象 /// </summary> /// <param name="c"></param> /// <param name="rc">是一个5位整型数字,后4位为有效设置分别对应为rowPosition,columnPosition,rowSpan,columnSpan</param> /// <returns></returns> protected ucontrol getuc(Control c, int rc) { ucontrol uc = new ucontrol() { c = c }; if (rc >= 10011 && rc <= 99999) { var v = (int)rc / 10000; uc.rowPosition = (int)(rc - v * 10000) / 1000; uc.columnPosition = (int)(rc - (v * 10000 + uc.rowPosition * 1000)) / 100; uc.rowSpan = (int)(rc - (v * 10000 + uc.rowPosition * 1000 + uc.columnPosition * 100)) / 10; uc.columnSpan = (int)(rc - (v * 10000 + uc.rowPosition * 1000 + uc.columnPosition * 100 + uc.rowSpan * 10)); } else { throw new ArgumentOutOfRangeException("rc,要求范围为,10011~99999"); } return(uc); }