コード例 #1
0
 private void _flex_OwnerDrawCell(object sender, C1.Win.C1FlexGrid.OwnerDrawCellEventArgs e)
 {
     if (e.Row >= _flex.Rows.Fixed && _flex.Cols[e.Col].Name == "Password")
     {
         e.Text = new string('*', e.Text.Length);
     }
 }
コード例 #2
0
        // trap OwnerDrawCell event to return calculated values and to return
        // images stored in the database
        void flex_OwnerDrawCell(object sender, C1.Win.C1FlexGrid.OwnerDrawCellEventArgs e)
        {
            // images are stored in mdb as byte[]
            if (e.Row >= flex.Rows.Fixed)
            {
                // "FullName" is a calculated (unbound) column
                if (flex.Cols[e.Col].Name == "FullName")
                {
                    e.Text = flex[e.Row, "FirstName"] + " " + flex[e.Row, "LastName"];
                    return;
                }

                // "Photo" is an image stored in a blob (byte[])
                if (flex.Cols[e.Col].Name == "Photo")
                {
                    // try loading from mdb
                    e.Image = LoadImage(flex[e.Row, e.Col] as byte[]);

                    // if we got an image, blank text
                    if (e.Image != null)
                    {
                        e.Text = null;
                    }
                }
            }
        }
コード例 #3
0
ファイル: Frm_InterfaceFunc.cs プロジェクト: radtek/Interface
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void c1FlexGridFunc_OwnerDrawCell(object sender, C1.Win.C1FlexGrid.OwnerDrawCellEventArgs e)
 {
     if (e.Row >= this.c1FlexGridFunc.Rows.Fixed)
     {
         // 添加行号
         this.c1FlexGridFunc.Rows[e.Row][0] = e.Row - this.c1FlexGridFunc.Rows.Fixed + 1;
     }
 }
コード例 #4
0
        private void _flex_OwnerDrawCell(object sender, C1.Win.C1FlexGrid.OwnerDrawCellEventArgs e)
        {
            // custom paint cells that contain integers
            if (_flex[e.Row, e.Col] is int)
            {
                // show value as a number and as text
                int i = (int)_flex[e.Row, e.Col];
                e.Text = string.Format("{0:#,##0}: {1}", i, IntToString(i));

                // show background image
                if (e.Style.BackColor != _flex.Styles.Highlight.BackColor)
                {
                    e.Image = _picBkg.Image;
                }
            }
        }
コード例 #5
0
        void _flex_OwnerDrawCell(object sender, C1.Win.C1FlexGrid.OwnerDrawCellEventArgs e)
        {
            // ignore fixed cells
            if (e.Row < _flex.Rows.Fixed || e.Col < _flex.Cols.Fixed)
            {
                return;
            }

            // apply custom style if reorder level is critical
            if (_flex.Cols[e.Col].Name == "UnitsInStock")
            {
                if ((short)_flex[e.Row, "UnitsInStock"] < (short)_flex[e.Row, "ReorderLevel"])
                {
                    e.Style = _flex.Styles["Critical"];
                }
            }
        }
コード例 #6
0
 void _flex_OwnerDrawCell(object sender, C1.Win.C1FlexGrid.OwnerDrawCellEventArgs e)
 {
     if (_flex[e.Row, e.Col] is Color)
     {
         var clr = (Color)_flex[e.Row, e.Col];
         if (clr != null)
         {
             e.DrawCell(C1.Win.C1FlexGrid.DrawCellFlags.Background | C1.Win.C1FlexGrid.DrawCellFlags.Border);
             var rc = e.Bounds;
             rc.Inflate(-4, -2);
             using (var br = new SolidBrush(clr))
             {
                 e.Graphics.FillRectangle(br, rc);
                 e.Graphics.DrawRectangle(Pens.Black, rc);
             }
         }
     }
 }
コード例 #7
0
        private void _flex_OwnerDrawCell(object sender, C1.Win.C1FlexGrid.OwnerDrawCellEventArgs e)
        {
            string text = _flex[e.Row, e.Col] as string;

            if (text != null && text.StartsWith("="))
            {
                try
                {
                    // use DataTable to compute expression result
                    object value = _dtEngine.Compute(text.Substring(1), string.Empty);
                    e.Text = value.ToString();
                }
                catch (Exception x)
                {
                    e.Text = "Error in formula: " + x.Message;
                }
                e.Graphics.FillRectangle(Brushes.Beige, e.Bounds);
            }
        }
コード例 #8
0
 private void calibrGrid_OwnerDrawCell(object sender, C1.Win.C1FlexGrid.OwnerDrawCellEventArgs e)
 {
     if (e.Col == 0 || e.Row == 0)
     {
         return;
     }
     try
     {
         float value;
         if (float.TryParse(e.Text, out value))
         {
             value             = Math.Abs(value * paletteScale);
             e.Style.BackColor = Color.FromArgb(paletteFast.GetColorOnValue(value, SystemColors.Window.ToArgb()));
             e.Style.ForeColor = Color.Black;
         }
     }
     catch
     {}
 }