Exemple #1
0
        private void drawVezaItemColumn(Graphics g)
        {
            for (int row = 0; row < vezba.Elementi.Count; row++)
            {
                if (!vezba.isDeoVeze(row + 1))
                {
                    RectangleF rect = getItemCellRect(g, row, "VezaSaPrethodnim");
                    g.DrawRectangle(itemPen, rect.X, rect.Y, rect.Width, rect.Height);
                }
            }
            List <int> veze = vezba.getVeze();

            for (int i = 0; i < veze.Count / 2; i++)
            {
                int   firstElement = veze[2 * i];
                int   lastElement  = veze[2 * i + 1];
                float veza         = vezba.Elementi[lastElement].VezaSaPrethodnim.Value;

                RectangleF firstRect = getItemCellRect(g, firstElement, "VezaSaPrethodnim");
                RectangleF lastRect  = getItemCellRect(g, lastElement, "VezaSaPrethodnim");
                RectangleF rect      = new RectangleF(firstRect.Location,
                                                      new SizeF(firstRect.Width, lastRect.Bottom - firstRect.Top));
                g.DrawRectangle(itemPen, rect.X, rect.Y, rect.Width, rect.Height);

                string       text = veza.ToString(getColumnFormatString("VezaSaPrethodnim"));
                StringFormat sf   = getItemStringFormat("VezaSaPrethodnim");
                g.DrawString(text, tableItemFont, blackBrush, rect, sf);
            }
        }
        public override void updateVezaColumn()
        {
            disableAutomaticGridFooterUpdate();

            int        vezaCol = gridElementi.Columns["VezaSaPrethodnim"].Index;
            List <int> veze    = Vezba.getVeze();
            int        row     = 0;

            for (int i = 0; i < veze.Count / 2; i++)
            {
                int firstElement = veze[2 * i];
                int lastElement  = veze[2 * i + 1];
                while (row < firstElement)
                {
                    gridElementi.Rows[row++].Cells[vezaCol] = new DataGridViewTextBoxCell();
                }
                for (int j = firstElement; j <= lastElement; j++)
                {
                    gridElementi.Rows[j].Cells[vezaCol] = new VMergedCell(
                        firstElement, lastElement, StringAlignment.Center,
                        StringAlignment.Center);
                }
                gridElementi.Rows[firstElement].Cells[vezaCol].Value =
                    Vezba.Elementi[lastElement].VezaSaPrethodnim;
                row = lastElement + 1;
            }
            while (row < Vezba.Elementi.Count)
            {
                gridElementi.Rows[row++].Cells[vezaCol] = new DataGridViewTextBoxCell();
            }

            enableAutomaticGridFooterUpdate();
        }