English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
lineWidth ist Canvas 2D API zur Einstellung der Linienstärke (d.h. der Linienbreite).
Mit einer Breite von 12 Pixel-Linien zum Zeichnen von Rechtecken:
<!DOCTYPE html> <html> <head> <title>Verwendung der HTML canvas lineWidth-Eigenschaft (Grund教程网 oldtoolbag.com)</title> </head> <body> <canvas id="myCanvas" width="300" Höhe="150" style="Rahmen:1px fest #d3d3d3"> Ihr Browser unterstützt HTML nicht5 canvas-Tag. </canvas> <script> var c=document.getElementById("myCanvas"); var ctx=c.getContext("2d"); ctx.lineWidth=12; ctx.strokeRect(20,20,80,100); </script> </body> </html>Test it out ‹/›
IEFirefoxOperaChromeSafari
Internet Explorer 9Firefox, Opera, Chrome, and Safari support the lineWidth property.
Note:Internet Explorer 8 Previous versions do not support the <canvas> element.
The lineWidth property sets or returns the current line width in pixels.
Default Value: | 1 |
---|---|
JavaScript Syntax: | context.lineWidth=number; |
Value | Description |
---|---|
number | Current line width, in pixels. |