| Ver tema anterior :: Ver tema siguiente |
| Autor |
Mensaje |
JesúsGandia Master


Registrado: 17 Jul 2004Mensajes: 403Ubicación: Gandia, Valencia
|
Publicado: Mie 26 Nov, 2008 8:05 pm Asunto: Color (fondo y texto) si está seleccionado fila en TDBGrid |
|
|
Sobran las Explicaciones:
El codigo tiene que ir en el evento DrawColumCell de cualquier Rejilla de Datos. Se pueden hacer infinitas combinaciones de Colores.
| Código: |
void __fastcall TfrmVentas::DBGrid_visorDrawColumnCell(TObject *Sender,
const TRect &Rect, int DataCol, TColumn *Column, TGridDrawState State)
{
TDBGrid *grid = static_cast<TDBGrid>(Sender);
if(State.Contains(gdSelected))
{
grid->Canvas->Brush->Color = clYellow;
grid->Canvas->Font->Color = clBlue;
}
grid->DefaultDrawColumnCell(Rect, DataCol, Column, State);
} |
_________________ Muchos hombres no se equivocan jamás porque no se proponen nada razonable. |
|
| Volver arriba |
|
 |
kabern Cdt

Registrado: 11 Ene 2008Mensajes: 11
|
Publicado: Vie 17 Sep, 2010 4:27 am Asunto: |
|
|
Jesus, asi probe el código:
void __fastcall TForm1::DBGrid1DrawColumnCell(TObject *Sender,
const TRect &Rect, int DataCol, TColumn *Column,
TGridDrawState State)
{
TDBGrid *grid = static_cast<TDBGrid>(Sender);
if(State.Contains(gdSelected))
{
grid->Canvas->Brush->Color = clYellow;
grid->Canvas->Font->Color = clBlue;
}
grid->DefaultDrawColumnCell(Rect, DataCol, Column, State);}
Y marca el siguiente error:
[C++ Error] UADO.cpp(23): E2459 VCL style classes must be constructed using operator new
[C++ Error] UADO.cpp(23): E2034 Cannot convert 'TDBGrid' to 'TDBGrid *' |
|
| Volver arriba |
|
 |
Cesar C. Salazar Gonzalez Master


Registrado: 01 Oct 2002Mensajes: 2155Ubicación: San Cristóbal de Las Casas, Chiapas
|
Publicado: Vie 17 Sep, 2010 7:26 am Asunto: |
|
|
A simple vista falta un "puntero"
TDBGrid *grid = static_cast<TDBGrid>(Sender);
a esto
TDBGrid *grid = static_cast< TDBGrid * >(Sender); _________________

Ultima edición por Cesar C. Salazar Gonzalez el Vie 17 Sep, 2010 4:25 pm, editado 2 veces |
|
| Volver arriba |
|
 |
JesúsGandia Master


Registrado: 17 Jul 2004Mensajes: 403Ubicación: Gandia, Valencia
|
Publicado: Vie 17 Sep, 2010 10:59 am Asunto: |
|
|
Efectivamente faltaba el Puntero.
Cosas de crear codigo con prisas. _________________ Muchos hombres no se equivocan jamás porque no se proponen nada razonable. |
|
| Volver arriba |
|
 |
|