diff --git a/components/rx/Demos/RxDBGrid/RxDBGridDemo.lpi b/components/rx/Demos/RxDBGrid/RxDBGridDemo.lpi index 404184be7..339eccb4b 100644 --- a/components/rx/Demos/RxDBGrid/RxDBGridDemo.lpi +++ b/components/rx/Demos/RxDBGrid/RxDBGridDemo.lpi @@ -52,14 +52,14 @@ - + - + @@ -70,8 +70,8 @@ - - + + @@ -305,7 +305,7 @@ - + @@ -378,9 +378,9 @@ - + - + @@ -396,13 +396,13 @@ - - - + + + - - - + + + @@ -455,10 +455,8 @@ - - + - @@ -467,10 +465,8 @@ - - + - @@ -526,133 +522,139 @@ - - + - + + + + + + + + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - + - + - + - + - + @@ -660,6 +662,11 @@ + + + + + @@ -678,17 +685,25 @@ - + - + - + - - + + + + + + + + + + diff --git a/components/rx/Demos/RxDBGrid/rxdbgridmainunit.lfm b/components/rx/Demos/RxDBGrid/rxdbgridmainunit.lfm index 18393dabc..0529346cd 100644 --- a/components/rx/Demos/RxDBGrid/rxdbgridmainunit.lfm +++ b/components/rx/Demos/RxDBGrid/rxdbgridmainunit.lfm @@ -66,7 +66,7 @@ object RxDBGridMainForm: TRxDBGridMainForm end item Title.Alignment = taCenter - Title.Caption = 'Software (all info)|Name' + Title.Caption = 'Computer software (all info) - Программное обеспечение|Name' Title.Orientation = toHorizontal Width = 136 FieldName = 'NAME' @@ -79,7 +79,7 @@ object RxDBGridMainForm: TRxDBGridMainForm end item Title.Alignment = taCenter - Title.Caption = 'Software (all info)|Cost' + Title.Caption = 'Computer software (all info) - Программное обеспечение|Cost' Title.Orientation = toHorizontal Width = 136 FieldName = 'PRICE' @@ -97,7 +97,7 @@ object RxDBGridMainForm: TRxDBGridMainForm end item Title.Alignment = taCenter - Title.Caption = 'Software (all info)|Date Present' + Title.Caption = 'Computer software (all info) - Программное обеспечение|Date Present' Title.Orientation = toHorizontal Width = 136 FieldName = 'Date_Present' @@ -180,10 +180,10 @@ object RxDBGridMainForm: TRxDBGridMainForm AnchorSideLeft.Control = Button2 AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = Panel1 - Left = 272 + Left = 260 Height = 18 Top = 7 - Width = 40 + Width = 36 BorderSpacing.Around = 6 Caption = 'Mode' ParentColor = False @@ -194,7 +194,7 @@ object RxDBGridMainForm: TRxDBGridMainForm Left = 7 Height = 29 Top = 7 - Width = 87 + Width = 84 Action = actCalcTotal AutoSize = True BorderSpacing.Around = 6 @@ -204,10 +204,10 @@ object RxDBGridMainForm: TRxDBGridMainForm AnchorSideLeft.Control = Button1 AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = Panel1 - Left = 100 + Left = 97 Height = 29 Top = 7 - Width = 166 + Width = 157 Action = actOptimizeColumnsWidthAll AutoSize = True BorderSpacing.Around = 6 @@ -218,10 +218,10 @@ object RxDBGridMainForm: TRxDBGridMainForm AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = CheckBox2 AnchorSideTop.Side = asrBottom - Left = 501 + Left = 489 Height = 22 Top = 35 - Width = 86 + Width = 81 BorderSpacing.Left = 6 Caption = 'Use filter' OnChange = CheckBox1Change @@ -231,7 +231,7 @@ object RxDBGridMainForm: TRxDBGridMainForm AnchorSideLeft.Control = Label1 AnchorSideTop.Control = Label1 AnchorSideTop.Side = asrBottom - Left = 278 + Left = 266 Height = 31 Top = 31 Width = 217 @@ -251,10 +251,10 @@ object RxDBGridMainForm: TRxDBGridMainForm AnchorSideLeft.Control = ComboBox1 AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = Panel1 - Left = 501 + Left = 489 Height = 22 Top = 7 - Width = 138 + Width = 129 BorderSpacing.Around = 6 Caption = 'Auto fill columns' OnChange = CheckBox2Change @@ -264,10 +264,10 @@ object RxDBGridMainForm: TRxDBGridMainForm AnchorSideLeft.Control = CheckBox2 AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = Panel1 - Left = 645 + Left = 624 Height = 22 Top = 7 - Width = 125 + Width = 117 BorderSpacing.Around = 6 Caption = 'Show indicator' Checked = True @@ -280,10 +280,10 @@ object RxDBGridMainForm: TRxDBGridMainForm AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = CheckBox3 AnchorSideTop.Side = asrBottom - Left = 645 + Left = 624 Height = 22 Top = 35 - Width = 123 + Width = 114 BorderSpacing.Around = 6 Caption = 'Show headers' Checked = True diff --git a/components/rx/rxdbgrid.pas b/components/rx/rxdbgrid.pas index c3d0313df..cc5e66b77 100644 --- a/components/rx/rxdbgrid.pas +++ b/components/rx/rxdbgrid.pas @@ -1117,12 +1117,13 @@ end; procedure TRxDBGrid.CalcTitle; var i, j:integer; - H, H1, W, H2:integer; + H, H1, W, H2, W1:integer; rxCol, rxColNext:TRxColumn; rxTit, rxTitleNext:TRxColumnTitle; MLRec1, P:TMLCaptionItem; MLRec2:TMLCaptionItem; tmpCanvas: TCanvas; + S:string; begin { TODO -oalexs : need rewrite code - split to 2 step: 1. make links between column @@ -1206,29 +1207,52 @@ begin end; //Тут расчёт высоты заголовка каждой колонки - надо обработать слитые заголовки -{ for i:=0 to Columns.Count-1 do + H:=1; + for i:=0 to Columns.Count-1 do begin rxCol:=TRxColumn(Columns[i]); + rxTit:=TRxColumnTitle(rxCol.Title); + H1:=0; + //Не забудем про вертикальную ориентацию if Assigned(rxCol) and rxCol.Visible then begin + if rxTit.CaptionLinesCount > H then + H:=rxTit.CaptionLinesCount; for j:=0 to rxTit.CaptionLinesCount-1 do begin MLRec1:=rxTit.CaptionLine(j); + S:=MLRec1.Caption; if not Assigned(MLRec1.Prior) then begin - W:=MLRec1.Width; + W:=rxCol.Width;//MLRec1.Width; P:=MLRec1.Next; while Assigned(P) do begin - Inc(W, P.Width); + Inc(W, P.Col.Width);//P.Width); + P:=P.Next; + end; + W1:=tmpCanvas.TextWidth(MLRec1.Caption)+2; + if W1 > W then + MLRec1.Hegth:= W1 div W + 1 + else + MLRec1.Hegth:=1; + + P:=MLRec1.Next; + while Assigned(P) do + begin + P.Hegth:=MLRec1.Hegth; P:=P.Next; end; end; + H1:=H1 + MLRec1.Hegth; end; end; - end;} - RowHeights[0] := DefaultRowHeight * ({FTitleLines+}H); + if H1 > H then + H:=H1; + end; + + RowHeights[0] := DefaultRowHeight * H; if rdgFilter in OptionsRx then begin @@ -1561,7 +1585,7 @@ begin end else begin - aRect2.Bottom:=aRect2.Top + DefaultRowHeight; + aRect2.Bottom:=aRect2.Top + MLI.Hegth * DefaultRowHeight; end;