Old 25th August 2016, 16:41   #1
monkeypirate83
Junior Member
 
Join Date: Aug 2016
Posts: 4
Overlay Text on a button with an image

Hi,

I'm trying to overlay text on top of a button which I've applied an image to, but the text on the button gets pushed to the far right of the button instead of the middle.

Any ideas how I can get text to appear in the center of a button which has an image applied to it?

This is what I'm doing to draw an image to a button: (I've tried all manor of things to move the text but nothing)

code:
; Create an image.
GetDlgItem $Button $HWNDPARENT 1
Pop $Button
System::Call `user32::LoadImage(i 0, t "$PLUGINSDIR\button.bmp", i ${IMAGE_BITMAP}, i 0, i 0, i ${LR_CREATEDIBSECTION}|${LR_LOADFROMFILE}) i.s`
pop $Image



Thanks
monkeypirate83 is offline   Reply With Quote
Old 25th August 2016, 19:21   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,811
Posting the button code would be useful :\

Not really sure what you are after and you might have to settle for a image with text as part of the image. Have you looked at the button skin plugin on the wiki?

Perhaps it is possible to call CreateWindowEx directly to create a static control (label) as a child window of the button, I have never tried it but it might work...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 2nd September 2016, 11:52   #3
monkeypirate83
Junior Member
 
Join Date: Aug 2016
Posts: 4
Thanks, I worked around this by creating a userdrawn control over the top of my image and managed to get it looking spot on. Thanks for your help.
monkeypirate83 is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Tags
button, image, nsis, text

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump