Results 1 to 4 of 4

Thread: Stupid bugs still there!

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474

    Stupid bugs still there!

    There is a well known bug in PageSetupDialog in Framework 1.0 when using metric measurment system:
    For example show the pagesetupdialog and set the left margin to 25.4 mm (1 inch) and press ok. Now show it again and the value is now 10 (divided by 2.54 to be converted to inch and set the print document margin which is measured by 0.01 of inch, but not converted back to mm at subsequent ShowDialog).
    It is known for a long time now and there is a work arond for it but I hoped that it will be fixed in 1.1, but it's still there. I wonder why!
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  2. #2
    Fanatic Member
    Join Date
    Oct 1999
    Location
    England
    Posts
    982
    The bug is still there in Framework 1.1.

    I have just spent an afternoon trying to figure out what is going on and how to get round it.

    It is a right pain.

    How do you change the measurement system from metric to imperial?

    What is the work around? I hope its not a case of faffing around doing *10 here and there to the margins.
    Last edited by davidrobin; Mar 29th, 2004 at 10:39 AM.


    Things I do when I am bored: DotNetable

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    First you have to decide about the measurment system of the client machine:
    VB Code:
    1. ' Decide if the measurement system of the current user is Metric (millimiter in PageSetupDialog or inches.
    2. ' There is a dotnet way to read the measurement system of the current culture-for example US culture is associated
    3. ' with US measurments (inch)-but that way wont reflect the user override of regional seetings in control panel.
    4. ' So read the registry value that shows the measurement system. If the value is not present at all, as in Win98SE
    5. ' or the value is 1 then its inches, and if 0 then its Metric.
    6. Dim rgkey As RegistryKey, s As Integer
    7. Try
    8.        rgkey = Registry.CurrentUser.OpenSubKey("Control Panel").OpenSubKey("International")
    9.       If rgkey.GetValue("iMeasure") = Nothing Then
    10.           s = 1
    11.         Else
    12.           s = CByte(rgkey.GetValue("iMeasure"))
    13.       End If
    14.  Catch ex As System.Exception
    15.      s = 1
    16. Finally
    17.      rgkey.Close()
    18. End Try
    Then if the system is metric you have to multiply the document margins by 2.54 to convert it to mm.
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  4. #4
    Fanatic Member
    Join Date
    Oct 1999
    Location
    England
    Posts
    982
    Thanks Lunatic3, thats brilliant.


    Things I do when I am bored: DotNetable

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width