On my system the checkbox seems to have a width and height of 13 pixels.
Is this the same on every system or is there a API function to get the
size of the checkbox?
Jens
Certainly on Win9x the checkboxes and radiobuttons are fixed size bitmaps
and are notable for being so, pretty much all else can be scaled but those
two beggars are untouchable (unless you roll your own). It's something that
Mr Gates will have to reconsider as the screen resolutions gradually
increase. What was a good size on 640x480 is getting ridiculous on
1600x1200.
--
Regards,
Chris Luck
I think so, too. But I have to use DrawFrameControl to draw my own
checkboxes. I don't know how the VCL decides how large to draw the
checkboxes, but it would be good if mine would have the same size, no
matter what ideas come to Mr. Gate's mind.
Because screen resolutions increase (and for some other reasons, too)
people use more and more owner drawn elements. But isn't it the task of
an operating system to provide such functionality?
Jens
< Résumé of an earlier discussion >
=========================
Now lets say I wanted to cope with the accessability windows schemes that
we have. Is there an API to retrieve the dimensions, rather that hard
coding as 13x13 ?
Paul Champan
---------------------------------
Check the code of TCheckListBox from the VCL
var
FCheckWidth, FCheckHeight: Integer;
procedure GetCheckSize;
begin
with TBitmap.Create do
try
Handle := LoadBitmap( 0, PChar(32759) );
FCheckWidth := Width div 4;
FCheckHeight := Height div 3;
finally
Free;
end;
end;
Krasimir Stoyanov
---------------------------------
Using the code that Krasimir posted I tested the CheckBox dimensions with
Accessibility features on/off and under small/large fonts. I also tried
scaling a form containing a CheckBox - the caption scaled but the CheckBox
did not. Under all conditions the dimensions stayed at 13 pixels square.
Chris Luck
=========================
< End résumé >
Of course it did not scale because it is a bitmap but the fact that not even
the Accessibility API can touch these two controls indicates how badly MS
fouled-up the design here and contrasts with the MenuChecks which are
scalable. It would most likely need completely new controls based on the
Marlett font to put it right. Until we learn of any changes to the API I
would stick with 13 or, if in doubt, use Krasimirs' tip. If there are any
changes I would hope they would be well flagged by MS though they are just
as likely to smuggle something in with an Internet Explorer update.
You can increase the size of the checkbox when using DrawFrameControl but
the scaling is not well proportioned as the checkmark has a tendency to be
at top-left (something else that could have been better done).
15/16 reasonable
18 tolerable
21/22 sufferable
27/30 Chunky
BTW, were you aware that you can set the box size with just the
height of the Rect, if the width is greater it automatically arranges itself
to display a square box centralised in the 'button', this is useful for
diplaying CheckBoxes in a grid. For the meantime, if you really want a
scalable checkbox, you will have to do all the drawing yourself, perhaps
using the 'chars' from the Marlett font. Talking of which, if you want less
chunky results always use: Font.Style := [], it otherwise defaults to
displaying in bold.
> But isn't it the task of
> an operating system to provide such functionality?
Who could argue, aside from Mr Gates?
--
Regards,
Chris Luck
Paul Champan
---------------------------------
var
FCheckWidth, FCheckHeight: Integer;
Krasimir Stoyanov
---------------------------------
> But isn't it the task of
> an operating system to provide such functionality?
Who could argue, aside from Mr Gates?
--
Regards,
Chris Luck
They should at least be large enough to display the text in the chosen font
I would say.
Finn Tolderlund