Anchor transparent label to ImageBox

Started by shchiu, September 09, 2017, 01:13:24 AM

Previous topic - Next topic


Thank you very much for the implementation of ImageBox!  Been finding it very useful!  I do have a question on how best to add a floating label (e.g. to the lower left corner) within the ImageBox such that it is anchored to its border even when zooming and scrolling?  I can do it by anchoring to the panel but I would much prefer to use the loaded image as the BackColor instead of color of my panel.  I am currently using v1.2.1.  Thank you in advance for your help!

Richard Moss


Welcome to the forums and thanks for the question. The functionality you're looking for is already built into ImageBox without needing to use actual Label controls. Have you tried this or does it not fill your needs? As well as the standard Text, Font and ForeColor properties, the following custom properties are available

  • TextAlign: The text position
  • TextBackColor: The background color (you can set this to Color.Transparent)
  • TextPadding: Offsets
  • ScaleText: If set to true, the text size scales with the zoom, or leave at false to stay at the fixed font size
  • TextDisplayMode: Specifies if the text is anchored to the control or the client image (or not shown at all)

See the Text Demonstration window in the demo application for an example.

Hope this helps, let me know if otherwise.

Richard Moss

Edit: Updated as I forgot to mention TextDisplayMode.
Read "Before You Post" before posting. Do not send me private messages. Do not expect instant replies.

All responses are hand crafted. No AI involved. Possibly no I either.


This is great!  Exactly what I need!  Thank you so much, Richard!