CListCtrl单元格中的MultiLine文本显示省略号

时间:2015-08-31 14:07:25

标签: c++ mfc clistctrl

我有一个unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls; type TForm1 = class(TForm) Button1: TButton; Edit1: TEdit; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation uses MMSystem; {$R *.dfm} var buf: Array of byte; wh: TWaveHdr; hOut: HWAVEOUT; fmt: TWaveFormatEx; count: integer; function GetWaveFmtData(path: string; var fmt: TWaveFormatEx ): Boolean; var hFile: HMMIO; ckiRIFF,ckiFmt,ckiData: TMMCKInfo; begin Result := False; hFile := mmioOpen(PChar(path), nil, MMIO_READ); if hFile = 0 then Exit; ZeroMemory(@ckiRIFF, SizeOf(TMMCKInfo)); ZeroMemory(@ckiFmt, SizeOf(TMMCKInfo)); ZeroMemory(@ckiData, SizeOf(TMMCKInfo)); ckiRIFF.fccType := mmioStringToFOURCC('WAVE', 0); ckiFmt.ckid := mmioStringToFOURCC('fmt', 0); ckiData.ckid := mmioStringToFOURCC('data', 0); ZeroMemory(@fmt, SizeOf(TWaveFormatEx)); mmioDescend(hFile, @ckiRIFF, nil, MMIO_FINDRIFF); if (ckiRIFF.ckid = FOURCC_RIFF) and (ckiRIFF.fccType = mmioStringToFOURCC('WAVE',0)) and (mmioDescend(hFile, @ckiFmt, @ckiRIFF, MMIO_FINDCHUNK) = MMSYSERR_NOERROR) and (mmioRead(hFile, @fmt, ckiFmt.cksize) = ckiFmt.cksize) and (mmioAscend(hFile, @ckiFmt, 0) = MMSYSERR_NOERROR) and (mmioDescend(hFile, @ckiData, @ckiRIFF, MMIO_FINDCHUNK) = MMSYSERR_NOERROR) then begin SetLength(buf, ckiData.cksize); Result := (mmioRead(hFile, PAnsiChar(buf), ckiData.cksize) = ckiData.cksize); end; mmioClose(hFile, 0); end; Procedure CallBack( hwo :HWAVEOUT; uMsg :UINT ; dwInstance :DWORD; dwParam1 :DWORD; dwParam2 :DWORD );stdcall; begin {Need check the message here but for now lets just make sure that we get called } ShowMessage('WaveOut'); end; procedure TForm1.Button1Click(Sender: TObject); const path = 'fire.wav'; begin GetWaveFmtData(path, fmt); wh.lpData := PAnsiChar(buf); wh.dwBufferLength := Length(buf); wh.dwBytesRecorded := 0; wh.dwUser := 0; wh.dwFlags := 0; wh.dwLoops := 1; wh.lpNext := nil; wh.reserved := 0; //waveOutClose(hOut); if waveOutOpen(@hOut, WAVE_MAPPER, @fmt, DWORD(@CallBack), Handle,WAVE_MAPPED and CALLBACK_FUNCTION) = MMSYSERR_NOERROR then begin count:=count+1; Edit1.Text:=IntToStr(count); end; waveOutPrepareHeader(hOut, @wh, SizeOf(TWaveHdr)); waveOutWrite(hOut, @wh, SizeOf(TWaveHdr)); end; end. ,有一个CListCtrl,即有行和列。我希望在网格单元格中显示Grid layout文本,但它们会被截断并且不会完整显示,即它们会以省略号显示。

我已将单元格的限制设置为32.如果要插入的multiline文本超过一半,我会在中途插入换行符和回车符CString。< / p>

不幸的是,这导致两行的截断CString

如何确保顶部的字符串不会被截断并从第二行正确继续,如果超过32,它可能会被...截断?

0 个答案:

没有答案