コード例 #1
0
ファイル: Generator.cs プロジェクト: radtek/FluentListView
        /// <summary>
        /// Create a column with all the given information
        /// </summary>
        /// <param name="aspectName"></param>
        /// <param name="title"></param>
        /// <param name="editable"></param>
        /// <param name="propertyType"></param>
        /// <param name="attr"></param>
        /// <returns></returns>
        protected virtual OLVColumn MakeColumn(string aspectName, string title, bool editable, Type propertyType, OLVColumnAttribute attr)
        {
            OLVColumn column = this.MakeColumn(aspectName, title, attr);

            column.Name = (attr == null || String.IsNullOrEmpty(attr.Name)) ? aspectName : attr.Name;
            this.ConfigurePossibleBooleanColumn(column, propertyType);

            if (attr == null)
            {
                column.IsEditable = editable;
                column.Width      = -1; // Auto size
                return(column);
            }

            column.AspectToStringFormat = attr.AspectToStringFormat;
            if (attr.IsCheckBoxesSet)
            {
                column.CheckBoxes = attr.CheckBoxes;
            }
            column.DisplayIndex   = attr.DisplayIndex;
            column.FillsFreeSpace = attr.FillsFreeSpace;
            if (attr.IsFreeSpaceProportionSet)
            {
                column.FreeSpaceProportion = attr.FreeSpaceProportion;
            }
            column.GroupWithItemCountFormat         = attr.GroupWithItemCountFormat;
            column.GroupWithItemCountSingularFormat = attr.GroupWithItemCountSingularFormat;
            column.Hyperlink        = attr.Hyperlink;
            column.ImageAspectName  = attr.ImageAspectName;
            column.IsEditable       = attr.IsEditableSet ? attr.IsEditable : editable;
            column.IsTileViewColumn = attr.IsTileViewColumn;
            column.IsVisible        = attr.IsVisible;
            column.MaximumWidth     = attr.MaximumWidth;
            column.MinimumWidth     = attr.MinimumWidth;
            column.Tag = attr.Tag;
            if (attr.IsTextAlignSet)
            {
                column.TextAlign = attr.TextAlign;
            }
            column.ToolTipText = attr.ToolTipText;
            if (attr.IsTriStateCheckBoxesSet)
            {
                column.TriStateCheckBoxes = attr.TriStateCheckBoxes;
            }
            column.UseInitialLetterForGroup = attr.UseInitialLetterForGroup;
            column.Width = attr.Width;
            if (attr.GroupCutoffs != null && attr.GroupDescriptions != null)
            {
                column.MakeGroupies(attr.GroupCutoffs, attr.GroupDescriptions);
            }
            return(column);
        }
コード例 #2
0
        private static OLVColumn MakeColumnFromAttribute(string aspectName, OLVColumnAttribute attr, bool editable)
        {
            string title = attr.Title;

            if (String.IsNullOrEmpty(title))
            {
                title = aspectName;
            }
            OLVColumn column = new OLVColumn(title, aspectName);

            column.AspectToStringFormat             = attr.AspectToStringFormat;
            column.CheckBoxes                       = attr.CheckBoxes;
            column.DisplayIndex                     = attr.DisplayIndex;
            column.GroupWithItemCountFormat         = attr.GroupWithItemCountFormat;
            column.GroupWithItemCountSingularFormat = attr.GroupWithItemCountSingularFormat;
            column.Hyperlink       = attr.Hyperlink;
            column.ImageAspectName = attr.ImageAspectName;
            if (attr.IsEditableSet)
            {
                column.IsEditable = attr.IsEditable;
            }
            else
            {
                column.IsEditable = editable;
            }
            column.IsTileViewColumn         = attr.IsTileViewColumn;
            column.UseInitialLetterForGroup = attr.UseInitialLetterForGroup;
            column.ToolTipText    = attr.ToolTipText;
            column.IsVisible      = attr.IsVisible;
            column.FillsFreeSpace = attr.FillsFreeSpace;
            if (attr.FreeSpaceProportion.HasValue)
            {
                column.FreeSpaceProportion = attr.FreeSpaceProportion.Value;
            }
            column.MaximumWidth       = attr.MaximumWidth;
            column.MinimumWidth       = attr.MinimumWidth;
            column.Width              = attr.Width;
            column.Text               = attr.Title;
            column.TextAlign          = attr.TextAlign;
            column.Tag                = attr.Tag;
            column.TriStateCheckBoxes = attr.TriStateCheckBoxes;
            if (attr.GroupCutoffs != null && attr.GroupDescriptions != null)
            {
                column.MakeGroupies(attr.GroupCutoffs, attr.GroupDescriptions);
            }
            return(column);
        }
コード例 #3
0
ファイル: Generator.cs プロジェクト: GodLesZ/svn-dump
		private static OLVColumn MakeColumnFromAttribute(string aspectName, OLVColumnAttribute attr, bool editable) {
			string title = String.IsNullOrEmpty(attr.Title) ? aspectName : attr.Title;
			OLVColumn column = new OLVColumn(title, aspectName);
			column.AspectToStringFormat = attr.AspectToStringFormat;
			column.CheckBoxes = attr.CheckBoxes;
			column.DisplayIndex = attr.DisplayIndex;
			column.FillsFreeSpace = attr.FillsFreeSpace;
			if (attr.FreeSpaceProportion.HasValue)
				column.FreeSpaceProportion = attr.FreeSpaceProportion.Value;
			column.GroupWithItemCountFormat = attr.GroupWithItemCountFormat;
			column.GroupWithItemCountSingularFormat = attr.GroupWithItemCountSingularFormat;
			column.Hyperlink = attr.Hyperlink;
			column.ImageAspectName = attr.ImageAspectName;
			if (attr.IsEditableSet)
				column.IsEditable = attr.IsEditable;
			else
				column.IsEditable = editable;
			column.IsTileViewColumn = attr.IsTileViewColumn;
			column.IsVisible = attr.IsVisible;
			column.MaximumWidth = attr.MaximumWidth;
			column.MinimumWidth = attr.MinimumWidth;
			column.Name = String.IsNullOrEmpty(attr.Name) ? aspectName : attr.Name;
			column.Tag = attr.Tag;
			column.TextAlign = attr.TextAlign;
			column.ToolTipText = attr.ToolTipText;
			column.TriStateCheckBoxes = attr.TriStateCheckBoxes;
			column.UseInitialLetterForGroup = attr.UseInitialLetterForGroup;
			column.Width = attr.Width;
			if (attr.GroupCutoffs != null && attr.GroupDescriptions != null)
				column.MakeGroupies(attr.GroupCutoffs, attr.GroupDescriptions);
			return column;
		}