Bitmaps on buttons

This forum is for eXpress++ general support.
Message
Author
c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Bitmaps on buttons

#1 Post by c-tec »

Hello,
because of the bad results of scaling down bitmaps I need the info whats the optimal size for a bitmap of a button. If the imge is 30x30 pixel how are the optimal dimensions for a button that the bitmap is not scaled down if the button is too small.
regards
Rudolf
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Bitmaps on buttons

#2 Post by rdonnay »

This is a confusing question.
Can you be a little more clear about what you are asking?
The eXpress train is coming - and it has more cars.

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: Bitmaps on buttons

#3 Post by c-tec »

Hello Roger,
I am trying to make buttons from svg files with transparent background, the result that is displayed in xBase++ is not akzeptable, I am looking for a way to make it more sharp.
regards
Rudolf
Attachments
roger.jpg
roger.jpg (87.02 KiB) Viewed 12564 times
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Bitmaps on buttons

#4 Post by rdonnay »

You may want to consider a 2-step solution for this.

If all of your bitmaps are similar to the one you are showing here, then you will get better results if you use a bitmap for the background (the blue area) and a character font for the white area. Bobby Drakos created his own set of custom fonts for his application and they scale very nicely.
The eXpress train is coming - and it has more cars.

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: Bitmaps on buttons

#5 Post by c-tec »

Hello Roger,
thank you, I am also just working on a solution with a font. It looks perfect, is scalable and I can change the color. IcoMonn is a good resource to make a font with symbols in a webinterface. The only problem is that it is more complicated to do updates of my software. Installing a font needs a reboot so far as I know. Is it possible to include font in res files ?
Would be fine to make a place here for sharing fonts.
regards
Rudolf
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Bitmaps on buttons

#6 Post by rdonnay »

Installing a font doesn't require a reboot if you use the Windows API correctly.
They will be installed temporarily when the app starts.

Here's how I do it in one of the apps I support:

Code: Select all

   DllCall("GDI32.DLL", DLL_STDCALL, "AddFontResourceA", '.\Fonts\ZapfDingbats.ttf' )
   DllCall("GDI32.DLL", DLL_STDCALL, "AddFontResourceA", '.\Fonts\IDAutomationHC39M_FREE.otf' )
   DllCall("GDI32.DLL", DLL_STDCALL, "AddFontResourceA", '.\Fonts\FRE3OF9X.TTF' )
   DllCall("GDI32.DLL", DLL_STDCALL, "AddFontResourceA", '.\Fonts\Symbol.ttf' )
   DllCall("GDI32.DLL", DLL_STDCALL, "AddFontResourceA", '.\Fonts\Consola.ttf' )
The eXpress train is coming - and it has more cars.

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: Bitmaps on buttons

#7 Post by c-tec »

Hello Roger,
So if you change something in the font and you call this dll function you have available the new font ? I have included it in my testprogram, but changes in the font are not visible after calling the function. All tips in the internet are leading to a new start of Windows that a new font is registered after changing something. Found some tools that are able to make a font emmidatly availabel, but no idea how they do this inside my program or via a dll function like yours.
If someone is interrested:
www.formcommander.net/download/formcommander.ttf
is the font I made with iconmoon, in few minutes, you can alos add your own images, and support is perfect, I got a answer in only a few minutes.

regards
Rudolf
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Bitmaps on buttons

#8 Post by rdonnay »

Ok, I didn't realize that you were making changes to the font.

I guess that would be necessary, as you said.

You can always store away the date and time of the last loaded font file and then check that against the .TTF.
If the .TTF is newer, you can give the user a message:

"A Font used by this program has been changed.
To properly display information, a Windows reboot is required."
The eXpress train is coming - and it has more cars.

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: Bitmaps on buttons

#9 Post by c-tec »

Hello Roger,
thank you, all works fine now. Have solved several problems with special fonts.
Now I create a button with a symbol as caption and then I add a label:

Code: Select all

@ nTop,nBPosx   DCPUSHBUTTONXP  CAPTION chr(75) FONT "15.formcommanderB" ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}  PIXEL OBJECT aoButton[6]  CONFIG BUCFG1 SIZE nBsizex+1,nBSizeY  
@ 36,42 dcsay "Exit" saysize 0 font "10.Arial" COLOR GRA_CLR_WHITE,XBPSYSCLR_TRANSPARENT PIXEL PARENT aoButton[6]
I would like to display the say text with another font on the bottom middle of the button. How can I retrieve this information in a simple way ? Would be great to have a simple command for displaying a symbol caption and with another font the label at the bottom or left of the symbol. I think also resizing brings a better result than with bitmaps.
regards
Rudolf
Attachments
Zwischenablage01.jpg
Zwischenablage01.jpg (16.05 KiB) Viewed 12515 times
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: Bitmaps on buttons

#10 Post by c-tec »

Hello Roger,
have seen that captionarray does the job. The only wish I have, is that when I position the symbol caption letter with XBPALIGN_TOP that there is a little space between the top and the letter, like a top offset. Or that when I define only the start row of the caption and use XBPALIGN_HCENTER , that the caption is centered in the defined row like in my sample. This is not a big problem, but would help a lot when using symbol fonts for caption images. Then I could make one command for such a button.
regards
Rudolf

Code: Select all

aCaptions := { ;
  { CHR(49)     , GRA_CLR_WHITE,  30, , , ,XBPALIGN_HCENTER ,'24.formcommanderA',,}, ;
  { 'Testbutton', GRA_CLR_RED,    , , , ,XBPALIGN_BOTTOM + XBPALIGN_HCENTER ,'10.Arial Bold',,}}

@  100, 1 dcpushbuttonxp SIZE 80,80  CAPTIONARRAY aCaptions PIXEL CONFIG oConfig COLOR GRA_CLR_WHITE,GRA_CLR_DARKBLUE
Attachments
roger.jpg
roger.jpg (2.65 KiB) Viewed 12498 times
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

Post Reply