Recent

Author Topic: Centering the bitmap in a ToolButton?  (Read 2652 times)

A

  • Guest
Centering the bitmap in a ToolButton?
« on: December 26, 2017, 10:41:14 pm »
Hello,

Is there any way to centre the image in my ToolButton? Unfortunately it automatically anchors NW (Top, left). I can't find the relevant property in the ToolBar, ToolButton or Image List properties.

Thanks in advance.

lainz

  • Hero Member
  • *****
  • Posts: 4738
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Centering the bitmap in a ToolButton?
« Reply #1 on: December 26, 2017, 10:51:56 pm »
Hello,

Is there any way to centre the image in my ToolButton? Unfortunately it automatically anchors NW (Top, left). I can't find the relevant property in the ToolBar, ToolButton or Image List properties.

Thanks in advance.

Seems that there's no property. But if you don't need exactly a TToolBar, you can use a Panel and drop any kind of button and align them as you wish.

A

  • Guest
Re: Centering the bitmap in a ToolButton?
« Reply #2 on: December 26, 2017, 11:28:47 pm »
Thanks for your reply lainz :D

It's hard to beleive that you cannot centre an image in a ToolButton. How are you supposed to format a ToolButton to look professional? If this were true, it would render the ToolBar/ToolButton control useless.
Does anyone anyone else have any input on another way to get a toolbar and it's child buttons looking normal?

(http://i63.tinypic.com/2132qa0.png)

wp

  • Hero Member
  • *****
  • Posts: 13269
Re: Centering the bitmap in a ToolButton?
« Reply #3 on: December 26, 2017, 11:33:42 pm »
Looks perfectly centered to me.

A Toolbutton gets its image from an image list. All images stored in the image list must share the same size, and this size must be specified in the properties Width and Height of the image list.
« Last Edit: December 26, 2017, 11:51:35 pm by wp »

A

  • Guest
Re: Centering the bitmap in a ToolButton?
« Reply #4 on: December 26, 2017, 11:49:04 pm »
Hmmm... bizarre, I restarted the project, deleted the ToolBar and the ImageList and I tried again. It's formatting is fine now. It was likely a result of initially selecting 22*22 bitmaps for the buttons, and then later clearing the ImageList and reselecting 16*16 bitmaps. The ToolButtons maintained the size that was defaulted for the 22*22 bitmaps.

In other words - user error.

Sorry for the inconvenience.

wp

  • Hero Member
  • *****
  • Posts: 13269
Re: Centering the bitmap in a ToolButton?
« Reply #5 on: December 26, 2017, 11:55:52 pm »
No problem.

But next time when you post screenshots or code you should not use external servers, the data will be gone after some time and users reading this post later will not see the attachments any more. Please upload images and code to the forum directly, using "Attachments and other options". Since the forum software does not accept all file formats you may have to zip your files.

A

  • Guest
Re: Centering the bitmap in a ToolButton?
« Reply #6 on: December 27, 2017, 12:00:48 am »
Alright, in the future I will.

 

TinyPortal © 2005-2018