Example #1
0
        // 新增一个内容列
        // parameters:
        //      nColIndex   按内容计算。0 表示第一个内容列,注意,不是读者参数列
        void NewContentCol(string strBookType,
            int nColIndex)
        {
            this._bookTypes.Insert(nColIndex, strBookType);

            // 第一行
            {
#if NO
                Label label = new Label();
                label.Content = strBookType;
                label.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
                label.FontSize = 24;
                label.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255));
                label.MouseDown += new MouseButtonEventHandler(label_column_MouseDown);

                Grid.SetColumn(label, nColIndex + 2);
                Grid.SetRow(label, 0);
                this._grid.Children.Add(label);

                _columnLabels.Add(label);
#endif
                Label label = InsertColumnTitle(strBookType, nColIndex + 2);
                SelectTitle(label); // 选中
            }

            int nRowIndex = 1;
            // 其余行
            foreach (Row row in this._rows)
            {
                PolicyCell cell = new PolicyCell();
                cell.CommentText = row.ReaderType + " - " + strBookType;
                row.Cells.Insert(nColIndex, cell);

                Grid.SetColumn(cell, nColIndex + 2);
                Grid.SetRow(cell, nRowIndex);
                this._grid.Children.Add(cell);


                // 右边重新设置
                for (int i = nColIndex + 1; i < row.Cells.Count; i++)
                {
                    PolicyCell current = row.Cells[i];

                    Grid.SetColumn(current, i + 2);
                }

                nRowIndex++;
            }

            SetColButton(this._columnLabels.Count + 1);
            SetColRowDefinitions();
        }
Example #2
0
        // 新增一个内容行
        // parameters:
        //      nRowIndex   全部行的坐标
        Row InsertContentLine(string strReaderType,
            ref int nRowIndex)
        {
            int nColIndex = 0;

            Row new_row = new Row();
            this._rows.Insert(nRowIndex - 1, new_row);
            new_row.ReaderType = strReaderType;
            new_row.PatronPolicyCell = new PatronPolicyCell();
            // row.PatronPolicyCell.TextChanged += new TextChangedEventHandler(PatronPolicyCell_TextChanged);
            new_row.PatronPolicyCell.CommentText = strReaderType;

            // 将全部日历名进行筛选,只给读者参数里面设置分馆的日历
            List<string> temp = GetCarlendarNamesByLibraryCode(this._strCurrentLibraryCode,
                _calendarList);
            new_row.PatronPolicyCell.CalendarList = temp;

            // 0
            Label label = new Label();
            label.Content = strReaderType;
            label.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            label.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Right;
            label.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
            label.VerticalContentAlignment = System.Windows.VerticalAlignment.Center;
            label.FontSize = 24;
            label.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255));

            Grid.SetColumn(label, nColIndex++);
            Grid.SetRow(label, nRowIndex);
            this._grid.Children.Add(label);

            new_row.Label = label;
            new_row.Label.MouseDown += new MouseButtonEventHandler(Label_row_MouseDown);

            // 1 读者参数
            Grid.SetColumn(new_row.PatronPolicyCell, nColIndex++);
            Grid.SetRow(new_row.PatronPolicyCell, nRowIndex);
            this._grid.Children.Add(new_row.PatronPolicyCell);

            // 其他栏
            // 若干图书类型
            foreach (string strBookType in this._bookTypes)
            {
                PolicyCell cell = new PolicyCell();
                cell.CommentText = strReaderType + " - " + strBookType;
                // cell.TextChanged += new TextChangedEventHandler(cell_TextChanged);
                Grid.SetColumn(cell, nColIndex++);
                Grid.SetRow(cell, nRowIndex);
                this._grid.Children.Add(cell);

                new_row.Cells.Add(cell);
            }

            // 下面的行移动
            for (int i = nRowIndex; i < this._rows.Count; i++)
            {
                Row row = this._rows[i];

                Grid.SetRow(row.Label, i + 1);
                Grid.SetRow(row.PatronPolicyCell, i + 1);
                foreach (PolicyCell cell in row.Cells)
                {
                    Grid.SetRow(cell, i + 1);
                }
            }

            nRowIndex++;

            if (this._inInitial == false)
                AddRowEvents(new_row, true);
            return new_row;
        }