Numer of the color white for created objects.


My name is Guilherme and I am have created a macro that creates objects, like a line or a Name, with different collors, depending on the background.
See part of it below.

    barra = 12632256
    ret = IpAnCreateObj(GO_OBJ_TEXT)
    ret = IpAnMove(0, MLx, MLy)
    ret = IpAnText("TECMETAL")
    ret = IpAnSet(GO_ATTR_FONTSIZE, 17)
    ret = IpAnSet(GO_ATTR_FONTBOLD, 1)
    ret = IpAnSet(GO_ATTR_TEXTCENTERED, 1)
    ret = IpAnSet(GO_ATTR_TEXTCOLOR , barra)

What I need is to create a white object, but I didnt find the number that represents the white color. The number that I used (12632256) gives me a gray object.
Somebody knows which number gives me a white object?


  • edited February 15

    The correct number for pure white in decimal is 16777215 or FFFFFF in hex. An easier method of specifying color values is to use QColor() and RGB() functions that provide the values to use as shown below that generate the same number for white. These functions are documented in the IPBasic help file for reference.

    barra = RGB(255,255,255)

    barra = QBColor(15)
  • The color is in &HBBGGRR format in hexadecimal notation, so white will be &HFFFFFF

    here is the example

    Sub TestAnnot()
    Dim barra As Long
    'color is in &HBBGGRR format
    barra = &H0000FF'red
    barra = &HFFFFFF'white
    ret = IpAnShow(1)
    ret = IpAnCreateObj(GO_OBJ_TEXT)
    ret = IpAnMove(0, 54, 98)
    ret = IpAnText("MyText")
    ret = IpAnSet(GO_ATTR_TEXTCOLOR, barra)
    End Sub

Sign In or Register to comment.