Esempio n. 1
0
        public void AddField(IListViewField Field)
        {
            ListViewFieldAdapter Adapter = new ListViewFieldAdapter();
            Adapter.Field = Field;
            Adapter.Column = new ColumnHeader();
            Adapter.Column.Text = Field.DisplayName;
            Adapter.Column.Name = Field.GetType().Name;

            int field_width = Field.InitialWidth;
            FieldWidthStyle width_style = Field.InitialWidthStyle;
            ListViewColumnSettings field_settings = null;
            if (mSettings != null)
            {
                field_settings = mSettings.GetColumnSettings(
                    Adapter.Column, Field.InitialWidthStyle, Field.InitialWidth);
                field_width = field_settings.Width;
                width_style = field_settings.WidthStyle;
            }

            Adapter.Column.Width = ComputeColumnWidth(width_style, field_width);

            mFields.Add(Adapter);
            if (field_settings == null || field_settings.Visible)
            {
                Adapter.Column.DisplayIndex = mFields.Count+1;
                Columns.Add(Adapter.Column);
            }
        }
Esempio n. 2
0
        public void AddField(IListViewField Field)
        {
            ListViewFieldAdapter Adapter = new ListViewFieldAdapter();

            Adapter.Field       = Field;
            Adapter.Column      = new ColumnHeader();
            Adapter.Column.Text = Field.DisplayName;
            Adapter.Column.Name = Field.GetType().Name;

            int                    field_width    = Field.InitialWidth;
            FieldWidthStyle        width_style    = Field.InitialWidthStyle;
            ListViewColumnSettings field_settings = null;

            if (mSettings != null)
            {
                field_settings = mSettings.GetColumnSettings(
                    Adapter.Column, Field.InitialWidthStyle, Field.InitialWidth);
                field_width = field_settings.Width;
                width_style = field_settings.WidthStyle;
            }

            Adapter.Column.Width = ComputeColumnWidth(width_style, field_width);

            mFields.Add(Adapter);
            if (field_settings == null || field_settings.Visible)
            {
                Adapter.Column.DisplayIndex = mFields.Count + 1;
                Columns.Add(Adapter.Column);
            }
        }