| |

VerySource

 Forgot password?
 Register
Search
View: 754|Reply: 4

Why can't this API function draw lines, etc.

[Copy link]

2

Threads

12

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-3-5 18:30:01
| Show all posts |Read mode
HDC hdc;
    hdc = GetDC (Form1-> Image1-> Canvas-> Handle);

    Form1-> DoubleBuffered = true;
    int y [880];
    float x = 0;
    int z = rand ();
    for (int i = 0; i <880; i ++)
    {
        y [i] = sin (x + z) * 100;
        x = x + 3.1415 / 40;
    }
    TPoint pot [800];
    int xx = 0;
    int i = 0;
    
    if (y [i] <0)
    {
        y [i] =-2 * y [i];
    }
    for (int j = 0; j <800; j ++)
    {
        pot [j] = Point (xx, y [i] +100);
        xx = xx + 1;
        i ++;
    }
    unsigned long num [1];
    num [0] = 799;
    Image1-> Picture = NULL;
    Image1-> Canvas-> Pen-> Color = clBlue;
    PolyPolyline (hdc, pot, num, 1); // cannot draw a line
  Image1-> Canvas-> Polyline (pot, 799); // and it can


Everyone help me depressed!
Reply

Use magic Report

2

Threads

12

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 Hungary

 Author| Post time: 2020-5-22 18:45:01
| Show all posts
Why no one likes ??

I just want to use the numbers in pot [800];
Reply

Use magic Report

0

Threads

14

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-5-25 09:15:01
| Show all posts
hdc = Form1-> Image1-> Canvas-> Handle;
The GetDC parameter requires a window handle, Canvas-> Handle is the handle of the drawing device
HDC GetDC (
  HWND hWnd // handle to a window
);
Reply

Use magic Report

2

Threads

12

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-5-26 19:00:02
| Show all posts
Reply

Use magic Report

2

Threads

12

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 Japan

 Author| Post time: 2020-5-26 19:15:01
| Show all posts
Thanks is indeed
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list