Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Using the Lazarus IDE
»
Designer
»
Two problems with Combobox - text color and height
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
IRC channel
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
leetcode doesn’t support ...
by
Martin_fr
[
Today
at 01:29:19 am]
Demo Scene Picture sinwav...
by
KodeZwerg
[
Today
at 01:28:20 am]
open dialog - default dir...
by
KodeZwerg
[
Today
at 12:34:53 am]
Can function be used for ...
by
jamie
[
Today
at 12:26:42 am]
DbGrid, grid column check...
by
KodeZwerg
[
Today
at 12:08:29 am]
Colore celle StringGrid
by
JuanBell
[April 24, 2024, 10:37:56 pm]
Likely bug
by
440bx
[April 24, 2024, 10:12:59 pm]
Any upgrades to fpWeb pag...
by
verasan
[April 24, 2024, 10:11:46 pm]
Web Applications with Pas...
by
Handoko
[April 24, 2024, 08:56:29 pm]
AI, NLP and CAI: Text Gen...
by
indydev
[April 24, 2024, 08:54:00 pm]
Offical launch of the 1 B...
by
Gustavo 'Gus' Carreno
[April 24, 2024, 08:48:22 pm]
Multidimensional arrays a...
by
KodeZwerg
[April 24, 2024, 08:34:38 pm]
Ho Ho Ho IntraWeb in Laza...
by
Thaddy
[April 24, 2024, 08:31:29 pm]
[SOLVED] System.Now gives...
by
alpine
[April 24, 2024, 08:29:19 pm]
Installing and using Vamp...
by
Odacir
[April 24, 2024, 07:58:22 pm]
Demo Scene Bitmap Font Sc...
by
KodeZwerg
[April 24, 2024, 07:21:14 pm]
what's difference between...
by
ASerge
[April 24, 2024, 07:09:52 pm]
splitting an image
by
KodeZwerg
[April 24, 2024, 07:07:21 pm]
Debugger error
by
bobonwhidbey
[April 24, 2024, 07:03:07 pm]
How to: create DLL file f...
by
paule32
[April 24, 2024, 07:02:31 pm]
Your best UI design - con...
by
circular
[April 24, 2024, 06:48:12 pm]
Converting a string/index...
by
1HuntnMan
[April 24, 2024, 06:35:19 pm]
Drawing grid lines on a t...
by
KodeZwerg
[April 24, 2024, 05:42:19 pm]
Compile/Convert Delphi pr...
by
Martin_fr
[April 24, 2024, 05:29:03 pm]
Lazarus features in a non...
by
Lutz Mändle
[April 24, 2024, 05:26:34 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Two problems with Combobox - text color and height (Read 4338 times)
Przemyslav
New Member
Posts: 44
Two problems with Combobox - text color and height
«
on:
March 06, 2017, 04:44:09 pm »
Hello everybody
I have problem with ComboBox. For example I have like this:
(https://s15.postimg.org/l5253hjpj/Bez_tytu_u.png)
I set color of font to red, but all my items are black? What i do wrong?
Second question: Can I resize the white field with my items, I'm talking about height this field. When I have much more items, this field is too small in height direction.
Logged
fred
Full Member
Posts: 201
Re: Two problems with Combobox - text color and height
«
Reply #1 on:
March 06, 2017, 05:10:48 pm »
I don't the answer to the first question but the second question is easy:
Code: Pascal
[Select]
[+]
[-]
ComboBox1
.
DropDownCount
:
=
20
;
Logged
balazsszekely
Guest
Re: Two problems with Combobox - text color and height
«
Reply #2 on:
March 06, 2017, 05:25:31 pm »
@Przemyslav
Set Style property to csOwnerDrawFixed, then on DrawItem:
Code: Pascal
[Select]
[+]
[-]
uses
LCLIntf
,
LCLType
;
procedure
TForm1
.
ComboBox1DrawItem
(
Control
:
TWinControl
;
Index
:
Integer
;
ARect
:
TRect
;
State
:
TOwnerDrawState
)
;
var
Str
:
string
;
CB
:
TComboBox
;
begin
CB
:
=
TComboBox
(
Control
)
;
Str
:
=
CB
.
Items
[
Index
]
;
if
odSelected
in
State
then
CB
.
Canvas
.
Brush
.
Color
:
=
clHighlight
else
CB
.
Canvas
.
Brush
.
Color
:
=
CB
.
Color
;
CB
.
Canvas
.
FillRect
(
ARect
)
;
CB
.
Canvas
.
Pen
.
Color
:
=
clRed
;
DrawText
(
CB
.
Canvas
.
Handle
,
PChar
(
Str
)
,
Length
(
Str
)
,
ARect
,
DT_LEFT
)
;
end
;
Logged
Przemyslav
New Member
Posts: 44
Re: Two problems with Combobox - text color and height
«
Reply #3 on:
March 06, 2017, 05:31:16 pm »
Thanks you very much
I will try it. In first I was shocked, that color font which I have chosen in properties wasn't working.
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Using the Lazarus IDE
»
Designer
»
Two problems with Combobox - text color and height
TinyPortal
© 2005-2018