Panel użytkownika
Nazwa użytkownika:
Hasło:
Nie masz jeszcze konta?

[WinAPI] GroupBoxy

Ostatnio zmodyfikowano 2011-11-13 21:33
Autor Wiadomość
yoogi
Temat założony przez niniejszego użytkownika
[WinAPI] GroupBoxy
» 2011-11-13 17:06:19
Witam, mam w kodzie kilka kontrolek i zrobiłem sobie parę GroupBoxów, ale 3 ostatnie się w ogóle nie wyświetlają. Albo je coś przykrywa albo nie wiem co jest nie tak, miał ktoś podobny problem ?
P-43950
pekfos
» 2011-11-13 17:35:39
Pewnie GroupBox jest za mały.
P-43951
yoogi
Temat założony przez niniejszego użytkownika
» 2011-11-13 17:45:22
Zrobiłem 2 zakładki, i jak zmienię żeby się wyświetlało na innej to się wyświetla
P-43952
pekfos
» 2011-11-13 18:02:33
to kod daj
P-43953
yoogi
Temat założony przez niniejszego użytkownika
» 2011-11-13 18:11:00
C/C++
HWND hWnd = CreateWindowEx( 0, "App", "Aplitaction", WS_SYSMENU, 50, 50, 800, 600, 0, 0, hInst, 0 );

hButton1 = CreateWindowEx( 0, WC_BUTTON, "1", WS_CHILD | WS_VISIBLE, 10, 120, 170, 40, hWnd,( HMENU ) 1, hInst, 0 );
hButton2 = CreateWindowEx( 0, WC_BUTTON, "2", WS_CHILD | WS_VISIBLE, 10, 170, 170, 40, hWnd,( HMENU ) 2, hInst, 0 );
hButton3 = CreateWindowEx( 0, WC_BUTTON, "3", WS_CHILD | WS_VISIBLE, 10, 220, 170, 40, hWnd,( HMENU ) 3, hInst, 0 );
hButton4 = CreateWindowEx( 0, WC_BUTTON, "4", WS_CHILD | WS_VISIBLE, 10, 270, 170, 40, hWnd,( HMENU ) 4, hInst, 0 );
hButton5 = CreateWindowEx( 0, WC_BUTTON, "5", WS_CHILD | WS_VISIBLE, 10, 320, 170, 40, hWnd,( HMENU ) 5, hInst, 0 );

hButton6 = CreateWindowEx( 0, WC_BUTTON, "Zastosuj", WS_CHILD | WS_VISIBLE, 685, 530, 90, 28, hWnd,( HMENU ) 6, hInst, 0 );

hRadio1 = CreateWindowEx( 0, WC_BUTTON, "1", WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON | WS_CLIPSIBLINGS | WS_GROUP, 285, 70, 100, 20, hWnd,( HMENU ) 11, hInst, 0 );
hRadio2 = CreateWindowEx( 0, WC_BUTTON, "2", WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON | WS_CLIPSIBLINGS, 285, 90, 100, 20, hWnd,( HMENU ) 12, hInst, 0 );
hRadio3 = CreateWindowEx( 0, WC_BUTTON, "3", WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON | WS_CLIPSIBLINGS | WS_GROUP, 410, 320, 100, 20, hWnd,( HMENU ) 13, hInst, 0 );
hRadio4 = CreateWindowEx( 0, WC_BUTTON, "4", WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON | WS_CLIPSIBLINGS, 410, 370, 100, 20, hWnd,( HMENU ) 14, hInst, 0 );

hGroup1 = CreateWindowEx( 0, WC_BUTTON, "1", WS_CHILD | WS_VISIBLE | BS_GROUPBOX | WS_CLIPSIBLINGS, 275, 45, 150, 100, hWnd,( HMENU ) 100, hInst, 0 );
hGroup2 = CreateWindowEx( 0, WC_BUTTON, "2", WS_CHILD | WS_VISIBLE | BS_GROUPBOX | WS_CLIPSIBLINGS, 25, 210, 400, 300, hWnd,( HMENU ) 101, hInst, 0 );
hGroup3 = CreateWindowEx( 0, WC_BUTTON, "3", WS_CHILD | WS_VISIBLE | BS_GROUPBOX | WS_CLIPSIBLINGS, 15, 35, 760, 485, hWnd,( HMENU ) 102, hInst, 0 );
hGroup4 = CreateWindowEx( 0, WC_BUTTON, "4", WS_CHILD | WS_VISIBLE | BS_GROUPBOX | WS_CLIPSIBLINGS, 300, 65, 100, 100, hWnd,( HMENU ) 103, hInst, 0 );
hGroup5 = CreateWindowEx( 0, WC_BUTTON, "5", WS_CHILD | WS_VISIBLE | BS_GROUPBOX | WS_CLIPSIBLINGS, 660, 65, 100, 100, hWnd,( HMENU ) 104, hInst, 0 );
hGroup6 = CreateWindowEx( 0, WC_BUTTON, "6", WS_CHILD | WS_VISIBLE | BS_GROUPBOX | WS_CLIPSIBLINGS, 400, 100, 100, 100, hWnd,( HMENU ) 105, hInst, 0 );

hEdit1 = CreateWindowEx( WS_EX_CLIENTEDGE, WC_EDIT, 0, WS_CHILD | WS_VISIBLE, 175, 297, 50, 20, hWnd, 0, hInst, 0 );
hEdit2 = CreateWindowEx( WS_EX_CLIENTEDGE, WC_EDIT, 0, WS_CHILD | WS_VISIBLE, 325, 347, 50, 20, hWnd, 0, hInst, 0 );

hStatic1 = CreateWindowEx( 0, "STATIC", NULL, WS_CHILD | WS_VISIBLE | SS_LEFT, 50, 300, 119, 20, hWnd, NULL, hInst, NULL ); SetWindowText( hStatic1, "1" );
hStatic2 = CreateWindowEx( 0, "STATIC", NULL, WS_CHILD | WS_VISIBLE | SS_LEFT, 230, 300, 40, 20, hWnd, NULL, hInst, NULL ); SetWindowText( hStatic2, "2" );
hStatic3 = CreateWindowEx( 0, "STATIC", NULL, WS_CHILD | WS_VISIBLE | SS_LEFT, 47, 350, 130, 20, hWnd, NULL, hInst, NULL ); SetWindowText( hStatic3, "3" );
hStatic4 = CreateWindowEx( 0, "STATIC", NULL, WS_CHILD | WS_VISIBLE | SS_LEFT, 387, 350, 20, 20, hWnd, NULL, hInst, NULL ); SetWindowText( hStatic4, "4" );

hCheck1 = CreateWindowEx( 0, "BUTTON", "1", WS_CHILD | WS_VISIBLE | BS_CHECKBOX, 100, 100, 150, 30, hWnd, NULL, hInst, NULL );
hCheck2 = CreateWindowEx( 0, "BUTTON", "2", WS_CHILD | WS_VISIBLE | BS_CHECKBOX, 100, 150, 150, 30, hWnd, NULL, hInst, NULL );

bar = CreateWindowEx( 0, PROGRESS_CLASS, NULL, WS_CHILD | WS_VISIBLE | PBS_SMOOTH, 20, 420, 400, 17, hWnd, NULL, hInst, NULL );
SendMessage( bar, PBM_SETRANGE, 0,( LPARAM ) MAKELONG( 0, 400 ) );
SendMessage( bar, PBM_SETSTEP, 0, 0 );



INITCOMMONCONTROLSEX InitCtrlEx;
InitCtrlEx.dwSize = sizeof( INITCOMMONCONTROLSEX );
InitCtrlEx.dwICC = ICC_BAR_CLASSES;
InitCommonControlsEx( & InitCtrlEx );

hTrackBar = CreateWindowEx( 0, TRACKBAR_CLASS, NULL, WS_CHILD | WS_VISIBLE | TBS_FIXEDLENGTH | TBS_NOTICKS, 170, 347, 150, 25, hWnd,( HMENU ) 200, hInst, NULL );
SendMessage( hTrackBar, TBM_SETRANGE, TRUE, MAKELONG( 0, 100 ) );
SendMessage( hTrackBar, TBM_SETPAGESIZE, 0, 20 );
SendMessage( hTrackBar, TBM_SETTICFREQ, 20, 0 );
SendMessage( hTrackBar, TBM_SETPOS, TRUE, 50 );



hTab = CreateWindowEx( 0, WC_TABCONTROL, 0, WS_CHILD | WS_VISIBLE | TCS_FIXEDWIDTH, 5, 5, 785, 563, hWnd,( HMENU ) 10, hInst, NULL );
TabCtrl_SetItemSize( hTab, 100, 20 );
TCITEM tci1, tci2;
tci1.mask = TCIF_TEXT;
tci2.mask = TCIF_TEXT;
tci1.pszText = "Ogólne";
tci2.pszText = "Opcję";
tci1.cchTextMax = sizeof( "Ogólne" );
tci2.cchTextMax = sizeof( "Opcję" );
TabCtrl_InsertItem( hTab, 0, & tci1 );
TabCtrl_InsertItem( hTab, 1, & tci2 );

C/C++
void SetFonts( HWND hwc )
{
    HFONT hFont =( HFONT ) GetStockObject( DEFAULT_GUI_FONT );
    //HFONT hFont=CreateFont(10,4,0,0,0,0,0,0,0,0,0,0,0,"MS Sans Serif");
    SendMessage( hwc, WM_SETFONT,( WPARAM ) hFont, 0 );
}

C/C++
SetFonts( hButton1 );
SetFonts( hButton2 );
SetFonts( hButton3 );
SetFonts( hButton4 );
SetFonts( hButton5 );

SetFonts( hButton6 );

SetFonts( hEdit1 );
SetFonts( hEdit2 );

SetFonts( hRadio1 );
SetFonts( hRadio2 );
SetFonts( hRadio3 );
SetFonts( hRadio4 );

SetFonts( hCheck1 );
SetFonts( hCheck2 );

SetFonts( hGroup1 );
SetFonts( hGroup2 );
SetFonts( hGroup3 );
SetFonts( hGroup4 );
SetFonts( hGroup5 );
SetFonts( hGroup6 );

SetFonts( hCombo1 );

SetFonts( hTab );

SetFonts( hStatic1 );
SetFonts( hStatic2 );
SetFonts( hStatic3 );
SetFonts( hStatic4 );

C/C++
ShowWindow( hStatic1, SW_HIDE );
ShowWindow( hStatic2, SW_HIDE );
ShowWindow( hStatic3, SW_HIDE );
ShowWindow( hStatic4, SW_HIDE );

ShowWindow( hCombo1, SW_HIDE );

ShowWindow( hEdit1, SW_HIDE );
ShowWindow( hEdit2, SW_HIDE );

ShowWindow( hGroup1, SW_HIDE );
ShowWindow( hGroup2, SW_HIDE );
ShowWindow( hGroup3, SW_HIDE );
ShowWindow( hGroup4, SW_HIDE );
ShowWindow( hGroup5, SW_HIDE );
ShowWindow( hGroup6, SW_HIDE );

ShowWindow( hButton6, SW_HIDE );

ShowWindow( hRadio1, SW_HIDE );
ShowWindow( hRadio2, SW_HIDE );
ShowWindow( hRadio3, SW_HIDE );
ShowWindow( hRadio4, SW_HIDE );

ShowWindow( hCheck1, SW_HIDE );
ShowWindow( hCheck2, SW_HIDE );

ShowWindow( hTrackBar, SW_HIDE );

ShowWindow( hWnd, nShow );

C/C++
if( msg == WM_NOTIFY )
{
    LPNMHDR n;
    n =( LPNMHDR ) lPar;
    if( n->code == TCN_SELCHANGE && n->hwndFrom == hTab )
    {
        int index = TabCtrl_GetCurSel( hTab );
        switch( index )
        {
        case 0:
            ShowWindow( hButton1, SW_SHOW );
            ShowWindow( hButton2, SW_SHOW );
            ShowWindow( hButton3, SW_SHOW );
            ShowWindow( hButton4, SW_SHOW );
            ShowWindow( hButton5, SW_SHOW );
            ShowWindow( hButton6, SW_HIDE );
           
            ShowWindow( hRadio1, SW_HIDE );
            ShowWindow( hRadio2, SW_HIDE );
            ShowWindow( hRadio3, SW_HIDE );
            ShowWindow( hRadio4, SW_HIDE );
           
            ShowWindow( hGroup1, SW_HIDE );
            ShowWindow( hGroup2, SW_HIDE );
            ShowWindow( hGroup3, SW_HIDE );
            ShowWindow( hGroup4, SW_HIDE );
            ShowWindow( hGroup5, SW_HIDE );
            ShowWindow( hGroup6, SW_HIDE );
           
            ShowWindow( hEdit1, SW_HIDE );
            ShowWindow( hEdit2, SW_HIDE );
           
            ShowWindow( hCheck1, SW_HIDE );
            ShowWindow( hCheck2, SW_HIDE );
           
            ShowWindow( hStatic1, SW_HIDE );
            ShowWindow( hStatic2, SW_HIDE );
            ShowWindow( hStatic3, SW_HIDE );
            ShowWindow( hStatic4, SW_HIDE );
           
            //ShowWindow(hCombo1,SW_HIDE);
           
            ShowWindow( hTrackBar, SW_HIDE );
           
           
            ShowWindow( bar, SW_SHOW );
           
           
            break;
        case 1:
            ShowWindow( hButton1, SW_HIDE );
            ShowWindow( hButton2, SW_HIDE );
            ShowWindow( hButton3, SW_HIDE );
            ShowWindow( hButton4, SW_HIDE );
            ShowWindow( hButton5, SW_HIDE );
            ShowWindow( hButton6, SW_SHOW );
           
            ShowWindow( hRadio1, SW_SHOW );
            ShowWindow( hRadio2, SW_SHOW );
            ShowWindow( hRadio3, SW_SHOW );
            ShowWindow( hRadio4, SW_SHOW );
           
            ShowWindow( hGroup1, SW_SHOW );
            ShowWindow( hGroup2, SW_SHOW );
            ShowWindow( hGroup3, SW_SHOW );
            ShowWindow( hGroup4, SW_SHOW );
            ShowWindow( hGroup5, SW_SHOW );
            ShowWindow( hGroup6, SW_SHOW );
           
            ShowWindow( hEdit1, SW_SHOW );
            ShowWindow( hEdit2, SW_SHOW );
           
            ShowWindow( hStatic1, SW_SHOW );
            ShowWindow( hStatic2, SW_SHOW );
            ShowWindow( hStatic3, SW_SHOW );
            ShowWindow( hStatic4, SW_SHOW );
           
            ShowWindow( hCheck1, SW_SHOW );
            ShowWindow( hCheck2, SW_SHOW );
           
            //ShowWindow(hCombo1,SW_SHOW);
           
            ShowWindow( hTrackBar, SW_SHOW );
           
            ShowWindow( bar, SW_HIDE );
           
           
           
           
            LoadValueFromReg();
            char regTimeBuf[ MAX_PATH ];
            itoa( regTime, regTimeBuf, 10 );
            SetWindowText( hEdit1, regTimeBuf );
           
            char regCompresBuf[ MAX_PATH ];
            itoa( regCompres, regCompresBuf, 10 );
            SetWindowText( hEdit2, regCompresBuf );
            SendMessage( hTrackBar, TBM_SETRANGE, TRUE, MAKELONG( 0, 100 ) );
            SendMessage( hTrackBar, TBM_SETPAGESIZE, 0, 20 );
            SendMessage( hTrackBar, TBM_SETTICFREQ, 20, 0 );
            SendMessage( hTrackBar, TBM_SETPOS, TRUE, regCompres );
           
            break;
        }
    }
}

i to by było na tyle z tego najważniejszego :)
P-43954
yoogi
Temat założony przez niniejszego użytkownika
» 2011-11-13 18:49:11
Może ja podbiję tego posta, bo nikt mi nic nie odpisuję :)
P-43958
yoogi
Temat założony przez niniejszego użytkownika
» 2011-11-13 21:33:40
Dzięki wszystkich za udzielenie się w wypowiedzi... Problem rozwiązany, pierwsze stworzone okno zawsze jest na wierzchu, a kolejne są pod nim
P-43969
« 1 »
  Strona 1 z 1