No announcement yet.

Why this feature?

  • Filter
  • Time
  • Show
Clear All
new posts

    Why this feature?

    With an Image control, using %ss_centerimage, the border of a small image is set to the color of the pixel at 0,0 within the image.

    Does anyone know why that choice was made? I'd guess it's a Windows thing, and that it dates from 256 color images where a selection from the image palette was the best choice. But I don't know for sure.

    Is there a benefit to having it work that way today? Since I usually don't know what the top/left pixel color will be, I get a more or less random border for images that are smaller than the image control.

    I'd personally prefer to have the border be the foreground color. Is there an easy way to do that? Anything that lets me control the border color would be better than letting the image decide for me.


    SS_CENTERIMAGE Specifies that, if the bitmap or icon is smaller than the client area of the static control, the rest of the client area is filled with the color of the pixel in the top left corner of the bitmap or icon. If the static control contains a single line of text, the text is centered vertically in the client area of the control.
    But, as I am fond of pointing out, the IMAGE and IMAGEX controls are PowerBASIC-proprietary controls, so the behavior is defined solely by PowerBASIC, Inc.
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]


      Well, it's good to know that the control is proprietary. It prevents me from assuming too much about it's behavior.

      I was reading Help (as I do, front-to-back), and noted that the Image control topic talks about a smaller image not filling out the content of a bigger Image control.

      So I made a big control and put in a smaller image - but added the %ws_border style. The border size matches the smaller image, not the bigger control.

      Based on what I read in Help, my first guess was that the border would be the size of the bigger control dimensions, not the size of the smaller image.

      For that matter, the %ws_border wasn't on the Help list of style options. I guess the list in Help isn't an exclusive list.

      So I'm guessing the image control actually resizes to match the image size. To test that thought, I put another control in the place where the bigger control "should" have been, but the new control was not hidden. So either the bigger control was transparent, or the control shrank. I changed the creation order to see if there was a z-order effect, but got the same answer.

      On most topics where I have questions, I don't usually care what the answer is, I just don't want to have to do trial-and-error to learn something already known. There are plenty of real unknowns to spend my time on.

      On the other hand, as a software author myself, I know how hard it is to write down "everything" about my software. My users always have questions that I didn't think to document.