Пример #1
0
        private void PaintToolTip(ref Message msg)
        {
            try
            {
                if (m_ParentCell == null || string.IsNullOrEmpty(m_ParentCell.Text))
                {
                    ClearToolTip();
                    return;
                }

                Graphics GFX          = Graphics.FromHwnd(m_ToolTipWnd.Handle);
                Color    clrBackColor = m_ParentCell.DetermineBackColor(true);

                GFX.Clear(clrBackColor);

                Pen brderPen = new Pen(UtilityFunctions.AdjustBrightness(clrBackColor, 0.8), BORDERWIDTH);
                GFX.DrawRectangle(brderPen, 0, 0, m_ClientRectangle.Width - BORDERWIDTH, m_ClientRectangle.Height - BORDERWIDTH);
                brderPen.Dispose();

                Rectangle valRect = m_ClientRectangle;
                valRect.Location = new Point(0, 0);
                valRect.Inflate(-2 * BORDERWIDTH, -2 * BORDERWIDTH);

                switch (m_ParentCell.GetColumnType())
                {
                case ColumnType.TextNoWrap:
                case ColumnType.TextWrap:
                case ColumnType.ComboBox:
                    m_ParentCell.DrawText(GFX, valRect, true, true);
                    break;

                case ColumnType.CheckBox:
                    m_ParentCell.DrawCheckBox(GFX, valRect);
                    break;

                case ColumnType.ProgressBar:
                    m_ParentCell.DrawProgressBar(GFX, valRect);
                    break;

                default:
                    break;
                }

                GFX.Dispose();

                msg.Result = IntPtr.Zero;
                Win32.ValidateRect(msg.HWnd, IntPtr.Zero);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
Пример #2
0
        private void DrawBaseCell(Graphics GFX, int x, int y)
        {
            int nWidth  = m_ParentRow.Parent.Columns[m_ColumnIndex].Width;
            int nHeight = m_ParentRow.Height;

            Brush BackColor = new SolidBrush(DetermineBackColor());

            GFX.FillRectangle(BackColor, x, y, nWidth, nHeight);
            BackColor.Dispose();

            if (m_ParentRow.Parent.Parent.ShowGridLines)
            {
                Pen Borders = new Pen(UtilityFunctions.AdjustBrightness(DetermineBackColor(), 0.75), 1);
                int bottom  = y + nHeight - (int)Borders.Width;
                int right   = x + nWidth - (int)Borders.Width;
                GFX.DrawLine(Borders, x, bottom, right, bottom);
                GFX.DrawLine(Borders, right, y, right, bottom);
                Borders.Dispose();
            }
        }