Criamos um projeto em win32,
mas o VS nos apresentou uma janela branca sem graça,
e com dois menus, e a caixa de ferramenta estava desabilitada.
Decidimos logo escolher uma entre duas opções,
que seria, ou agente programava tudo na mão,
ou descartava a janela ofertada e adicionaria
ao projeto um Dialog.
como hoje tivemos um pouco mais de tempo,
optamos então pela primeira opção.
E assim, criamos este programa, aproveitando
uma boa porcentagem do outro que apresentamos
a poucos dias atrás, e acrescentrando
alguns outros recursos, na interface e no menu.
//=============================================================================
VOID Cria_Eddit_Pot ( HWND hwnd ) {
Edit_1 = CreateWindowEx (
WS_EX_CLIENTEDGE, L"EDIT", L"",
WS_VISIBLE | WS_CHILD | WS_BORDER | ES_RIGHT,
250, 94, 60, 20,
hwnd, ( HMENU ) ID_EDIT_1, NULL, NULL );
Edit_2 = CreateWindowEx (
WS_EX_CLIENTEDGE, L"EDIT", L"",
WS_VISIBLE | WS_CHILD | WS_BORDER | ES_RIGHT,
250, 117, 60, 20,
hwnd, ( HMENU ) ID_EDIT_2, NULL, NULL );
Edit_3 = CreateWindowEx (
WS_EX_CLIENTEDGE, L"EDIT", L"",
WS_VISIBLE | WS_CHILD | WS_BORDER | ES_RIGHT | ES_READONLY,
250, 140, 60, 20,
hwnd, ( HMENU ) ID_EDIT_3, NULL, NULL );
}
//=============================================================================
VOID Button_1 ( HWND hwnd ) {
HWND button_1;
button_1 = CreateWindowW ( L"button", L"Ok",
WS_VISIBLE | WS_CHILD, 160, 170, 30, 19,
hwnd, ( HMENU ) IDC_BUTTON3, NULL, NULL );
}
//=============================================================================
VOID Button_2 ( HWND hwnd ) {
HWND button_2;
button_2 = CreateWindowW ( L"button", L"Ok",
WS_VISIBLE | WS_CHILD, 160, 170, 30, 19,
hwnd, ( HMENU ) IDC_BUTTON4, NULL, NULL );
}
//=============================================================================
VOID Button_3 ( HWND hwnd ) {
HWND button_3;
button_3 = CreateWindowW ( L"button", L"Ok",
WS_VISIBLE | WS_CHILD, 160, 170, 30, 19,
hwnd, ( HMENU ) IDC_BUTTON5, NULL, NULL );
}
//=============================================================================
VOID Button_4 ( HWND hwnd ) {
HWND button_4;
button_4 = CreateWindowW ( L"button", L"Ok",
WS_VISIBLE | WS_CHILD, 160, 170, 30, 19,
hwnd, ( HMENU ) IDC_BUTTON6, NULL, NULL );
}
//=============================================================================
VOID Button_5 ( HWND hwnd ) {
//HWND button_5;
CreateWindowW ( L"button", L"Novo cálculo",
WS_VISIBLE | WS_CHILD, 210, 170, 100, 19,
hwnd, ( HMENU ) IDC_BUTTON7, NULL, NULL );
}
//=============================================================================
VOID Moldura ( HDC hdc ) {
PAINTSTRUCT ps;
Graphics graphics ( hdc );
Graphics* myGraphics;
GraphicsPath myGraphicsPath;
Pen penJoin1 ( Color ( 255, 0, 255, 0 ), 10 );
penJoin1.SetLineJoin ( LineJoinBevel );
SetBkColor ( hdc, RGB ( 255, 0, 255 ) );
graphics.DrawRectangle ( &penJoin1, Rect ( 5, 5, 580, 280 ) );
graphics.DrawPath ( &penJoin1, &myGraphicsPath );
PointF pointF1 ( 120.0f, 10.0f );
StringFormat myStringFormat;
FontFamily fontFamily ( L"Times New Roman" );
Font font ( &fontFamily, 24, FontStyleItalic, UnitPixel );
Pen penJoin2 ( Color ( 255, 255, 0, 0 ), 1 );
myGraphicsPath.AddString ( L"WIN32 - CALCULADORA DA LEI DE OHM", 33, &fontFamily,
0, 17, pointF1, &myStringFormat );
graphics.DrawPath ( &penJoin2, &myGraphicsPath );
}
//=============================================================================
VOID Informe ( HDC hdc ) {
Graphics graphics ( hdc );
FontFamily fontFamily ( L"Times New Roman" );
Font font ( &fontFamily, 16, FontStyleItalic, UnitPixel );
SolidBrush solidBrush_1 ( Color ( 255, 255, 0, 0 ) );//Vermelho
SolidBrush solidBrush_2 ( Color ( 255, 0, 0, 255 ) );//Azul
SolidBrush solidBrush_3 ( Color ( 255, 0, 0, 0 ) );//Preto
graphics.DrawString ( L"Por:", 4, &font, PointF ( 160.0f, 240.0f ), &solidBrush_1 );
graphics.DrawString ( L"Samuel Lima", 12, &font, PointF ( 195.0f, 240.0f ), &solidBrush_2 );
graphics.DrawString ( L"sa_sp10@hotmail.com", 20, &font, PointF ( 160.0f, 255.0f ), &solidBrush_3 );
}
//=============================================================================