Results 1 to 13 of 13

Thread: [RESOLVED] How to Draw the Exact User defined Scale on PictureBox in VB6

  1. #1

    Thread Starter
    Lively Member amolt's Avatar
    Join Date
    Aug 2006
    Location
    INDIA
    Posts
    80

    Resolved [RESOLVED] How to Draw the Exact User defined Scale on PictureBox in VB6

    Hi All,

    I Need to draw a user defined graph in VB6.0, for that i used the PictureBox as my Plotting space.

    I get the Input for plotting scale on PictureBox as per user input, the Main Problem I'm facing is if suppose the user input is in between -8 to 10 for X-axis and 98.39 to 98.876 for Y-axis the middle portion for scale shows wrong coordinates which could result into unexpected behaviour for my graph.

    Plz could anyone tell me what should i have to do to plot my exact graph..

    Waiting for reply soon...


  2. #2
    Hyperactive Member singularis's Avatar
    Join Date
    Nov 2006
    Location
    Over There!
    Posts
    372

    Re: How to Draw the Exact User defined Scale on PictureBox in VB6

    What function are you using to "plot" the values to the "graph"?
    If what I said was helpful, give me rep!

    My Complete Games: -- 2D Zone (Space Shooter game) || _2D Zone 2_ || Ninja Blob (2D platformer) || Dren (Co-op up to 4 player base defence game)

    My Projects: -- The Dread Engine (2D VB game Engine) || A* Path Finding


    An excellent site for learning DirectX7, 8 & 9 (for VB6, C# & VB.net) would be: directx4vb.vbgamer.com --- For my projects and games see: pieper.freehostia.com

  3. #3
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: How to Draw the Exact User defined Scale on PictureBox in VB6

    According to your coordinates, you should set the Form Scale like this:
    Code:
    Private Sub Form_Load()
        With Picture1
            .AutoRedraw = True
            .DrawWidth = 2
            
            .ScaleWidth = 18
            .ScaleLeft = -8
            .ScaleHeight = 98.39 - 98.876
            .ScaleTop = 98.876
            
            'Test: If the coordinates are correct,
            '      you should see a Diagonal line from
            '      left Up corner to Right Down corner..
            .Line 3, -8, 98.876, 10, 98.39, vbBlue
        End With
    End Sub
    Note that ScaleHeight contains a negative value, the reason: In VB Forms, the normal behavior of Y coordinates is become greater when you move down, but when working with mathematics (X and Y Axis) you need exatly the opposite, Y must grow when you move UP, thats the reason to assign a negative Value to ScaleHeight.
    Last edited by jcis; Apr 19th, 2007 at 11:33 PM.

  4. #4

    Thread Starter
    Lively Member amolt's Avatar
    Join Date
    Aug 2006
    Location
    INDIA
    Posts
    80

    Re: How to Draw the Exact User defined Scale on PictureBox in VB6

    Hi,


    I Checked the code but its also not going to give me the exact results,
    The problem occurs in this code again is :

    Check for the X-axis co-ordinates, u can figure out the difference between the -1 to 1 points. As u see there the coordinates are placed in -0 to 0 and in between that the values moved to exponential form as (-1.948867E-02).

    And i have 0 as a main coordinate in my graph plotting, so if i plot the graph on which 0th coordinate the point get placed??


    waiting for u r reply .....

    Thks and regds,
    amolt....

  5. #5
    Hyperactive Member singularis's Avatar
    Join Date
    Nov 2006
    Location
    Over There!
    Posts
    372

    Re: How to Draw the Exact User defined Scale on PictureBox in VB6

    Can you post your code?
    If what I said was helpful, give me rep!

    My Complete Games: -- 2D Zone (Space Shooter game) || _2D Zone 2_ || Ninja Blob (2D platformer) || Dren (Co-op up to 4 player base defence game)

    My Projects: -- The Dread Engine (2D VB game Engine) || A* Path Finding


    An excellent site for learning DirectX7, 8 & 9 (for VB6, C# & VB.net) would be: directx4vb.vbgamer.com --- For my projects and games see: pieper.freehostia.com

  6. #6
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: How to Draw the Exact User defined Scale on PictureBox in VB6

    -0 to 0? I don't understand what you say.

  7. #7
    Hyperactive Member singularis's Avatar
    Join Date
    Nov 2006
    Location
    Over There!
    Posts
    372

    Re: How to Draw the Exact User defined Scale on PictureBox in VB6

    if -0 = 0 then -NULL = NULL
    If what I said was helpful, give me rep!

    My Complete Games: -- 2D Zone (Space Shooter game) || _2D Zone 2_ || Ninja Blob (2D platformer) || Dren (Co-op up to 4 player base defence game)

    My Projects: -- The Dread Engine (2D VB game Engine) || A* Path Finding


    An excellent site for learning DirectX7, 8 & 9 (for VB6, C# & VB.net) would be: directx4vb.vbgamer.com --- For my projects and games see: pieper.freehostia.com

  8. #8

    Thread Starter
    Lively Member amolt's Avatar
    Join Date
    Aug 2006
    Location
    INDIA
    Posts
    80

    Re: How to Draw the Exact User defined Scale on PictureBox in VB6

    Hi,

    As per this code we are setting the X-axis:
    .ScaleLeft = -8
    .ScaleWidth = 18
    so as logically we can devide the scale in two parts first is negative :
    from (0 to -8) and from (0 to 18).

    Now in this the mddle section or midpoint of this scale is 0.
    But if u observe it by showing points in tooltip u observe the difference that the center point of 0 - coordinate actually plotted in terms of -0 and 0 and the central area of this will be in exponential form.

    Thks n Regds,

    amolt......

  9. #9
    Hyperactive Member singularis's Avatar
    Join Date
    Nov 2006
    Location
    Over There!
    Posts
    372

    Re: How to Draw the Exact User defined Scale on PictureBox in VB6

    Ah, you mean you want to plot floating point numbers? Such as 0.342342 that is in exponential form?
    If what I said was helpful, give me rep!

    My Complete Games: -- 2D Zone (Space Shooter game) || _2D Zone 2_ || Ninja Blob (2D platformer) || Dren (Co-op up to 4 player base defence game)

    My Projects: -- The Dread Engine (2D VB game Engine) || A* Path Finding


    An excellent site for learning DirectX7, 8 & 9 (for VB6, C# & VB.net) would be: directx4vb.vbgamer.com --- For my projects and games see: pieper.freehostia.com

  10. #10

    Thread Starter
    Lively Member amolt's Avatar
    Join Date
    Aug 2006
    Location
    INDIA
    Posts
    80

    Re: How to Draw the Exact User defined Scale on PictureBox in VB6

    Please have you gone through the code by testing it in app?
    When you plot the scale between -8 to 18 the scale is divided into parts of floating point numbers.
    so when we go near to 0 coordinate you will see the points as floating numbers and moving further to X-axis you find the thing what i m saying just check it out?


    waiting ...
    amolt..

  11. #11
    Hyperactive Member singularis's Avatar
    Join Date
    Nov 2006
    Location
    Over There!
    Posts
    372

    Re: How to Draw the Exact User defined Scale on PictureBox in VB6

    Which App?
    If what I said was helpful, give me rep!

    My Complete Games: -- 2D Zone (Space Shooter game) || _2D Zone 2_ || Ninja Blob (2D platformer) || Dren (Co-op up to 4 player base defence game)

    My Projects: -- The Dread Engine (2D VB game Engine) || A* Path Finding


    An excellent site for learning DirectX7, 8 & 9 (for VB6, C# & VB.net) would be: directx4vb.vbgamer.com --- For my projects and games see: pieper.freehostia.com

  12. #12

    Thread Starter
    Lively Member amolt's Avatar
    Join Date
    Aug 2006
    Location
    INDIA
    Posts
    80

    Re: How to Draw the Exact User defined Scale on PictureBox in VB6

    Which App?




    Sorry for misunderstanding if any!

    I just pronounce App to application made by the code given here.

  13. #13
    Hyperactive Member singularis's Avatar
    Join Date
    Nov 2006
    Location
    Over There!
    Posts
    372

    Re: How to Draw the Exact User defined Scale on PictureBox in VB6

    I know App = Application, you have not posted your code....
    If what I said was helpful, give me rep!

    My Complete Games: -- 2D Zone (Space Shooter game) || _2D Zone 2_ || Ninja Blob (2D platformer) || Dren (Co-op up to 4 player base defence game)

    My Projects: -- The Dread Engine (2D VB game Engine) || A* Path Finding


    An excellent site for learning DirectX7, 8 & 9 (for VB6, C# & VB.net) would be: directx4vb.vbgamer.com --- For my projects and games see: pieper.freehostia.com

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