Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   Pasar Mouse sobre una columna(x) del TStringGrid y cambiar el cursor (https://www.clubdelphi.com/foros/showthread.php?t=82201)

Cristhor1982 07-02-2013 13:53:59

Pasar Mouse sobre una columna(x) del TStringGrid y cambiar el cursor
 
Hola amigos, les cuento tengo una grilla con 4 columnas, al momento de pasar sobre la columna 3, necesito que el mouse cambio de forma el cursor, la unica forma que logro hacerlo es, al hacer click....una ayuda please


Saludos

Caro 07-02-2013 14:29:59

Hola Cristhor1982, debes utilizar el evento OnMouseMove.

Código Delphi [-]
procedure TForm1.StringGrid1MouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
var
  Col, Row: Integer;
begin
  StringGrid1.MouseToCell(X, Y, Col, Row);
  if Col=2 then
   //cambiamos el cursor
   .................................

Saluditos

marcial 07-02-2013 14:38:24

Hola Christor1892

Creo que este ejemplo, que aunque es de un DBGrid te puede servir: (Lo colocas en el OnMouseMove)

Código Delphi [-]
procedure TForm1.DBGrid1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
  var   pt: TGridcoord;
begin

  try
  pt:= DBGrid1.MouseCoord(x, y);
  if pt.y=0 then
        begin

        if FileExists(('C:\DIRECTORIOCURSORES\SelectGreen.cur'))  then
           begin
                DBGrid1.Cursor:= 1;
                Screen.Cursors[1] := LoadCursorFromFile('\\SERVIDOR\C\DISCAL\CURSORES\SelectGreen.cur'); {El cursor que te hayas creado}
           end
           else
           DBGrid1.Cursor:=crHandPoint;
        end
  else
        begin
        DBGrid1.Cursor:=crDefault;
        end;
   except
   exit;
   end;
end;

Cristhor1982 07-02-2013 14:43:24

Código Delphi [-]
procedure TFR_MailBodegas.SGMouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
var
Col, Row: Integer;
begin
SG.MouseToCell(X, Y, Col, Row);
      if (row<>0) and (col=3) then
        Screen.Cursor :=crHandPoint
      else
        screen.cursor:=crdefault;
end;

Con este codigo basto!!!...muchas gracias!!...Mousetocell:confused:

Graciiiiiassss!!

Cristhor1982 07-02-2013 14:44:27

Gracias a ambos por sus prontas respuestas...!!!

Saludos..Muchas Gracias

^\||/


La franja horaria es GMT +2. Ahora son las 12:05:17.

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