CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Jul 1999
    Posts
    24

    Just wanted to know...

    Hello everybody!

    This text is from Finland so forgive me my lousy english. (Time = 10:55 pm)

    I there a way to get a string length in mm (millimeter). I have a product code which cannot be longer than 64 mm. I have to scale it somehow if it's longer. I'm in a lots of trouble. Visual Basic's help doesn't help me. Can you???

    Yours,
    Michael


  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: Just wanted to know...

    the GetTextExtentPoint32 API returns the size of a text in logical units.
    You can then use the LPtoDP function to convert it. Also check out the SetMapMode API.


  3. #3
    Join Date
    Jul 1999
    Posts
    24

    Re: Just wanted to know...

    Hi!

    Go Lothar go... Yeah, it worked! Thanks man. You're a real day saver. Thanks again.

    Michael






  4. #4
    Join Date
    May 1999
    Posts
    3,332

    Re: Just wanted to know...

    Cool.
    Would you post your code here?
    I'd like to see that TextToMMConversion routine. It might be useful for all of us.


  5. #5
    Join Date
    Jul 1999
    Posts
    24

    Re: Just wanted to know...

    Another way of doing it (I finally decided to do it like this):

    Dim TempHelp As String
    Dim CodeLenght As Long

    printer.scalemode = 6 'mm, can be anything (0-7)

    TempHelp = "I love my country (Finland)"

    CodeLenght = Printer.ScaleWidth(TempHelp)
    'At this point CodeLenght will be in mm's. It depends what fontsize and fontname you are using but with a little tricky tricky stuff you'll get the comparing session nicely ended.

    Hope this helps, that's how I did it. It works in my prog. By the way: production cards sucks.

    Michael


  6. #6
    Join Date
    May 1999
    Posts
    3,332

    Re: Just wanted to know...

    That's really cool.
    What does that mean?
    >production cards sucks
    what are production cards?


  7. #7
    Join Date
    Jul 1999
    Posts
    24

    Re: Just wanted to know...

    Here in our company we do product cards which are A4 size paper pieces. Maybe there are better way to express it, but in our language it's called 'tuotekortti'. One product has one card and in the card there are mentioned all the features of product. For example in the clothing business the card includes it's unique (product) number, it's color, codes and something like that. And the part where I said that it sucks. It means that I have learned to hate the cards. If you have a e-mail address. I could send you the next card I finish. If it's ok?

    Michael



  8. #8
    Join Date
    May 1999
    Posts
    3,332

    Re: Just wanted to know...

    'tuotekortti'? I am intimidated :-)
    Thanks for the information.
    I don't think a could use such a thing.


  9. #9
    Join Date
    Jul 1999
    Posts
    24

    Re: Just wanted to know...

    OK =)

    Michael


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

Featured