Hi!
I want to draw the char to the cell by the Graphics. First i set the string to the cell ,second i draw the string by handling the CellPaint Event.
the code is in the following.
this.radGridView.EnbleCustomDrawing = true;
this.radGridView.Rows[1].cells[1] = "+++++-----";
private void radGridView1_CellPaint(object sender, GridViewCellPaintEventArgs e)
{
string content = e.Cell.Value as string;
if (string.IsNullOrEmpty(content))
{
return;
}
SolidBrush solidBrush = new SolidBrush(Color.Blue);
int x = e.Cell.Bounds.Right - content.Length * 6 - 7;
int y = e.Cell.Bounds.Y + 2;
if (e.Cell.ColumnIndex != 1) return;
foreach (char ch in content)
{
solidBrush.Color = ch == '+' ? Color.Green : Color.Blue;
e.Graphics.DrawString(
ch.ToString()
, e.Cell.Font
, solidBrush
, x
, y);
x += 6;
}
In the result, i get the double string in the cell!
I want to diplay one string that i draw in the cell.
I'd like to konw how to get my purpose!
Regards
Hi!
How can I change color of scroll bars vertical and horizontal (for nested panels also)?
I do this:
this.TableElement.VScrollBar.BackColor = Color.Red;
this.TableElement.HScrollBar.BackColor = Color.Red;
but nothing changes.
Regards
System.NullReferenceException: Object reference not set to an instance of an object.
at Telerik.WinControls.Docking.DockSite.CalcSplitterMargin(Splitter& splitter)
at Telerik.WinControls.Docking.DockSite.OnMouseDown(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at Telerik.WinControls.Docking.DockSite.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
------------------------------------------------------------------------------------------------------------------------------------
Note: sub windows are the DockPanels which are added to the DockingManager using SetDock.
Thanks for any help,
Srinivas.