domingo, 15 de agosto de 2021

Win32 - calculadora da lei de ohm II

 

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,
        250946020,
        hwnd, ( HMENU ) ID_EDIT_1, NULLNULL );

    Edit_2 = CreateWindowEx (
        WS_EX_CLIENTEDGE, L"EDIT"L"",
        WS_VISIBLE | WS_CHILD | WS_BORDER | ES_RIGHT,
        2501176020,
        hwnd, ( HMENU ) ID_EDIT_2, NULLNULL );

    Edit_3 = CreateWindowEx (
        WS_EX_CLIENTEDGE, L"EDIT"L"",
        WS_VISIBLE | WS_CHILD | WS_BORDER | ES_RIGHT | ES_READONLY,
        2501406020,
        hwnd, ( HMENU ) ID_EDIT_3, NULLNULL );
}
//=============================================================================
VOID Button_1 ( HWND hwnd ) {
    HWND button_1;
    button_1 = CreateWindowW ( L"button"L"Ok",
        WS_VISIBLE | WS_CHILD, 1601703019,
        hwnd, ( HMENU ) IDC_BUTTON3, NULLNULL );
}
//=============================================================================
VOID Button_2 ( HWND hwnd ) {
    HWND button_2;
    button_2 = CreateWindowW ( L"button"L"Ok",
        WS_VISIBLE | WS_CHILD, 1601703019,
        hwnd, ( HMENU ) IDC_BUTTON4, NULLNULL );
}
//=============================================================================
VOID Button_3 ( HWND hwnd ) {
    HWND button_3;
    button_3 = CreateWindowW ( L"button"L"Ok",
        WS_VISIBLE | WS_CHILD, 1601703019,
        hwnd, ( HMENU ) IDC_BUTTON5, NULLNULL );
}
//=============================================================================
VOID Button_4 ( HWND hwnd ) {
    HWND button_4;
    button_4 = CreateWindowW ( L"button"L"Ok",
        WS_VISIBLE | WS_CHILD, 1601703019,
        hwnd, ( HMENU ) IDC_BUTTON6, NULLNULL );
}
//=============================================================================
VOID Button_5 ( HWND hwnd ) {
    //HWND button_5;
    CreateWindowW ( L"button"L"Novo cálculo",
        WS_VISIBLE | WS_CHILD, 21017010019,
        hwnd, ( HMENU ) IDC_BUTTON7, NULLNULL );
}
//=============================================================================
VOID Moldura ( HDC hdc ) {
    PAINTSTRUCT ps;

    Graphics graphics ( hdc );

    Graphics* myGraphics;
    GraphicsPath myGraphicsPath;

    Pen penJoin1 ( Color ( 25502550 ), 10 );
    penJoin1.SetLineJoin ( LineJoinBevel );

    SetBkColor ( hdc, RGB ( 2550255 ) );
    graphics.DrawRectangle ( &penJoin1, Rect ( 55580280 ) );
    graphics.DrawPath ( &penJoin1, &myGraphicsPath );

    PointF pointF1 ( 120.0f10.0f );
    StringFormat myStringFormat;
    FontFamily fontFamily ( L"Times New Roman" );
    Font font ( &fontFamily, 24, FontStyleItalic, UnitPixel );

    Pen penJoin2 ( Color ( 25525500 ), 1 );
    myGraphicsPath.AddString ( L"WIN32 - CALCULADORA DA LEI DE OHM"33, &fontFamily,
        017, 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 ( 25525500 ) );//Vermelho
    SolidBrush solidBrush_2 ( Color ( 25500255 ) );//Azul
    SolidBrush solidBrush_3 ( Color ( 255000 ) );//Preto

    graphics.DrawString ( L"Por:"4, &font, PointF ( 160.0f240.0f ), &solidBrush_1 );
    graphics.DrawString ( L"Samuel Lima"12, &font, PointF ( 195.0f240.0f ), &solidBrush_2 );
    graphics.DrawString ( L"sa_sp10@hotmail.com"20, &font, PointF ( 160.0f255.0f ), &solidBrush_3 );
}
//=============================================================================

Nenhum comentário:

Postar um comentário

Observação: somente um membro deste blog pode postar um comentário.