现想实现 当把鼠标放在dbgrid控件得标题栏时,鼠标形状变成一个小手。
其他环境下不变。翻阅过资料,是不是得调用消息,句柄 啊。
菜鸟不会,还请指教

解决方案 »

  1.   


    我的理解:
    mouseover事件
    光标改变
      

  2.   

    前两种方法我都是试过了。
    都只是对dbgrid控件来实现。
    这是个历史遗留问题啊。我查过csdn有过这方面得帖子,但都没有解决。
    请楼主关注!!
      

  3.   

    有个不用消息的办法,
    在OnMouseMove里判断如当前坐标在纵坐标在DBGrid1.ClientRect.Top和DBGrid1.ClientRect.Bottom之间Cursor为缺省值,否则Cursor:=crHandPointdbgrid的标题的高度(DBGrid1.ClientRect.Bottom-DBGrid1.ClientRect.Top)
      

  4.   

    能不能用一个panel之类的把title盖住,大小,颜色,caption都和title一致
      

  5.   

    inforum(坛中人,来捧个场!) 的应该可行!
      

  6.   

    procedure TForm1.DBGrid1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    begin
      if (x >=DBGrid1.ClientRect.Top) and (x<= DBGrid1.ClientRect.Bottom) then
        cursor := crHandPoint
      else
        cursor := crDefault;end;
    我试了,有一点点误差
      

  7.   

    大概思路是对得。
    但是DBGrid1.ClientRect.Top 和DBGrid1.ClientRect.Bottom 两者差值不是标题栏得宽度?
    鼠标得变化还在整个query件上
      

  8.   

    Sorry,标题栏的高度应是:
    DBGrid1.Height-(DBGrid1.ClientRect.Bottom-DBGrid1.ClientRect.Top)
      

  9.   

    问题倒是解决了,但是我使用了一种土办法,给标题y轴定制了高度。procedure TFrm_Interface.DBG_UserMouseMove(Sender: TObject;
      Shift: TShiftState; X, Y: Integer);
    begin  if (x >=DBG_User.ClientRect.Top) and (x <= DBG_User.ClientRect.Bottom) and (y >=DBG_User.ClientRect.Top) and (y<= 20)then
        dbg_user.cursor := crHandPoint
      else
        dbg_user.cursor := crDefault;
    end;
      

  10.   

    procedure TFrm_Interface.DBG_InterMouseMove(Sender: TObject;
      Shift: TShiftState; X, Y: Integer);
    var
      y_winth:integer;
    begin
      y_winth:=DBG_inter.Height-(DBG_inter.ClientRect.Bottom-DBG_inter.ClientRect.Top);//标题栏得高度
      if (x >=DBG_inter.ClientRect.Top) and (x <= DBG_inter.ClientRect.Bottom) and (y >=DBG_inter.ClientRect.Top) and (y<= y_winth)then
        dbg_inter.cursor := crHandPoint
      else
        dbg_inter.cursor := crDefault;
    end;
    inforum(坛中人,来捧个场!) 可以接分了