Пример #1
0
        public void BuildColumns()
        {
            gridView.BeginDataUpdate();
            try
            {
                DeleteColumns();
                GridColumn column = null;

                int iStep = (int)m_currentView;

                int iMax = Utills.MinutesInDay;

                int iCount  = iMax / iStep;
                int iHour   = 0;
                int iMinute = 0;
                m_columnsInfo = new TimeColumnInfo[iCount];

                for (int i = 0; i < iCount; i++)
                {
                    column         = gridView.Columns.Add();
                    column.Name    = "gcHour_" + i;
                    column.Caption = TextParser.BuildColumnCaption(iHour, iMinute, iStep);
                    //String.Format("{0}:{1}", iHour.ToString("00"), iMinute.ToString("00"));
                    column.MinWidth = 40;
                    column.Visible  = true;
                    //column.VisibleIndex = i;// 1 + i;
                    column.Width = 45;

                    //column.AppearanceHeader.Options.UseTextOptions = true;
                    column.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
                    column.AppearanceHeader.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;
                    //column.AppearanceHeader.TextOptions.WordWrap = DevExpress.Utils.WordWrap.NoWrap;
                    column.OptionsColumn.ReadOnly  = true;
                    column.OptionsColumn.AllowEdit = false;
                    column.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Custom;
                    column.SummaryItem.Tag         = i;


                    m_columnsInfo[i] = new TimeColumnInfo(iHour * 60 + iMinute, iHour * 60 + iMinute + iStep, true);
                    column.Tag       = m_columnsInfo[i];
                    m_columnsDiction[m_columnsInfo[i]] = column;

                    iMinute += iStep;
                    if (iMinute == 60)
                    {
                        iHour++;
                        iMinute = 0;
                    }
                }
                PrepareColumnsView();
            }
            finally
            {
                gridView.EndDataUpdate();
            }
        }