How to write a C program to draw a line in visual studio 2019?

Anonymous
2020-08-17T16:03:39.447+00:00

I searched a lot over internet but could not find a satisfying answer. I tried all tricks but it did not work.

Developer technologies | C++
Developer technologies | C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
0 comments No comments
{count} votes

Answer accepted by question author
  1. Sean Liming 4,806 Reputation points Volunteer Moderator
    2020-08-17T16:20:59.357+00:00

    A graphics library is needed. The old way in C was to use Turbo C and the graphics.h library that supported drawing.For Visual Studio, there is Win32, C++, and GDI as this youtube video points out: https://www.youtube.com/watch?v=WmSuwojt3nw, but it is not C. GTK and IUP are a couple of graphical libraries that work with C.

    Regards,

    Sean Liming

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Castorix31 91,556 Reputation points
    2020-08-17T16:35:16.603+00:00

    There are several ways (GDI, GDI+, Direct2D, ...)

    In GDI, it can be done with : LineTo function,
    in WM_PAINT of a window or control

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.