Beispiel #1
0
        /// <summary>
        /// Returns the type of column that is appropriate for the given property of the data source.
        /// Numbers, DateTime, Color and Boolean columns are mapped to NumberColumn, DateTimeColumn, ColorColumn and CheckBoxColumn respectively. The default
        /// is just a TextColumn.
        /// </summary>
        /// <param name="prop"></param>
        /// <param name="index"></param>
        /// <returns></returns>
        public virtual Column GetColumn(PropertyDescriptor prop, int index)
        {
            Column column = null;

            switch (prop.PropertyType.Name)
            {
            case "Int32":
            case "Double":
            case "Float":
            case "Int16":
            case "Int64":
            case "Decimal":
                column = new NumberColumn(prop.Name);
                break;

            case "DateTime":
                column = new DateTimeColumn(prop.Name);
                break;

            case "Color":
                column = new ColorColumn(prop.Name);
                break;

            case "Boolean":
                column = new CheckBoxColumn(prop.Name);
                break;

            default:
                column = new TextColumn(prop.Name);
                break;
            }
            return(column);
        }
Beispiel #2
0
        protected virtual ColumnModel ColumnInitialize()
        {
            TextColumn col1 = new TextColumn(Translator.Instance.T("版本"));

            ImageColumn col2 = new ImageColumn(Translator.Instance.T("类别"));
            col2.DrawText = true;

            TextColumn col3 = new TextColumn(Translator.Instance.T("内容"));

            ColumnModel r = new ColumnModel(new Column[] { col1, col2, col3 });
            foreach (Column col in r.Columns)
            {
                col.Resizable = true;
                col.Editable = false;
            }
            return r;
        }
Beispiel #3
0
        /// <summary>
        /// Initializes a new instance of the ColumnModel class with an array of strings
        /// representing TextColumns
        /// </summary>
        /// <param name="columns">An array of strings that represent the Columns of
        /// the ColumnModel</param>
        public ColumnModel(string[] columns)
        {
            if (columns == null)
            {
                throw new ArgumentNullException("columns", "string[] cannot be null");
            }

            this.Init();

            if (columns.Length > 0)
            {
                Column[] cols = new Column[columns.Length];

                for (int i = 0; i < columns.Length; i++)
                {
                    cols[i] = new TextColumn(columns[i]);
                }

                this.Columns.AddRange(cols);
            }
        }
Beispiel #4
0
        private void InitPlugInGrid()
        {
            Table table = this.tablePlugIns;       // The Table control on a form - already initialised

            table.BeginUpdate();
            table.SelectionStyle = SelectionStyle.ListView;
            table.GridLines = GridLines.None;
            table.FullRowSelect = true;
            table.NoItemsText = "";
            //table.EnableWordWrap = false;

            TextColumn col1 = new TextColumn(Translator.Instance.T("类别"), 100);
            TextColumn col2 = new TextColumn(Translator.Instance.T("名称"), 100);
            TextColumn col3 = new TextColumn(Translator.Instance.T("作者"), 100);
            TextColumn col4 = new TextColumn(Translator.Instance.T("版本"), 100);
            TextColumn col5 = new TextColumn(Translator.Instance.T("描述"), 100);
            TextColumn col6 = new TextColumn(Translator.Instance.T("文件"), 100);

            table.ColumnModel = new ColumnModel(new Column[] { col1, col2, col3, col4, col5, col6 });
            foreach (Column col in table.ColumnModel.Columns)
            {
                col.Resizable = true;
                col.Editable = false;
            }

            Font ft = SystemFonts.MessageBoxFont;
            table.HeaderFont = new Font(ft.FontFamily.Name, ft.Size, FontStyle.Bold);

            table.TableModel = new TableModel();
            table.TableModel.RowHeight = TextRenderer.MeasureText("ABCbp", table.Font).Height + 2;

            GradientHeaderRenderer gradientRenderer = new GradientHeaderRenderer();
            table.HeaderRenderer = gradientRenderer;

            table.EndUpdate();
        }
Beispiel #5
0
        protected virtual ColumnModel ColumnInitialize()
        {
            TextColumn col1 = new TextColumn(Translator.Instance.T("ģ��"));
            TextColumn col2 = new TextColumn(Translator.Instance.T("���֤�汾"));
            TextColumn col3 = new TextColumn(Translator.Instance.T("��Ȩ�û�"));
            TextColumn col4 = new TextColumn(Translator.Instance.T("��ע"));

            ColumnModel r = new ColumnModel(new Column[] { col1, col2, col3, col4 });
            foreach (Column col in r.Columns)
            {
                col.Resizable = true;
                col.Editable = false;
            }
            return r;
        }
        protected virtual ColumnModel ColumnInitialize()
        {
            TextColumn col1 = new TextColumn(Translator.Instance.T("����"), 100);
            TextColumn col2 = new TextColumn(Translator.Instance.T("��ַ(URL)"), 100);

            ColumnModel r = new ColumnModel(new Column[] { col1, col2 });
            foreach (Column col in r.Columns)
            {
                col.Resizable = true;
                col.Editable = true;
            }
            return r;
        }
        /// <summary>
        /// Returns the type of column that is appropriate for the given property of the data source.
        /// Numbers, DateTime, Color and Boolean columns are mapped to NumberColumn, DateTimeColumn, ColorColumn and CheckBoxColumn respectively. The default
        /// is just a TextColumn.
        /// </summary>
        /// <param name="prop"></param>
        /// <param name="index"></param>
        /// <returns></returns>
        public virtual Column GetColumn(PropertyDescriptor prop, int index)
        {
            Column column = null;
            switch (prop.PropertyType.Name)
            {
                case "Int32":
                case "Double":
                case "Float":
                case "Int16":
                case "Int64":
                case "Decimal":
                    column = new NumberColumn(prop.Name);
                    break;

                case "DateTime":
                    column = new DateTimeColumn(prop.Name);
                    break;

                case "Color":
                    column = new ColorColumn(prop.Name);
                    break;

                case "Boolean":
                    column = new CheckBoxColumn(prop.Name);
                    break;

                default:
                    column = new TextColumn(prop.Name);
                    break;
            }
            return column;
        }
Beispiel #8
0
        /// <summary>
        /// Initializes a new instance of the ColumnModel class with an array of strings 
        /// representing TextColumns
        /// </summary>
        /// <param name="columns">An array of strings that represent the Columns of 
        /// the ColumnModel</param>
        public ColumnModel(string[] columns)
        {
            if (columns == null)
            {
                throw new ArgumentNullException("columns", "string[] cannot be null");
            }

            this.Init();

            if (columns.Length > 0)
            {
                Column[] cols = new Column[columns.Length];

                for (int i=0; i<columns.Length; i++)
                {
                    cols[i] = new TextColumn(columns[i]);
                }

                this.Columns.AddRange(cols);
            }
        }