Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > OOP
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #12  
Antiguo 18-04-2008
Avatar de enecumene
[enecumene] enecumene is offline
Miembro de Oro
 
Registrado: may 2006
Ubicación: Santo Domingo, Rep. Dom.
Posts: 3.040
Poder: 24
enecumene Va por buen camino
¿y ahora cómo queda amigo Román siguiendo tus consejos?:

Código Delphi [-]
unit DBGrilla1;

interface

uses
  SysUtils, Classes, Controls, Grids, DBGrids, Messages, SHELLAPI, windows;

type
  TDBGrilla = class(TDBGrid)
  private
    FValorVertical: Boolean;
    FValorHorizontal: Boolean;
    FScrollAutomatico: Boolean;

    procedure WMNCCalcSize(var msg: TMessage); message WM_NCCALCSIZE;
  protected
      procedure setAutomaticScroll(Value: Boolean);
      procedure setVerticalScrollBar(Value: Boolean);
      procedure setHorizontalScrollBar(Value: Boolean);
  public
    { Public declarations }
  published
    property VerticalScrollBar: Boolean read FValorVertical write setVerticalScrollBar;
    property HorizontalScrollBar: Boolean read FValorHorizontal write setHorizontalScrollBar;
    property AutomaticScroll: Boolean read FScrollAutomatico write setAutomaticScroll;
  end;

procedure Register;

implementation

procedure TDBGrilla.setAutomaticScroll(Value: Boolean);
begin
  if Value <> FScrollAutomatico then
  begin
    FScrollAutomatico := Value;
  end;
end;

procedure TDBGrilla.setVerticalScrollBar(Value: Boolean);
begin
  if Value <> FValorVertical then
  begin
    FValorVertical := Value;
  end;
end;

procedure TDBGrilla.setHorizontalScrollBar(Value: Boolean);
begin
  if Value <> FValorHorizontal then
  begin
    FValorHorizontal := Value;
  end;
end;

procedure TDBGrilla.WMNCCalcSize(var msg: TMessage);
var
  style: Integer;
begin
if VerticalScrollBar then
  begin
  style := getWindowLong( handle, GWL_STYLE );

  if (style and WS_HSCROLL) <> 0 then
    SetWindowLong( handle, GWL_STYLE, style and not WS_HSCROLL );
  if (style and WS_VSCROLL) <> 0 then
    SetWindowLong( handle, GWL_STYLE, style and not WS_VSCROLL );
  end;
if HorizontalScrollBar then
  begin
  style := getWindowLong( handle, GWL_STYLE );

  if (style and WS_VSCROLL) <> 0 then
    SetWindowLong( handle, GWL_STYLE, style and not WS_VSCROLL );
  if (style and WS_HSCROLL) <> 0 then
    SetWindowLong( handle, GWL_STYLE, style and not WS_HSCROLL );
  end;
if AutomaticScroll then
  begin
    if Assigned(DataSource) and Assigned(DataSource.DataSet) then
    begin
      Style := GetWindowLong(Handle, GWL_STYLE);

      if DataSource.DataSet.RecordCount > VisibleRowCount then
       Style := Style or WS_VSCROLL
      else
       Style := Style and not WS_VSCROLL;

      SetWindowLong(Handle, GWL_STYLE, Style);
  end;
end;
  inherited;
end;

procedure Register;
begin
  RegisterComponents('Data Controls', [TDBGrilla]);
end;

end.

Saludos.
__________________

Mi BLOG - ¡Joder, leanse la guia de estilo!
Las Palabras son enanas, los ejemplos gigantes.

Última edición por enecumene fecha: 18-04-2008 a las 21:35:43.
Responder Con Cita
 


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

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
Scrollbar Vertical desaparece del DBGRID jmlifi OOP 4 27-04-2007 20:54:43
¿Como Eliminar de la Bd el item seleccionado en un DbGrid? day_eli Conexión con bases de datos 1 09-02-2007 16:36:33
eliminar scrollbar en DBGRID cocke C++ Builder 2 25-11-2006 05:01:51
Scrollbar vertical en Tframe Sayuri Varios 3 07-12-2005 16:48:38
ScrollBar Vertical del DBGRID desaparece le4br OOP 3 21-03-2005 10:09:09


La franja horaria es GMT +2. Ahora son las 12:31:32.


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