Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. SetScrollSizes is cauing pinch.

SetScrollSizes is cauing pinch.

Scheduled Pinned Locked Moved C / C++ / MFC
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    adityarao31
    wrote on last edited by
    #1

    I have written SetScrollSizes function for my class derived from CScrollView in OnInitUpdate. But it is giving me big pinch. I have to read one text file from disk and diaplay as it is by changing font. I created font and I am displaying it. // code fragment. sizeTotal.cx = Linelength //calculated and fine. sizeTotal.cy = Numlines * cyChar; where cyChar = tm.tmHeight + tm.tmExternalLeading; SetScrollSizes(MM_TEXT,sizeTotal); But during display I find scroll is too huge than my file and scrolling is very fast than required. If file would have of constant size I might have hardcoded but sometimes it is just four lines and some time tens of thousands. Can any one tell me. I checked current mapping mode of device context ,it is MM_TEXT. muktoham

    || Lust Causes Sorrow ||

    N 1 Reply Last reply
    0
    • A adityarao31

      I have written SetScrollSizes function for my class derived from CScrollView in OnInitUpdate. But it is giving me big pinch. I have to read one text file from disk and diaplay as it is by changing font. I created font and I am displaying it. // code fragment. sizeTotal.cx = Linelength //calculated and fine. sizeTotal.cy = Numlines * cyChar; where cyChar = tm.tmHeight + tm.tmExternalLeading; SetScrollSizes(MM_TEXT,sizeTotal); But during display I find scroll is too huge than my file and scrolling is very fast than required. If file would have of constant size I might have hardcoded but sometimes it is just four lines and some time tens of thousands. Can any one tell me. I checked current mapping mode of device context ,it is MM_TEXT. muktoham

      || Lust Causes Sorrow ||

      N Offline
      N Offline
      Nelek
      wrote on last edited by
      #2

      I think the problem is that the size of the font (vertical points) is not matching the vertical real size in pixels. I mean: a font 8 is not 8 pixels height. Edit: Just make a test. Declare a Font of 8 or 10 or 12 (whatever you want), then make a TextOut at (10,50) and another at (10, 50 + Font size) you will see that doesn't match) So the thing is that you should calculate aprox the coeficient you need for a line in pixels of MM_TEXT

      Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson

      modified on Monday, May 19, 2008 1:57 PM

      A 1 Reply Last reply
      0
      • N Nelek

        I think the problem is that the size of the font (vertical points) is not matching the vertical real size in pixels. I mean: a font 8 is not 8 pixels height. Edit: Just make a test. Declare a Font of 8 or 10 or 12 (whatever you want), then make a TextOut at (10,50) and another at (10, 50 + Font size) you will see that doesn't match) So the thing is that you should calculate aprox the coeficient you need for a line in pixels of MM_TEXT

        Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson

        modified on Monday, May 19, 2008 1:57 PM

        A Offline
        A Offline
        adityarao31
        wrote on last edited by
        #3

        Thanks I will check it tomorrow and will tell you,but it seems right,if I will practically find font height pixels everything will get solved.

        || Lust Causes Sorrow ||

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups