예제 #1
0
        public static CVerticalAlign ToVerticalAlign(System.Windows.Forms.DataGridViewContentAlignment winDGVContentAlignment)
        {
            ReportExporters.Common.Model.Style.VerticalAlign _value;

            switch (winDGVContentAlignment)
            {
            case System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft:
            case System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter:
            case System.Windows.Forms.DataGridViewContentAlignment.MiddleRight:
            {
                _value = ReportExporters.Common.Model.Style.VerticalAlign.Middle;
                break;
            }

            case System.Windows.Forms.DataGridViewContentAlignment.BottomLeft:
            case System.Windows.Forms.DataGridViewContentAlignment.BottomCenter:
            case System.Windows.Forms.DataGridViewContentAlignment.BottomRight:
            {
                _value = ReportExporters.Common.Model.Style.VerticalAlign.Bottom;
                break;
            }

            case System.Windows.Forms.DataGridViewContentAlignment.TopLeft:
            case System.Windows.Forms.DataGridViewContentAlignment.TopCenter:
            case System.Windows.Forms.DataGridViewContentAlignment.TopRight:
            default:
            {
                _value = ReportExporters.Common.Model.Style.VerticalAlign.Top;
                break;
            }
            }

            return(new CVerticalAlign(_value));
        }
예제 #2
0
        public static CHorizontalAlign ToHorizontalAlign(System.Windows.Forms.DataGridViewContentAlignment winDGVContentAlignment)
        {
            ReportExporters.Common.Model.Style.HorizontalAlign _value;

            switch (winDGVContentAlignment)
            {
            case System.Windows.Forms.DataGridViewContentAlignment.TopLeft:
            case System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft:
            case System.Windows.Forms.DataGridViewContentAlignment.BottomLeft:
            {
                _value = ReportExporters.Common.Model.Style.HorizontalAlign.Left;
                break;
            }

            case System.Windows.Forms.DataGridViewContentAlignment.TopCenter:
            case System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter:
            case System.Windows.Forms.DataGridViewContentAlignment.BottomCenter:
            {
                _value = ReportExporters.Common.Model.Style.HorizontalAlign.Center;
                break;
            }

            case System.Windows.Forms.DataGridViewContentAlignment.TopRight:
            case System.Windows.Forms.DataGridViewContentAlignment.MiddleRight:
            case System.Windows.Forms.DataGridViewContentAlignment.BottomRight:
            {
                _value = ReportExporters.Common.Model.Style.HorizontalAlign.Right;
                break;
            }

            default:
            {
                _value = ReportExporters.Common.Model.Style.HorizontalAlign.General;
                break;
            }
            }

            return(new CHorizontalAlign(_value));
        }
예제 #3
0
        public static VerticalAlignment ToEtoVerticalAlignment(this swf.DataGridViewContentAlignment existing)
        {
            switch (existing)
            {
            default:
            case swf.DataGridViewContentAlignment.NotSet:
            case swf.DataGridViewContentAlignment.TopLeft:
            case swf.DataGridViewContentAlignment.MiddleLeft:
            case swf.DataGridViewContentAlignment.BottomLeft:
                return(VerticalAlignment.Top);

            case swf.DataGridViewContentAlignment.TopCenter:
            case swf.DataGridViewContentAlignment.MiddleCenter:
            case swf.DataGridViewContentAlignment.BottomCenter:
                return(VerticalAlignment.Center);

            case swf.DataGridViewContentAlignment.TopRight:
            case swf.DataGridViewContentAlignment.MiddleRight:
            case swf.DataGridViewContentAlignment.BottomRight:
                return(VerticalAlignment.Bottom);
            }
        }
예제 #4
0
        /// <summary>
        /// 增加列的事件
        /// </summary>
        /// <param name="ColumnName">用于填充这个ExDataGridView的DataTable的列名</param>
        /// <param name="DisplayName">在界面上显示的名称</param>
        /// <param name="DisplayWidth">列宽</param>
        /// <param name="IFReadOnly">是否只读</param>
        /// <param name="ColumnType">列的类型</param>
        /// <param name="Aligment">对齐方式</param>
        /// <param name="FormatString">显示格式</param>
        /// <param name="Visable">是否可见</param>
        public void AddColumn(string ColumnName, string DisplayName, Int16 DisplayWidth = 80, bool IFReadOnly = true,
                              System.Windows.Forms.DataGridViewColumn ColumnType        = null, System.Windows.Forms.DataGridViewContentAlignment Aligment = DataGridViewContentAlignment.MiddleLeft,
                              string FormatString = null, bool Visable = true)
        {
            DataGridViewColumn        obj  = new DataGridViewColumn();
            DataGridViewTextBoxColumn obj1 = new DataGridViewTextBoxColumn();

            if (ColumnType == null)
            {
                obj = obj1;
            }
            else
            {
                obj = ColumnType;
            }

            obj.DataPropertyName = ColumnName;
            obj.HeaderText       = DisplayName;
            obj.Name             = ColumnName;

            obj.Width    = DisplayWidth;
            obj.ReadOnly = IFReadOnly;
            obj.Visible  = Visable;

            obj.CellTemplate.Style.Alignment = Aligment;
            obj.CellTemplate.Style.Format    = FormatString;

            this.Columns.AddRange(obj);
        }