发信人: teleme(PassWord) 
整理人: teleme(2001-02-11 10:38:14), 站内信件
 | 
 
 
发信人: yueqs()
 : 请问能否将dbgrid首列固定(即当form不够显示grid时,移动滚动条,首列保持不动? 
 gbgrid继承自TCustomGrid ,而TCustomGrid 是有fixedcols的,只是 
 dbgrid没有打开而已,核心的设置程序如下:其他内容自己添吧 
 在dbgrid的源码中加入: 
 procedure TDBGrid.SetFixedCols(Value: Integer); 
 var 
   FixCount, I: Integer; 
 begin 
   FixCount := Max(Value, 0) + IndicatorOffset; 
   if DataLink.Active and not (csLoading in ComponentState) and 
     (ColCount > IndicatorOffset + 1) then 
   begin 
     FixCount := Min(FixCount, ColCount - 1); 
     inherited FixedCols := FixCount; 
     for I := 1 to Min(FixedCols, ColCount - 1) do 
       TabStops[I] := False; 
   end; 
   FFixedCols := FixCount - IndicatorOffset; 
 end; 
 [原文 转载 北京社区] 
  | 
 
 
 |