Exemplo n.º 1
0
        void _flex_OwnerDrawCell(object sender, OwnerDrawCellEventArgs e)
        {
            if (_flex.Cols[e.Col].UserData != null && e.Row >= _flex.Rows.Fixed)
            {
                double value;
                if (double.TryParse(_flex.GetDataDisplay(e.Row, e.Col), NumberStyles.Any, CultureInfo.CurrentCulture, out value))
                {
                    // calculate bar extent
                    Rectangle rc  = e.Bounds;
                    double    max = (double)_flex.Cols[e.Col].UserData;
                    rc.Width = (int)(_flex.Cols[e.Col].WidthDisplay * value / max);

                    // draw background
                    e.DrawCell(DrawCellFlags.Background | DrawCellFlags.Border);

                    // draw bar
                    rc.Inflate(-2, -2);
                    e.Graphics.FillRectangle(Brushes.Turquoise, rc);
                    rc.Inflate(-1, -1);
                    e.Graphics.FillRectangle(Brushes.Teal, rc);
                    e.Text = (value * 100).ToString() + "%";

                    // draw cell content
                    e.DrawCell(DrawCellFlags.Content);
                }
            }
        }
Exemplo n.º 2
0
        // draw collapse/expand icon on first fixed column (right-aligned)
        //
        // the icon is drawn if the grid contains subordinate data tables
        // (_colChild != null)
        //
        // the row is expanded if there is a child grid under it, otherwise
        // it's collapsed.
        //
        override protected void OnOwnerDrawCell(OwnerDrawCellEventArgs e)
        {
            // always call base implementation
            base.OnOwnerDrawCell(e);

            // draw collapse/expand icon
            if (_colChild != null && e.Col == 0 && Cols.Fixed > 0 &&
                e.Row >= Rows.Fixed && !Rows[e.Row].IsNode && !Rows[e.Row].IsNew)
            {
                if (Rows[e.Row].UserData != null)
                {
                    // this row has children and they're visible
                    e.Image = Glyphs[GlyphEnum.Expanded];
                }
                else
                {
                    // check if this row has children <<B2>>
                    IList list = _colChild[e.Row] as IList;
                    if (list != null)
                    {
                        if (list.Count > 0)
                        {
                            // it does, but they're not visible
                            e.Image = Glyphs[GlyphEnum.Collapsed];
                        }
                        else if (this.AllowAddNew)
                        {
                            // no children, but maybe the user want to add some...
                            e.Image = Glyphs[GlyphEnum.DBAdd];
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        //------------------------------------------------
        #region ** Overrides
        protected override void OnOwnerDrawCell(OwnerDrawCellEventArgs e)
        {
            // highlight appointment busy status and label
            if (e.Col == 1)
            {
                Appointment app = Rows[e.Row].UserData as Appointment;
                if (app != null && app.BusyStatus != null)
                {
                    // Draw the background.
                    e.Graphics.FillRectangle(app.BusyStatus.Brush.Brush, e.Bounds);
                    // Let the grid draw the border.
                    e.DrawCell(DrawCellFlags.Border);
                    // We' re done drawing this cell.
                    e.Handled = true;
                }
            }
            if (e.Col == 2)
            {
                Appointment app = Rows[e.Row].UserData as Appointment;
                if (app != null && app.Label != null)
                {
                    // Draw the background.
                    e.Graphics.FillRectangle(app.Label.Brush.Brush, e.Bounds);

                    e.Style.ForeColor = System.Drawing.Color.Black;
                    // Let the grid draw the content and border.
                    e.DrawCell(DrawCellFlags.Border | DrawCellFlags.Content);

                    // We' re done drawing this cell.
                    e.Handled = true;
                }
            }
            base.OnOwnerDrawCell(e);
        }
Exemplo n.º 4
0
        private void _flex_OwnerDrawCell(object sender, OwnerDrawCellEventArgs e)
        {
            var columnName = _flex.Cols[e.Col].Name;

            // custom paint cells for change column
            if (_flex[e.Row, e.Col] is decimal && columnName == "Change")
            {
                var value = (decimal)_flex[e.Row, e.Col];
                if (value >= 0)
                {
                    e.Style = _flex.Styles["Green"];
                    e.Image = LoadImage("UpGreen");
                }
                else
                {
                    e.Style = _flex.Styles["Red"];
                    e.Image = LoadImage("DownRed");
                }
            }

            // custom paint cells for raiting
            if (_flex[e.Row, e.Col] is int && columnName == "Rating")
            {
                var value = (int)_flex[e.Row, e.Col];
                if (value > 0)
                {
                    e.Style = _flex.Styles["Rating"];
                    e.Image = LoadImage($"star{value}");
                }
            }
        }
 private void _grid_OwnerDrawCell(object sender, OwnerDrawCellEventArgs e)
 {
     if (e.Column.Name == "Progress")
     { 
         // Create a gradient brush
         Point pt1, pt2;
         pt1 = new Point(e.CellRect.X, e.CellRect.Y);
         pt2 = new Point(e.CellRect.Right, e.CellRect.Y);
         SolidBrush solidBrush = new SolidBrush(e.Row % 2 == 0 ? _grid.EvenRowStyle.BackColor : _grid.OddRowStyle.BackColor);
         LinearGradientBrush linGrBrush = new LinearGradientBrush(pt1, pt2, Color.Cyan, Color.DarkBlue);
         RectangleF rt = new RectangleF(e.CellRect.X, e.CellRect.Y, Convert.ToInt32(e.CellRect.Width * .7), e.CellRect.Height);
         // Fill solid brackground
         e.Graphics.FillRectangle(solidBrush, e.CellRect);
         // Fill the cell rectangle with the gradient. 
         e.Graphics.FillRectangle(linGrBrush, e.Row % 2 == 0 ? rt : e.CellRect);
         Brush whiteBR = new SolidBrush(Color.White);
         C1DisplayColumn dispCol = this._grid.Splits[0].DisplayColumns[e.Col];
         // Center the text horizontally. 
         StringFormat sfmt = new StringFormat();
         sfmt.Alignment = StringAlignment.Far;
         // Draw the text. 
         e.Graphics.DrawString(dispCol.DataColumn.CellText(e.Row), dispCol.Style.Font, whiteBR, rt, sfmt);
         whiteBR.Dispose();
         // Let the grid know the event was handled. 
         e.Handled = true;
     }
 }
Exemplo n.º 6
0
        private void _flexM_OwnerDrawCell(object sender, OwnerDrawCellEventArgs e)
        {
            CellRange rg;

            if (!_flexM.HasNormalRow)
            {
                return;
            }

            if (e.Row < _flexM.Rows.Fixed || e.Col < _flexM.Cols.Fixed)
            {
                return;
            }

            if ((D.GetString(_flexM[e.Row, "NM_DEPT_MTS"]) != D.GetString(_flexM[e.Row, "NM_DEPT"])) && D.GetString(_flexM[e.Row, "NM_DEPT"]) != "")
            {
                rg = _flexM.GetCellRange(e.Row, "NM_DEPT_MTS");
                rg.StyleNew.ForeColor = System.Drawing.Color.Blue;

                rg = _flexM.GetCellRange(e.Row, "NM_DEPT");
                rg.StyleNew.ForeColor = System.Drawing.Color.Blue;
            }

            if (D.GetString(_flexM[e.Row, "NO_APPLY"]) == "미반영")
            {
                CellStyle csCellstyle = _flexM.Styles.Add("CellStyle");
                csCellstyle.BackColor = System.Drawing.Color.LightGray;

                _flexM.Rows[e.Row].Style = csCellstyle;
            }
        }
Exemplo n.º 7
0
 private void c1FlexGrid1_OwnerDrawCell(object sender, OwnerDrawCellEventArgs e)
 {
     if (e.Row > 0 && e.Col == 6)
     {
         DrawBulletGraph(e.Graphics, e.Bounds, e.Row - 1);
         e.Handled = true;
     }
 }
Exemplo n.º 8
0
 private void _flex_OwnerDrawCell(object sender, OwnerDrawCellEventArgs e)
 {
     if (e.Row == _row && e.Col == _flex.Cols.Fixed - 1)
     {
         e.Style.ImageAlign = C1.Win.C1FlexGrid.ImageAlignEnum.CenterCenter;
         e.Style.Render(e.Graphics, e.Bounds, _dirty ? _bmpAdd : _bmpBlank);
         e.Handled = true;
     }
 }
Exemplo n.º 9
0
 private void _flex_OwnerDrawCell(object sender, OwnerDrawCellEventArgs e)
 {
     if (e.Row > 0 && e.Col > 0)
     {
         e.DrawCell(DrawCellFlags.Background);
         e.Graphics.DrawImage(_bmp, e.Bounds);
         e.DrawCell(DrawCellFlags.Border | DrawCellFlags.Content);
         e.Handled = true;
     }
 }
Exemplo n.º 10
0
        internal RenderObject MakeOwnerDrawCellRO(int row, int col, ref CellStyle cellStyle, ref string text, ref Image image)
        {
            bool handled = false;
            // draw rectangle:
            Rectangle rc = Rectangle.Empty;

            rc.Width  = Cols[col].WidthDisplay;
            rc.Height = Rows[row].HeightDisplay;

            Metafile meta;

            using (Graphics gRef = Graphics.FromHwnd(IntPtr.Zero))
            {
                IntPtr hdcRef = gRef.GetHdc();
                meta = new Metafile(hdcRef, rc, MetafileFrameUnit.Pixel, EmfType.EmfPlusDual);
                using (Graphics g = Graphics.FromImage(meta))
                {
                    // owner-drawing cell borders is not supported:
                    CellBorder      cbSave = cellStyle.Border;
                    BorderStyleEnum bsSave = cbSave.Style;
                    IsPrinting = true;
                    OwnerDrawCellEventArgs e = new OwnerDrawCellEventArgs(
                        this, g, row, col, cellStyle, rc, text, image);
                    try
                    {
                        OnOwnerDrawCell(e);
                    }
                    finally
                    {
                        IsPrinting   = false;
                        cbSave.Style = bsSave;
                    }
                    handled = e.Handled;
                    if (!handled)
                    {
                        cellStyle = e.Style;
                        text      = e.Text;
                        image     = e.Image;
                    }
                }
                gRef.ReleaseHdc(hdcRef);
            }
            if (handled)
            {
                return(new RenderImage(meta));
            }
            // release unwanted resources asap:
            meta.Dispose();
            return(null);
        }
Exemplo n.º 11
0
        //--------------------------------------------------------------------------------
        #region ** overrides

        // draw collapse/expand icon on first fixed column (right-aligned)
        //
        // the icon is drawn if the grid contains subordinate data tables
        // (_colChild != null)
        //
        // the row is expanded if there is a child grid under it, otherwise
        // it's collapsed.
        //
        override protected void OnOwnerDrawCell(OwnerDrawCellEventArgs e)
        {
            // always call base implementation
            base.OnOwnerDrawCell(e);

            // draw collapse/expand icon
            if (_colChild != null && e.Col == 0 && Cols.Fixed > 0 &&
                e.Row >= Rows.Fixed && !Rows[e.Row].IsNode && !Rows[e.Row].IsNew)
            {
                e.Image = (Rows[e.Row].UserData != null)
                                        ? Glyphs[GlyphEnum.Expanded]
                                        : Glyphs[GlyphEnum.Collapsed];
            }
        }
Exemplo n.º 12
0
        void grid_OwnerDrawCell(object sender, OwnerDrawCellEventArgs e)
        {
            var grid = sender as C1.Win.C1FlexGrid.C1FlexGrid;

            if (e.Row >= grid.Rows.Fixed &&
                e.Col >= grid.Cols.Fixed &&
                grid[e.Row, e.Col] is double)
            {
                var value = (double)grid[e.Row, e.Col];
                if (value > BIGVALUE)
                {
                    e.Style = _bigValue;
                }
            }
        }
Exemplo n.º 13
0
        private void fgLichSu_OwnerDrawCell(object sender, OwnerDrawCellEventArgs e)
        {
            var fg = fgLichSu;

            if (e.Row >= fgLichSu.Rows.Fixed)
            {
                if (fg.Cols[e.Col].Name == "MoTa")
                {
                    if (e.Text.Length > 100)
                    {
                        e.Text = HelperMethods.TruncateString(e.Text, 100) + " ...";
                    }
                }
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// セルのオーナードロー
        /// </summary>
        /// <param name="e"></param>
        protected override void OnOwnerDrawCell(OwnerDrawCellEventArgs e)
        {
            base.OnOwnerDrawCell(e);

            if (_barList == null)
            {
                return;
            }

            if (FixedRowIdx <= e.Row && e.Row < this.Rows.Count && e.Col == FrozenColumnIdx + 1)
            {
                e.DrawCell(C1.Win.C1FlexGrid.DrawCellFlags.Background | C1.Win.C1FlexGrid.DrawCellFlags.Border);
                //ストライプ描画
                DrawHourStripe(this.ScrollPosition.X, e.Bounds, e.Graphics);
                //バー描画
                DrawBar(this.ScrollPosition.X, e.Bounds, e.Graphics, _barList[e.Row - FixedRowIdx].BarList);
            }
        }
Exemplo n.º 15
0
        public override void OnDrawCell(C1FlexGridBase flex, OwnerDrawCellEventArgs e, C1FlexGridRenderer.CellType cellType)
        {
            if (cellType == CellType.ColumnHeader)
            {
                using (var brush = GetHeaderBrush(e.Bounds))
                {
                    // paint the cell background
                    e.Graphics.FillRectangle(brush, e.Bounds);

                    // paint the border and content
                    e.DrawCell(DrawCellFlags.Border | DrawCellFlags.Content);
                }
            }
            else
            {
                base.OnDrawCell(flex, e, cellType);
            }
        }
Exemplo n.º 16
0
 public virtual void DynamicRowColor(int curRow, OwnerDrawCellEventArgs e)
 {
     //动态列背景色
     if (this.DynamicRowColorFiled != "")
     {
         if (G.Core.GConvert.ToBool(this.DataSource.Tables[0].Rows[curRow - this.gGrid1.Rows.Fixed][this.DynamicRowColorFiled]))
         {
             for (int i = 0; i < this.gGrid1.Cols.Count; i++)
             {
                 CellStyle s  = this.gGrid1.Cols[curRow].Style;
                 CellStyle s1 = this.gGrid1.Styles[s.Name + "_DynaTrueColor"];
                 if (s1 == null)
                 {
                     s1           = this.gGrid1.Styles.Add(s.Name + "_DynaTrueColor", s1);
                     s1.ForeColor = this.DynamicRowColorName;
                 }
                 e.Style = s1;
             }
         }
     }
 }
Exemplo n.º 17
0
        private void _flexM_OwnerDrawCell(object sender, OwnerDrawCellEventArgs e)
        {
            CellRange rg;

            if (!_flexM.HasNormalRow)
            {
                return;
            }

            if (e.Row < _flexM.Rows.Fixed || e.Col < _flexM.Cols.Fixed)
            {
                return;
            }

            if (D.GetString(_flexM[e.Row, "TP_INDEX"]) == "자료변경")
            {
                CellStyle csCellstyle = _flexM.Styles.Add("CellStyle");
                csCellstyle.BackColor = System.Drawing.Color.FromArgb(((Byte)(255)), ((Byte)(230)), ((Byte)(230)));

                _flexM.Rows[e.Row].Style = csCellstyle;

                if (D.GetString(_flexM[e.Row, "AM_BUDGET"]) != D.GetString(_flexM[e.Row, "PUB_BUDGET"]))
                {
                    rg = _flexM.GetCellRange(e.Row, "AM_BUDGET");
                    rg.StyleNew.ForeColor = System.Drawing.Color.Red;
                }

                if (D.GetString(_flexM[e.Row, "AM_AGY_PRICE"]) != D.GetString(_flexM[e.Row, "PUB_AGY_PRICE"]))
                {
                    rg = _flexM.GetCellRange(e.Row, "AM_AGY_PRICE");
                    rg.StyleNew.ForeColor = System.Drawing.Color.Red;
                }

                if (D.GetString(_flexM[e.Row, "AM_MEDIA_PRICE"]) != D.GetString(_flexM[e.Row, "PUB_MEDIA_PRICE"]))
                {
                    rg = _flexM.GetCellRange(e.Row, "AM_MEDIA_PRICE");
                    rg.StyleNew.ForeColor = System.Drawing.Color.Red;
                }
            }
        }
Exemplo n.º 18
0
        public override void OnDrawCell(C1FlexGridBase flex, OwnerDrawCellEventArgs e, C1FlexGridRenderer.CellType cellType)
        {
            try
            {

                if (cellType == CellType.Highlight)
                {
                    if (e.Style.Name == "Modified")
                    {
                        cellType = CellType.RowHeaderSelectedHot;

                        CellRange rg = flex.GetCellRange(e.Row, 1, e.Row, flex.Cols.Count - 1);
                        rg.Style = flex.Styles["Modified"];
                    }
                    else
                    if (e.Style.Name == "Added")
                    {
                        cellType = CellType.RowHeaderSelectedHot;

                        CellRange rg = flex.GetCellRange(e.Row, 1, e.Row, flex.Cols.Count - 1);
                        rg.Style = flex.Styles["Added"];
                    }
                    else
                    if (e.Style.Name == "Detached")
                    {
                        cellType = CellType.RowHeaderSelectedHot;

                        CellRange rg = flex.GetCellRange(e.Row, 1, e.Row, flex.Cols.Count - 1);
                        rg.Style = flex.Styles["Detached"];
                    }
                    else
                    {
                       cellType = CellType.Normal;
                       // cellType = CellType.ColumnHeaderSelected;
                    }
                }

                base.OnDrawCell(flex, e, cellType);
            }catch{}
        }
Exemplo n.º 19
0
 protected override void OnOwnerDrawCell(OwnerDrawCellEventArgs e)
 {
     base.OnOwnerDrawCell(e);
 }
Exemplo n.º 20
0
        private void grilla_OwnerDrawCell(object sender, OwnerDrawCellEventArgs e)
        {
            var datoFila = grilla.Rows[e.Row].DataSource as Clasesita;
            if(datoFila != null)
            {
                if (string.IsNullOrWhiteSpace(datoFila.DescripcionPersona))
                {
                    /*e.Graphics.FillRectangle(Brushes.Green, e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height);

                    e.Text = "aASDAS";*/

                    //e.Handled = true;
                }
            }
        }
Exemplo n.º 21
0
        private void GrillaC1FlexGrid_OwnerDrawCell(object sender, OwnerDrawCellEventArgs e)
        {
            /*if (e.Col == _columnaDiasPresupuestados.SafeIndex)
            {
                var estiloFila = grillaC1FlexGrid.Rows[e.Row].Style;

                var estiloSubtotal0 = grillaC1FlexGrid.Styles[CellStyleEnum.Subtotal0];
                var estiloSubtotal1 = grillaC1FlexGrid.Styles[CellStyleEnum.Subtotal1];
                if (estiloFila == null || (estiloFila.Name != estiloSubtotal0.Name && estiloFila.Name != estiloSubtotal1.Name))
                {
                    e.Handled = true;
                }
            }*/
        }
Exemplo n.º 22
0
        // draw cells to make them look like Outlook
        private void _flex_OwnerDrawCell(object sender, OwnerDrawCellEventArgs e)
        {
            // do not paint while measuring
            if (e.Graphics == null)
            {
                return;
            }

            // custom draw only scrollable rows on tree column
            if (_groups.Count == 0)
            {
                return;
            }
            if (e.Col != _flex.Tree.Column)
            {
                return;
            }
            if (e.Row < _flex.Rows.Fixed)
            {
                return;
            }

            // get parameters we'll need
            Row row = _flex.Rows[e.Row];

            if (row.Node == null)
            {
                return;
            }
            int       idt = _flex.Tree.Indent;
            int       x   = _flex.ScrollPosition.X;
            int       lvl = row.Node.Level;
            Rectangle rc;

            // custom draw nodes
            UpdateObjects();
            if (row.IsNode)
            {
                // draw background and content
                e.Style = _styleGroup;
                e.DrawCell(DrawCellFlags.Background | DrawCellFlags.Content);

                // draw line above
                if (lvl == 0 || !_flex.Rows[e.Row - 1].IsNode)
                {
                    rc = e.Bounds;
                    OffsetLeft(ref rc, lvl * idt + x);
                    rc.Height = 1;
                    e.Graphics.FillRectangle(_brBdr, rc);
                }

                // if the node is expanded, draw line below
                if (row.Node.Expanded)
                {
                    rc = e.Bounds;
                    OffsetLeft(ref rc, (lvl + 1) * idt + x);
                    rc.Y      = rc.Bottom - 1;
                    rc.Height = 1;
                    e.Graphics.FillRectangle(_brBdr, rc);
                }

                // draw vertical lines to the left of the symbol
                rc       = e.Bounds;
                rc.X    += x;
                rc.Width = 1;
                for (int i = 0; i <= lvl; i++)
                {
                    e.Graphics.FillRectangle(_brBdr, rc);
                    rc.Offset(idt, 0);
                }

                // done
                return;
            }

            // custom draw data
            {
                // base painting
                e.DrawCell();

                // fill area on the left
                rc       = e.Bounds;
                rc.Width = (lvl + 1) * idt;
                e.Graphics.FillRectangle(_brGrp, rc);

                // draw vertical lines over filled area
                rc       = e.Bounds;
                rc.Width = 1;
                for (int i = 0; i <= lvl + 1; i++)
                {
                    e.Graphics.FillRectangle(_brBdr, rc);
                    rc.Offset(idt, 0);
                }
            }
        }
Exemplo n.º 23
0
        private void c1FlexGrid1_OwnerDrawCell(object sender, OwnerDrawCellEventArgs e)
        {
            if (e.Row <= 0)
            {
                return;
            }

            //Handle Hyperlinks
            if (e.Col == _hyperlinkCol)
            {
                FlexHyperlink link = c1FlexGrid1[e.Row, e.Col] as FlexHyperlink;
                if (link != null)
                {
                    e.Style = c1FlexGrid1.Styles[link.Visited ? "OldLink" : "NewLink"];
                }
            }

            //Handle Progress Bars
            else if (e.Col == _progressBarCol && e.Row > 0 && e.Row < c1FlexGrid1.Rows.Count - 1)
            {
                //Get underlying value
                int value = 0;
                if (c1FlexGrid1[e.Row, e.Col] == null)
                {
                    c1FlexGrid1[e.Row, e.Col] = value;
                }
                else
                {
                    value = (int)c1FlexGrid1[e.Row, e.Col];
                }
                if (value < 0)
                {
                    value = 0;
                }
                if (value > 100)
                {
                    value = 100;
                }

                // draw background
                //e.Style = c1FlexGrid1.Styles.Highlight;
                e.DrawCell(DrawCellFlags.Background);

                // draw progress bar background from actual ProgressBar control
                Rectangle rc = e.Bounds;
                rc.Inflate(-2, -2);
                _bmp    = new Bitmap(e.Bounds.Size.Width, e.Bounds.Size.Height);
                pb.Size = e.Bounds.Size;
                pb.DrawToBitmap(_bmp, new Rectangle(new Point(0, 0), e.Bounds.Size));
                e.Graphics.DrawImage(_bmp, rc);

                //Draw Green Progress image over top of background
                rc.Width = rc.Width * value / 100;
                rc.Inflate(-1, -1);
                e.Graphics.DrawImage(imageList1.Images["progress.png"], rc);

                // draw text
                e.Text = value.ToString() + "%";
                e.DrawCell(DrawCellFlags.Content);
                e.Handled = true;
            }
        }
Exemplo n.º 24
0
        private void _flexM_OwnerDrawCell(object sender, OwnerDrawCellEventArgs e)
        {
            CellRange rg;
            CellStyle csCellstyle = _flexM.Styles.Add("CellStyle");

            if (!_flexM.HasNormalRow)
            {
                return;
            }

            if (e.Row < _flexM.Rows.Fixed || e.Col < _flexM.Cols.Fixed)
            {
                return;
            }

            if (D.GetString(_flexM[e.Row, "cpname"]) == "조정 전표" || D.GetString(_flexM[e.Row, "cpname"]) == "디지털광고매출" || D.GetString(_flexM[e.Row, "cpname"]) == "네트워크광고매출" || D.GetString(_flexM[e.Row, "cpname"]) == "기타매출" || D.GetString(_flexM[e.Row, "cpname"]) == "총계")
            {
                _flexM[e.Row, 0] = ""; //상단 고정그리드 숫자 지우기

                rg = _flexM.GetCellRange(e.Row, "S");
                rg.StyleNew.Display = DisplayEnum.None;

                rg = _flexM.GetCellRange(e.Row, "S1");
                rg.StyleNew.Display = DisplayEnum.None;

                rg = _flexM.GetCellRange(e.Row, "S2");
                rg.StyleNew.Display = DisplayEnum.None;
            }
            else
            {
                if (D.GetString(_flexM[e.Row, "actyear"]) != D.GetString(_flexM[e.Row, "yearmonth"]))
                {
                    rg = _flexM.GetCellRange(e.Row, "yearmonth");
                    rg.StyleNew.ForeColor = System.Drawing.Color.Red;
                }

                if (D.GetString(_flexM[e.Row, "actyear"]) != D.GetString(_flexM[e.Row, "yearmonth2"]))
                {
                    rg = _flexM.GetCellRange(e.Row, "yearmonth2");
                    rg.StyleNew.ForeColor = System.Drawing.Color.Red;
                }

                if (D.GetString(_flexM[e.Row, "trade_type_d"]) == "순액")
                {
                    rg = _flexM.GetCellRange(e.Row, "trade_type_d");
                    rg.StyleNew.ForeColor = System.Drawing.Color.Red;
                }

                if (D.GetString(_flexM[e.Row, "trade_type_m"]) == "순액")
                {
                    rg = _flexM.GetCellRange(e.Row, "trade_type_m");
                    rg.StyleNew.ForeColor = System.Drawing.Color.Red;
                }

                if (D.GetDecimal(_flexM[e.Row, "budget"]) < 0)
                {
                    rg = _flexM.GetCellRange(e.Row, "budget");
                    rg.StyleNew.ForeColor = System.Drawing.Color.Red;
                }

                if (D.GetDecimal(_flexM[e.Row, "agy_price"]) < 0)
                {
                    rg = _flexM.GetCellRange(e.Row, "agy_price");
                    rg.StyleNew.ForeColor = System.Drawing.Color.Red;
                }

                if (D.GetDecimal(_flexM[e.Row, "income"]) < 0)
                {
                    rg = _flexM.GetCellRange(e.Row, "income");
                    rg.StyleNew.ForeColor = System.Drawing.Color.Red;
                }

                if (D.GetDecimal(_flexM[e.Row, "corp_amt"]) < 0)
                {
                    rg = _flexM.GetCellRange(e.Row, "corp_amt");
                    rg.StyleNew.ForeColor = System.Drawing.Color.Red;
                }

                if (D.GetString(_flexM[e.Row, "closed"]) == "마감")
                {
                    rg = _flexM.GetCellRange(e.Row, "closed");
                    rg.StyleNew.BackColor = System.Drawing.Color.LightYellow;
                }

                if (D.GetString(_flexM[e.Row, "status"]) == "승인")
                {
                    rg = _flexM.GetCellRange(e.Row, "status");
                    rg.StyleNew.BackColor = System.Drawing.Color.LightYellow;
                }
            }

            if (D.GetString(_flexM[e.Row, "cpname"]) == "디지털광고매출")
            {
                csCellstyle.BackColor    = System.Drawing.Color.FromArgb(((Byte)(250)), ((Byte)(191)), ((Byte)(143)));
                _flexM.Rows[e.Row].Style = csCellstyle;
            }

            if (D.GetString(_flexM[e.Row, "cpname"]) == "네트워크광고매출")
            {
                csCellstyle.BackColor    = System.Drawing.Color.FromArgb(((Byte)(149)), ((Byte)(179)), ((Byte)(215)));
                _flexM.Rows[e.Row].Style = csCellstyle;
            }

            if (D.GetString(_flexM[e.Row, "cpname"]) == "기타매출")
            {
                csCellstyle.BackColor    = System.Drawing.Color.FromArgb(((Byte)(177)), ((Byte)(160)), ((Byte)(199)));
                _flexM.Rows[e.Row].Style = csCellstyle;
            }

            if (D.GetString(_flexM[e.Row, "cpname"]) == "총계")
            {
                csCellstyle.BackColor    = System.Drawing.Color.FromArgb(((Byte)(196)), ((Byte)(215)), ((Byte)(155)));
                _flexM.Rows[e.Row].Style = csCellstyle;
            }

            if (D.GetString(_flexM[e.Row, "cpname"]) == "조정 전표")
            {
                csCellstyle.BackColor    = System.Drawing.Color.FromArgb(((Byte)(255)), ((Byte)(230)), ((Byte)(230)));
                _flexM.Rows[e.Row].Style = csCellstyle;
            }
        }
Exemplo n.º 25
0
        private void c1FlexGrid_Conf_OwnerDrawCell_1(object sender, OwnerDrawCellEventArgs e)
        {
            C1.Win.C1FlexGrid.C1FlexGrid flex = sender as C1.Win.C1FlexGrid.C1FlexGrid;
            // only apply styles to scrollable cells
            if (e.Row < flex.Rows.Fixed || e.Col < flex.Cols.Fixed)
                return;

            // get underlying DataRow
            int indexRow = flex.Rows[e.Row].DataIndex;
              //if (indexRow < 0) return;

            CurrencyManager cm = (CurrencyManager)BindingContext[flex.DataSource, flex.DataMember];
            DataRowView drv = cm.List[indexRow] as DataRowView;
               // e.Style.BackColor = Color.White;
            // select style based on row state
            switch (drv.Row.RowState)
            {

                case DataRowState.Added:
                 //   e.Style = flex.Styles["Added"];
                  //  bTableChanged = true;
                    break;
                case DataRowState.Modified:
                  //  e.Style = flex.Styles["Modified"];
                  //  bTableChanged = true;
                    if ( indexRow +1== e.Row)
                    {
                       // CellRange rg = flex.GetCellRange(e.Row, 0);
                       // rg.Image = Image.FromFile(@"d:\Arbeit\Hephaistos\lib\Pics\Miscellaneous\Error-icon.png");
                       // e.Style.BackColor = Color.Gold;
                    }
                    break;
                case DataRowState.Detached:
                //    e.Style = flex.Styles["Detached"];
               //     bTableChanged = true;
                    break;
                case DataRowState.Unchanged:
                    if (e.Row == flex.RowSel)
                    {
                 //       e.Style.BackColor = Color.LightBlue;
                    }
                    else
                    {
                   //     e.Style.BackColor = Color.White;
                    }
                    break;
                default:
                    break;
            }
        }
Exemplo n.º 26
0
        // Conditions OwnerDraw
        private void c1FlexGrid_Conditions_OwnerDrawCell(object sender, OwnerDrawCellEventArgs e)
        {
            C1.Win.C1FlexGrid.C1FlexGrid _flex = sender as C1.Win.C1FlexGrid.C1FlexGrid;
               // only apply styles to scrollable cells
               if (e.Row < _flex.Rows.Fixed || e.Col < _flex.Cols.Fixed)
               return;

               // get underlying DataRow
               int indexRow = _flex.Rows[e.Row].DataIndex;
               int indexCol = _flex.Cols[e.Col].DataIndex;
               if (indexRow < 0) return;

               if (bConditionTableChanged)
               {

              CurrencyManager cm = (CurrencyManager)BindingContext[_flex.DataSource, _flex.DataMember];

              DataRowView drv = cm.List[indexRow] as DataRowView;

              switch (drv.Row.RowState)
                {
                    case DataRowState.Added:
                       // e.Style = _flex.Styles["Added"];
                        SetConditionSaveButtonEnabled(true);
                        //  bConditionTableChanged = true;
                        break;

                    case DataRowState.Modified:
                     //   e.Style = _flex.Styles["Modified"];
                      //  e.Style.BackColor = Color.Red;
                        SetConditionSaveButtonEnabled(true);
                        //  bConditionTableChanged = true;

                        break;

                    default:
                    //    e.Style.BackColor = Color.White;
                        break;
                }
               }
            //   e.Handled = true;
        }
Exemplo n.º 27
0
        // command OwnerDraw
        private void c1FlexGrid_Commands_OwnerDrawCell(object sender, OwnerDrawCellEventArgs e)
        {
            C1.Win.C1FlexGrid.C1FlexGrid _flex = sender as C1.Win.C1FlexGrid.C1FlexGrid;
               // only apply styles to scrollable cells
               if (e.Row < _flex.Rows.Fixed || e.Col < _flex.Cols.Fixed)
               return;

               // get underlying DataRow
               int indexRow = _flex.Rows[e.Row].DataIndex;
               if (indexRow < 0) return;
               DataRowView drv = null;
               try
               {
               CurrencyManager cm = (CurrencyManager)BindingContext[_flex.DataSource, _flex.DataMember];
                drv = cm.List[indexRow] as DataRowView;
               }
               catch { }

               if (bCommandTableChanged && drv!=null)
               {
               // select style based on row state
               switch (drv.Row.RowState)
               {
                   case DataRowState.Added:
                     //  e.Style = _flex.Styles["Added"];
                       //  bCommandTableChanged = true;
                       // SetConditionSaveButtonEnabled(true);
                       break;
                   case DataRowState.Modified:
                      // e.Style = _flex.Styles["Modified"];
                       //  bCommandTableChanged = true;
                       //  SetConditionSaveButtonEnabled(true);
                       break;

                   default:
                       break;
               }
               }
        }