procedure TMainForm.lbxMainDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); function GetText(const Text:String):String; const iWidth = 32 + 10 + 5; //图标宽32 + 间隔10 + 右边保留5 (单位:象素) var tmpStr:String; iIndex,i,tmpWidth:Integer; begin Result:=Text; tmpWidth:=lbxMain.Canvas.TextWidth(Text); if Rect.Left + iWidth + tmpWidth > Rect.Right - Rect.Left then begin tmpWidth:=Rect.Right-Rect.Left; tmpStr:=''; for iIndex:=1 to Length(Text) do begin tmpStr:=tmpStr+Text[iIndex]; if tmpWidth<=lbxMain.Canvas.TextWidth(tmpStr) + iWidth then begin for i:=1 to 3 do begin Result:=Copy(tmpStr,1,iIndex-i)+'...'; if tmpWidth>lbxMain.Canvas.TextWidth(Result) + iWidth then Break; end; Break; end; end; end; end; var strTemp: string; begin