我用imageenview控件打开图片,然后我想在这个图片上画直线,但是我画出来的直线是虚线。我想要的是直线。请问怎么解决,我的代码是:
procedure tform1.imgenviewmousemove(sender:Tobject;shift:Tshiftstate;x,y:integer);
begin
imgenview.iebitmap.canvas.pen.style := pssolid;
imgenview.iebitmap.canvas.pen.mode:= pmnotxor;
imgenview.iebitmap.canvas.pen.color:= clred;
imgenview.iebitmap.canvas.pen.width :=1;
imgenview.iebitmap.canvas.pen.moveto(imgenview.xscr2bmp(fstartx),imgenview.xscr2bmp(fstarty));
imgenview.iebitmap.canvas.pen.lineto(imgenview.xscr2bmp(flastx),imgenview.xscr2bmp(flasty));
Flastx := x;
Flasty :=y;
imgenview.iebitmap.canvas.pen.moveto(imgenview.xscr2bmp(fstartx),imgenview.xscr2bmp(fstarty));
imgenview.iebitmap.canvas.pen.lineto(imgenview.xscr2bmp(flastx),imgenview.xscr2bmp(flasty));
imgenview.update;
end;
这个就是那个控件名称
imgenview:TImgeenview;
你的意思是不是实线吧,imgenview.iebitmap.canvas.pen.mode:= pmnotxor; 这句话改一下,就ok 了。你那个异或了,当然看起来一段一段的了。
各种模式如下
pmBlackAlways black
pmWhiteAlways white
pmNopUnchanged
pmNotInverse of canvas background color
pmCopyPen color specified in Color property
pmNotCopyInverse of pen color
pmMergePenNotCombination of pen color and inverse of canvas background
pmMaskPenNotCombination of colors common to both pen and inverse of canvas background.
pmMergeNotPenCombination of canvas background color and inverse of pen color
pmMaskNotPenCombination of colors common to both canvas background and inverse of pen
pmMergeCombination of pen color and canvas background color
pmNotMergeInverse of pmMerge: combination of pen color and canvas background color
pmMaskCombination of colors common to both pen and canvas background
pmNotMaskInverse of pmMask: combination of colors common to both pen and canvas background
pmXorCombination of colors in either pen or canvas background, but not both
pmNotXorInverse of pmXor: combination of colors in either pen or canvas background, but not both
不好意思啊。。。那会解决了问题,后来一直没上这个博客了。。。谢谢你啊。。