Recent

Author Topic: How to use fsBold constant in a console application  (Read 963 times)

Roland57

  • Sr. Member
  • ****
  • Posts: 422
    • msegui.net
How to use fsBold constant in a console application
« on: August 23, 2020, 08:57:46 pm »
Hello!

I have a project using BGRABitmapPack4NoGui.

This line refuses to be compiled:
Code: Pascal  [Select][+][-]
  1.   LBitmap.FontStyle := [fsBold];

Quote
Error: Incompatible types: got "Set Of TFontStyle" expected "TFontStyles"

What is wrong? How could I solve this?

It isn't very important: I could just use a standard LCL application. But I would like to understand why it doesn't work.

I attach the project.
My projects are on Gitlab and on Codeberg.

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: How to use fsBold constant in a console application
« Reply #1 on: August 23, 2020, 09:23:41 pm »
Hi!

I have not looked into your code, but:

You don't draw on the bitmap,
you draw on the CANVAS of the bitmap!

So this should do it:

Code: Pascal  [Select][+][-]
  1. LBitmap.Canvas.FontStyle := [fsBold];
[/s]
Winni

Sorry too fast - ths is wrong
« Last Edit: August 23, 2020, 09:27:06 pm by winni »

circular

  • Hero Member
  • *****
  • Posts: 4220
    • Personal webpage
Re: How to use fsBold constant in a console application
« Reply #2 on: August 25, 2020, 12:36:01 pm »
Hello Roland,

When using BGRABitmap with no gui, LCL dependency is avoided. To get the types actually used in BGRABitmap, you can use the units BGRAGraphics (and BGRAClasses in some cases as well) instead of Graphics and Classes.

Regards
Conscience is the debugger of the mind

Roland57

  • Sr. Member
  • ****
  • Posts: 422
    • msegui.net
Re: How to use fsBold constant in a console application
« Reply #3 on: August 25, 2020, 01:27:46 pm »
When using BGRABitmap with no gui, LCL dependency is avoided. To get the types actually used in BGRABitmap, you can use the units BGRAGraphics (and BGRAClasses in some cases as well) instead of Graphics and Classes.

Perfect. Thank you!
My projects are on Gitlab and on Codeberg.

 

TinyPortal © 2005-2018