Discussion:
Dialog Box DLU woes
(too old to reply)
Scoots
2009-10-22 18:35:41 UTC
Permalink
Hi all,

I'm trying to draw something very precisely. In fact, I'm emulating a
device and I need to draw bitmaps very, very precisely. By which I
mean, pixels. Now, given that the device has buttons, I'd like to,
say, have a bitmap button, etc. I know the size I want (100x28
pixels), I know how big my dialog box is, etc.

But the Windows Forms designer (vs2008 pro) won't let me do anything
in pixels. There's no text, so I don't need to worry about the system
font, so why am I forced into DLU's? Is there anyway to operate in
pixels?

Or should I just do this programatically?

If I haven't been clear, many pardons. Ask away!
~Scoots
Igor Tandetnik
2009-10-22 19:11:02 UTC
Permalink
Post by Scoots
I'm trying to draw something very precisely. In fact, I'm emulating a
device and I need to draw bitmaps very, very precisely. By which I
mean, pixels. Now, given that the device has buttons, I'd like to,
say, have a bitmap button, etc. I know the size I want (100x28
pixels), I know how big my dialog box is, etc.
But the Windows Forms designer (vs2008 pro) won't let me do anything
in pixels.
Resize your controls (and the dialog window itself) programmatically to the desired pixel sizes when the dialog is initialized.
Post by Scoots
There's no text, so I don't need to worry about the system
font, so why am I forced into DLU's?
Because overwhelming majority of dialogs does have text and does depend on system font. Yours is a very special case, so you need to do some special work to accomodate it.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be sure where they are going to land, and it could be dangerous sitting under them as they fly overhead. -- RFC 1925
Scoots
2009-10-22 19:25:19 UTC
Permalink
Okay, can do. I just wasn't sure if some option had gotten selected
that locked me into one or the other.

Thanks!
~Scoots
Igor Tandetnik
2009-10-22 19:33:55 UTC
Permalink
Post by Igor Tandetnik
Post by Scoots
There's no text, so I don't need to worry about the system
font, so why am I forced into DLU's?
Because overwhelming majority of dialogs does have text and does
depend on system font. Yours is a very special case, so you need to
do some special work to accomodate it.
Note also that a 300x300 dialog (or bitmap, for that matter) looks very differently on 640x480 monitor (where it takes half the screen) and on 1920x1200 monitor (where it would barely fit a normal-sized OK and Cancel buttons). This is another reason why, most of the time, exact pixel sizes are a bad idea.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be sure where they are going to land, and it could be dangerous sitting under them as they fly overhead. -- RFC 1925
Loading...