PenWidthToPoints() 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 point size for a given pen width. You can call this function from the MapBasic window in MapInfo Pro.

Syntax

PenWidthToPoints( penwidth )

penwidth is an integer greater than 10 representing the pen width.

Return Value

Float

Description

The PenWidthToPoints() function takes a pen width and returns the point size for that pen. The pen width for a line style may be returned by the StyleAttr() function. The pen width returned by the StyleAttr() function may be in points or pixels. Pen widths of less than ten are in pixels. Any pen width of ten or greater is in points. PenWidthToPoints() only returns values for pen widths that are in points. To determine if pen widths are in pixels or points, use the IsPenWidthPixels() function.

Example

Include "MAPBASIC.DEF"
			Dim CurPen As Pen
			Dim Width As Integer
			Dim PointSize As Float
			CurPen = CurrentPen()
			Width = StyleAttr(CurPen, PEN_WIDTH)
			If Not IsPenWidthPixels(Width) Then
				PointSize = PenWidthToPoints(Width)
			End If

See Also:

CurrentPen() function, IsPenWidthPixels() function, MakePen() function, Pen clause, PointsToPenWidth() function, StyleAttr() function