Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Otros entornos y lenguajes > C++ Builder
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

 
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 05-08-2014
Avatar de aguml
aguml aguml is offline
Miembro
 
Registrado: may 2013
Posts: 885
Poder: 11
aguml Va por buen camino
¿Margen en celdas de TStringGrid?

Buenas amigos, sigo mejorando el juego de las tablas y ahora le he añadido un ranking y todo va correcto pero me gustaria crear un pequeño margen para que cuando alineo a la derecha los numeros no llegue justo al filo sino que quede un poquitin de espacio a la derecha.
Esto tengo hecho:
Código:
void __fastcall TFormRanking::StringGridRankingDrawCell(TObject *Sender,
      int ACol, int ARow, TRect &Rect, TGridDrawState State)
{
        char *cadena;
        cadena = StringGridRanking->Cells[ACol][ARow].c_str();

        if (State.Contains(gdFixed))
        {
                StringGridRanking->Canvas->Brush->Color = clBtnFace;
                StringGridRanking->Canvas->Font->Color = clWindowText;
                StringGridRanking->Canvas->FillRect(Rect);

                HDC dc = StringGridRanking->Canvas->Handle;
                DrawText(dc, cadena, strlen(cadena), &Rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
        }
        else if(State.Contains(gdSelected)) //if is selected use the clAqua color
        {
                StringGridRanking->Canvas->Brush->Color = clWindow;
                StringGridRanking->Canvas->Font->Color = clWindowText;
                StringGridRanking->Canvas->FillRect(Rect);

                HDC dc = StringGridRanking->Canvas->Handle;
                if(ACol == 1)
                        DrawText(dc, cadena, strlen(cadena), &Rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
                else
                        DrawText(dc, cadena, strlen(cadena), &Rect, DT_RIGHT | DT_VCENTER | DT_SINGLELINE );
        }
        else if (ARow %2 == 0)
        {
                StringGridRanking->Canvas->Brush->Color = clSilver;
                StringGridRanking->Canvas->Font->Color = clWindowText;
                StringGridRanking->Canvas->FillRect(Rect);

                HDC dc = StringGridRanking->Canvas->Handle;
                if(ACol == 1)
                        DrawText(dc, cadena, strlen(cadena), &Rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
                else
                        DrawText(dc, cadena, strlen(cadena), &Rect, DT_RIGHT | DT_VCENTER | DT_SINGLELINE );
        }
        else
        {
                StringGridRanking->Canvas->Brush->Color = StringGridRanking->Color;
                StringGridRanking->Canvas->Font->Color = StringGridRanking->Font->Color;
                StringGridRanking->Canvas->FillRect(Rect);

                HDC dc = StringGridRanking->Canvas->Handle;
                if(ACol == 1)
                        DrawText(dc, cadena, strlen(cadena), &Rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
                else
                        DrawText(dc, cadena, strlen(cadena), &Rect, DT_RIGHT | DT_VCENTER | DT_SINGLELINE );
        }
}
¿Como puedo hacer eso?
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Cambiar color por defecto al seleccionar varias celdas de un TStringGrid JAI_ME Varios 1 05-08-2012 18:58:19
Centrar celdas en un TSTringGrid gluglu Varios 3 23-01-2005 13:41:44
colorear las celdas de un TstringGrid mangel OOP 2 16-12-2003 17:22:47
Celdas de colores diferentes en un TStringGrid phyera Gráficos 2 14-09-2003 19:06:26
Justificar Texto en las celdas del TStringGrid Anabel Varios 3 19-05-2003 18:20:47


La franja horaria es GMT +2. Ahora son las 09:54:15.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi