var HeaderSection: THeaderSection; I: Integer; begin for I := 0 to 4 do begin HeaderSection := HeaderControl1.Sections.Add; HeaderSection.Text := ''''Text Section '''' + IntToStr(I); HeaderSection.MinWidth := length(HeaderSection.Text) * Font.Size; // Owner draw every other section if (I mod 2 = 0) then HeaderSection.Style := hsOwnerDraw else HeaderSection.Style := hsText;
end; end;
procedure TForm1.HeaderControl1DrawSection(HeaderControl: THeaderControl; Section: THeaderSection; const Rect: TRect; Pressed: Boolean); begin with HeaderControl.Canvas do begin // highlight pressed sections if Pressed then Font.Color := clRed else Font.Color := clBlue; TextOut(Rect.Left + Font.Size, Rect.Top + 2, ''''Owner Drawn text''''); end; end; ## HeaderSection, OnDrawSection, Sections, Canvas, TextOut example ---------------------------------------------------------- Trunc Example ----------------------------------------------------------- procedure TForm1.Button1Click(Sender: TObject); var S, T: string; begin Str(1.4:2:1, T); S := T + '''' Truncs to '''' + IntToStr(Trunc(1.4)) + #13#10; Str(1.5:2:1, T); S := S + T + '''' Truncs to '''' + IntToStr(Trunc(1.5)) + #13#10; Str(-1.4:2:1, T); S := S + T + '''' Truncs to '''' + IntToStr(Trunc(-1.4)) + #13#10; Str(-1.5:2:1, T); S := S + T + '''' Truncs to '''' + IntToStr(Trunc(-1.5)); MessageDlg(S, mtInformation, [mbOk], 0); end;
未归类 -------------------- WrapText -------------------- SysUtils type TSysCharSet = set of Char var S, R: string; begin S:= ''''123456_123456_123456''''; R:= WrapText( S, #13#10, [''''1'''', ''''4''''], 4); MessageDlg( R, mtInformation, [mbOk], 0); end; ================================ WideCharToStrVar(Source: PWideChar;var Dest: string ); ------------------------- System -----------------
========================= WideCharToString( Source: PWideChar ): string; ------------------------- System