Files
mql5-skills/skills/mql5/references/docs/34-standardlibrary/2148-standardlibrary-chart-object-classes-cchartobject-cchartobjectwidth.md
T

54 lines
947 B
Markdown
Raw Normal View History

2026-06-23 21:47:51 +08:00
# Width (Get Method)
Gets the line width of the graphical object.
```
int  Width() const
```
Return Value
The line width of the graphical object attached to an instance of the class. If there is no attached object, it returns -1.
# Width (Set Method)
Sets the line width of the graphical object.
```
bool  Width(
   int  new_width      // thickness
   )
```
Parameters
new_width
[in]  New value of the graphical object line width.
Return Value
true - success, false - cannot change the width.
Example:
```
//--- example for CChartObject::Width  
#include <ChartObjects\ChartObject.mqh>  
//---  
void OnStart()  
  {  
   CChartObject object;  
   //--- get width of chart object   
   int width=object.Width();  
   if(width!=1)  
     {  
      //--- set width of chart object  
      object.Width(1);  
     }  
  }  
```