function plotter program using MFC

This is a discussion on function plotter program using MFC within the Windows Programming forums, part of the Platform Specific Boards category; Hello, so, i'm using visualstudio .net, But i'm programming with the MFCs. here's the deal. The programis supposed to read ...

  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    55

    function plotter program using MFC

    Hello,

    so, i'm using visualstudio .net, But i'm programming with the MFCs.

    here's the deal. The programis supposed to read in a file, and then plot data on a graph..

    my problem is scaling. I can't get my plotted line to move with my tic marks on the graph when i do things like resize the window..

    anyone have a clue?? i'm sooooooooo lost.. and this is due soon... the sucks is that class has no TAs

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    there are a couple of ways to do this...

    the 'dodgy' way
    draw to a seperate DC and StretchBlt() to the screen.
    The problem being that StretchBlt() is slow,
    not good with line drawings (can lose some lines)
    or non integer resizes (ie OK with 1:2 or 2:1 but bad with 1:3.454)

    the 'correct' way
    Look at MSDNs 'Coordinate Spaces and Transformations'

    the 'quick' way
    when drawing the axis find a ratio between the number of pixels and max range for that axis. Use this to convert each point, add to an array and draw with PolyLine() or similar.

    ie
    screen width = 640 pixels
    X axis range (max X - min X) = 300
    ratio = 2 ( 640/300 )
    margin = 20 ( (640%300)/2) )

    Don't forget to clear the area first.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 04:06 PM
  2. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  3. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 01:03 PM
  4. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-30-2005, 12:21 AM
  5. one function in my program won't work....
    By talz13 in forum C++ Programming
    Replies: 12
    Last Post: 04-06-2003, 01:19 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21