C / C + + Programming Notes: C language production lovers must love electronic album, source code analysis!


Today is 521, let’s share what a programmer must know – lovers remember to kill love electronic photo album! Words do not say much, first on the idea, followed by the source code!


1. Basic visual programming

1.1 initgraph(800,600);

1.2 close the window;

1.3 window coordinates

2. Basic drawing function

Line drawing

2.2 circle

2.3 solidcircle

2.4 setting class functions

settextcolor setlinecolor

settextstyle setbkmode

2.5 display text: outtextxy

3. Mouse operation

3.1 store mouse information mousemsg M;

3.2 get the mouse message on the window


3.3 classification treatment (m.umsg)






4. Basic texture

4.1 image img; declare the image variable to store images

4.2 loading image: loadimage (& img, “path”);

Load in scaling mode: loadimage (& img, “path”, int width, ing height);

4.3 display pictures: putimage (int x, int y, & IMG);

5. Music

5.1 header file + load static library


#pragma comment(lib,”winmm.lib”)

5.2 turn on music

MciSendString (“open 1. MP3 alias music”, 0,0,0); / / open the music and give the file an alias called music

5.3 playing music

mciSendString(“play music repeat”,0,0,0);

Project process:

《1》 . load resources

《2》 . draw button

《3》 . display picture

《4》 . user interaction (click button event)

Source code sharing

I hope it will help you~

Learning C / C + + programming knowledge, want to become a better programmer, or you have difficulty learning C / C + +, you can come to the author’s C language c + + Zero basic programming learning circle. There are not only learning video and file source code, but also more like-minded friends. Welcome to change careers and learn programming partners. Communicate with you and grow faster than yourself!