CurrentPen() function - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Purpose

Returns the Pen (line) style currently in use and sets the border pen to the same style as the line pen. You can call this function from the MapBasic window in MapInfo Pro.

Syntax

CurrentPen()

Return Value

Pen

Description

The CurrentPen() function returns the current Pen style. MapInfo Pro assigns the current style to any line or polyline objects drawn by the user. If a MapBasic program creates an object through a statement such as the Create Line statement, but the statement does not include a Pen clause, the object uses the current Pen style. If you want to use the current line pen without re-setting the border pen, use the CurrentLinePen() function.

The return value can be assigned to a Pen variable, or may be used as a parameter within a statement that takes a Pen setting as a parameter (such as the Set Map statement).

To extract specific attributes of the Pen style (such as the color), call the StyleAttr() function. For more information about Pen settings, see Pen clause.

Example

Dim p_user_pen As Pen 
p_user_pen = CurrentPen() 

See Also:

MakePen() function, Pen clause, Set Style statement, StyleAttr() function