radComboBox_1.BackColor = Color.Yellow;
EdMsk_A3.BackColor = Color.Yellow;
I need a control that is like the normal windows combobox, except
that for each item in the list the color for the background an forecolor differs, e.g.
Each Item has the same size (width, height)
ITEM 0 backcolour=red, forecolor=white
---------
ITEM 1 backcolor=black forecolor=white
---------
ITEM 2 backcolor=blue, forecolour=white
---------
ITEM 3 backcolor=green, forecolour=black
Thank you very much for the help.
Private Sub RadPanelBar1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles RadPanelBar1.MouseDown
Try
If e.Button = Windows.Forms.MouseButtons.Right Then
RadMessageBox.Show("Right click not allowed.")
Exit Sub
End If
Catch ex As Exception
RadMessageBox.Show(ex.ToString)
End Try
End Sub
private
void
radGrdDocuments_CellFormatting(
object
sender, CellFormattingEventArgs e)
{
if
(e.CellElement.ColumnIndex == 6)
{
if
((radGrdDocuments.Rows[e.CellElement.RowIndex].Cells[
"colType"
].Value.ToString() ==
"1"
))
{
GridViewCellInfo sizeCell =
this
.radGrdDocuments.Rows[e.CellElement.RowIndex].Cells[e.CellElement.ColumnIndex];
radGrdDocuments.CellFormatting -=
new
CellFormattingEventHandler(
this
.radGrdDocuments_CellFormatting);
sizeCell.Value = ConvertSizeToString(Convert.ToInt32(radGrdDocuments.Rows[e.CellElement.RowIndex].Cells[
"colActualSize"
].Value));
radGrdDocuments.CellFormatting +=
new
CellFormattingEventHandler(
this
.radGrdDocuments_CellFormatting);
}
}
if
(e.CellElement.ColumnIndex == 2)
{
GridViewCellInfo imageCell =
this
.radGrdDocuments.Rows[e.CellElement.RowIndex].Cells[e.CellElement.ColumnIndex];
radGrdDocuments.CellFormatting -=
new
CellFormattingEventHandler(
this
.radGrdDocuments_CellFormatting);
imageCell.Value = imgListPicto.Images[radGrdDocuments.Rows[e.CellElement.RowIndex].Cells[
"colIconType"
].Value.ToString()];
radGrdDocuments.CellFormatting +=
new
CellFormattingEventHandler(
this
.radGrdDocuments_CellFormatting);
}
}
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