Waitrud Weber’s blog

things and reminders for memories

Proposal 002

Usually, buttons are constructed with a rectangle and a message.
So, I drew them.
Next we could draw a button even when we would like to use button.

----------------- button.h --------------------
#include <tchar.h>
#include <Windows.h>
#include <windowsx.h>

#include "button.h"

int drawButton( HDC hdc, char *button_name, RECT rect );

// this function draws a button.
// button has a string.
// button has a rect which is one of shapes in this case.
int drawButton( HDC hdc, char *button_name, RECT *rect )
{

 SetTextColor( hdc, RGB(0 ,0, 255));

 Rectangle( hdc, rect->left, rect->top, rect->right, rect->bottom );
 DrawText( hdc, TEXT( button_name ), -1, rect, DT_NOCLIP);

 return 1;
}

----------------- button.h --------------------

 

f:id:Waitrud_Weber:20180501160826p:plain

 

Thanks for the below. I still use it as software template.

https://blog.goo.ne.jp/masaki_goo_2006/e/d9a32b7fe29cf390597e420654868471
http://yoshiiz.blog129.fc2.com/blog-entry-208.html

 

My pleasure if you download the below for education.

https://github.com/WaitrudWeber/source_zip/blob/master/20180501-2nd.zip

Plese reffer to the below for compilation.
https://waitrudweber.hatenablog.com/entry/2018/05/01/005938