麻烦你看看了。 if Item.SubItems[3]<>'' then begin g := TBitmap.Create; //g.LoadFromFile(ExtractFilePath(ParamStr(0))+'\pics\tick.bmp'); ImageList1.GetBitmap(0,g); //LV.Canvas.Brush.Color :=clWhite; //LV.Canvas.Font.Name :='MS Sans Serif'; //LV.Canvas.TextOut(item.Left,item.Top,item.Caption); LV.Canvas.Draw(333,item.Top,g); end; 假如加上LVPostNetsList.Canvas.Font := LVPostNetsList.Font;就会有运行期错误。
以上是onCustemDrawSubItem里面的。onDrawItem里面没有东西。
if Item.SubItems[3]<>'' then begin g := TBitmap.Create; //g.LoadFromFile(ExtractFilePath(ParamStr(0))+'\pics\tick.bmp'); ImageList1.GetBitmap(0,g); LV.Canvas.Brush.Color :=clWhite; LV.Canvas.Font.Name :='MS Sans Serif'; LV.Canvas.TextOut(item.Left,item.Top,item.Caption); LV.canvas.font.style:=[];//加上这句试试 LV.Canvas.Draw(333,item.Top,g); end;
LV.canvas.font.style:=[];//放在这儿试试 if Item.SubItems[3]<>'' then begin g := TBitmap.Create; //g.LoadFromFile(ExtractFilePath(ParamStr(0))+'\pics\tick.bmp'); ImageList1.GetBitmap(0,g); LV.Canvas.Brush.Color :=clWhite; LV.Canvas.Font.Name :='MS Sans Serif'; LV.Canvas.TextOut(item.Left,item.Top,item.Caption); LV.Canvas.Draw(333,item.Top,g); end;
或 if Item.SubItems[3]<>'' then begin g := TBitmap.Create; //g.LoadFromFile(ExtractFilePath(ParamStr(0))+'\pics\tick.bmp'); ImageList1.GetBitmap(0,g); LV.Canvas.Brush.Color :=clWhite; LV.Canvas.Font.Name :='MS Sans Serif'; LV.canvas.font.style:=[];//放在这儿试试 LV.Canvas.TextOut(item.Left,item.Top,item.Caption); LV.Canvas.Draw(333,item.Top,g); end else LV.canvas.font.style:=[];//放在这儿试试
在你看看你的listview1.font.style是不是空的?
if Item.SubItems[3]<>'' then
begin
g := TBitmap.Create;
//g.LoadFromFile(ExtractFilePath(ParamStr(0))+'\pics\tick.bmp');
ImageList1.GetBitmap(0,g);
//LV.Canvas.Brush.Color :=clWhite;
//LV.Canvas.Font.Name :='MS Sans Serif';
//LV.Canvas.TextOut(item.Left,item.Top,item.Caption);
LV.Canvas.Draw(333,item.Top,g);
end;
假如加上LVPostNetsList.Canvas.Font := LVPostNetsList.Font;就会有运行期错误。
if Item.SubItems[3]<>'' then
begin
g := TBitmap.Create;
//g.LoadFromFile(ExtractFilePath(ParamStr(0))+'\pics\tick.bmp');
ImageList1.GetBitmap(0,g);
LV.Canvas.Brush.Color :=clWhite;
LV.Canvas.Font.Name :='MS Sans Serif';
LV.Canvas.TextOut(item.Left,item.Top,item.Caption);
LV.canvas.font.style:=[];//加上这句试试
LV.Canvas.Draw(333,item.Top,g);
end;
LV.canvas.font.style:=[];//放在这儿试试
if Item.SubItems[3]<>'' then
begin
g := TBitmap.Create;
//g.LoadFromFile(ExtractFilePath(ParamStr(0))+'\pics\tick.bmp');
ImageList1.GetBitmap(0,g);
LV.Canvas.Brush.Color :=clWhite;
LV.Canvas.Font.Name :='MS Sans Serif';
LV.Canvas.TextOut(item.Left,item.Top,item.Caption);
LV.Canvas.Draw(333,item.Top,g);
end;
begin
g := TBitmap.Create;
//g.LoadFromFile(ExtractFilePath(ParamStr(0))+'\pics\tick.bmp');
ImageList1.GetBitmap(0,g);
LV.Canvas.Brush.Color :=clWhite;
LV.Canvas.Font.Name :='MS Sans Serif';
LV.canvas.font.style:=[];//放在这儿试试
LV.Canvas.TextOut(item.Left,item.Top,item.Caption);
LV.Canvas.Draw(333,item.Top,g);
end else LV.canvas.font.style:=[];//放在这儿试试