in

Visual Studio 2008 (Visual Basic) Express Dialog Base Units Conversion

Hello Everyone!  I am a retired mainframe COBOL/CICS programmer.  I was a VB v1 – v3 hobbyist in the 90’s, but moved on to other things.

Last month I downloaded a copy of Visual Basic 2008 Express and started tinkering around (WOW! Has VB ever changed) and encountered my first big road block.

I have a copy of Microsoft Press book Microsoft Windows User Experience, Official Guidelines for User Interface Developers and Designers.  In chapter 14 Visual Design, Spacing and Positioning, pages 451 thru 456 the author provides suggested size and placement of controls on a form.  This is all great information. But; it’s all in Dialog Base Units (DLUs) and Visual Basic 2008 Express uses PIXELS.

I searched the Internet high and low and I was unable to find a solution to converting DLU’s to PIXEL’s for my screen resolution that I could understand.  Every thing I found was written in Windows SDK, C++ or C#, and then the solutions were one-liners and not a complete program.  I had a problem spelling these language names much less understanding the code.

So here is where I am stumped and need Help:  

I have a small form with the following controls;
  txtDialogBaseUnits, where the user enters the number of Dialog Base Units to be converted
  txtScreenResolution, program displayed
  txtPIXELheight, program calculated and displayed
  txtPIXELwidth, program calculated and displayed
  btnOK

The user enters the number of Dialog Base units to be converted and clicks OK.

In the btnOK click event, the program retrieves the Dialog Base Unit for the current screen resolution and calculates the txtPIXELheight and txtPIXELwidth.  The txtScreenResolution, txtPIXELheight and txtPIXELwidth controls are populated with the calculation results and the form is refreshed.

I would image that there are tons of variables and other functions that have to be coded and executed, but with my very limited experience I have provided a very high-level example of how the results would be provided.

Any and all help that can be provide would be greatly appreciated.

Thanks Everyone!

Solution: Visual Studio 2008 (Visual Basic) Express Dialog Base Units Conversion

Wow a Visual Basic rookie, and you are diving into the deep end of the pool--Dialog Base Unit are not a common subject.

I don't believe that you need to concern yourself with Dialog Base units when you are working with a Windows Forms application.  Windows Forms and WPF have functionality that will give you that device-independence that you are looking for.

Scaling Windows Forms
http://www.informit.com/guides/content.aspx?g=dotnet&seqNum=488