⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wincreat.c

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
    ShowWindow( *screentxt, SW_NORMAL );
    UpdateWindow( *screentxt );
    SendMessage( *screentxt, WM_SETFONT, (DWORD) SmallFont, 0L );

    *inversetxt = CreateWindow(
            "STATIC",                   /* Window class name */
            "",
            SS_RIGHT | WS_CHILD | WS_VISIBLE,   /* control styles       */
            LINE1X,                             /* Initial X position */
            LINE2Y,                             /* Initial Y position */
            LINE_WIDTH,                         /* Initial X size */
            TEXTHEIGHT,                         /* Initial Y size */
            hpar,                               /* Parent window handle */
            (HMENU)NULL,                        /* Window menu handle */
            Instance,                           /* Program instance handle */
            NULL);                              /* Create parameters */

    ShowWindow( *inversetxt, SW_NORMAL );
    UpdateWindow( *inversetxt );
    SendMessage( *inversetxt, WM_SETFONT, (DWORD) SmallFont, 0L );

    text = IEAllocRCString( WIE_DRAWTEXT );
    if( text ) {
        SetWindowText( hwnd1, text );
        IEFreeRCString( text );
    } else {
        SetWindowText( hwnd1, "Draw:" );
    }
    text = IEAllocRCString( WIE_FILLTEXT );
    if( text ) {
        SetWindowText( hwnd2, text );
        IEFreeRCString( text );
    } else {
        SetWindowText( hwnd2, "Fill:" );
    }
} /* Win_CreateColourCtrls */

/*
 * WinNewDrawPad - This function creates a new drawing pad for Windows ver.
 */
HWND WinNewDrawPad( img_node *node )
{
    MDICREATESTRUCT     mdicreate;
    short               y_adjustment;
    short               x_adjustment;
    short               pad_x;
    short               pad_y;
    int                 i;
    img_node            *temp;
    POINT               origin;
    char                filename[ _MAX_PATH ];
    HWND                drawarea;
    HMENU               sys_menu;

    node->viewhwnd = CreateViewWin( node->width, node->height );
    pad_x = 0;
    pad_y = 0;

    temp = node->nexticon;

    for(i=1; i < node->num_of_images; ++i) {
        temp->viewhwnd = node->viewhwnd;
        temp = temp->nexticon;
    }

    if (node->imgtype == BITMAP_IMG) {
        mdicreate.szClass = DrawAreaClassB;
    } else if (node->imgtype == ICON_IMG) {
        mdicreate.szClass = DrawAreaClassI;
    } else {
        mdicreate.szClass = DrawAreaClassC;
    }

    GetFnameFromPath( node->fname, filename );
    mdicreate.szTitle = filename;
    mdicreate.hOwner = Instance;

    x_adjustment = (short)(2 * GetSystemMetrics( SM_CXFRAME ));
    y_adjustment = (short)(2 * GetSystemMetrics( SM_CYFRAME ) + GetSystemMetrics( SM_CYCAPTION ) - 1);

    origin.x = 0;
    origin.y = 0;
    FindOrigin( &origin );
    CalculateDims( node->width, node->height, &pad_x, &pad_y );

    mdicreate.cx = x_adjustment + pad_x;
    mdicreate.cy = y_adjustment + pad_y;
    mdicreate.x = origin.x;
    mdicreate.y = origin.y;
    mdicreate.style = WS_BORDER | WS_CAPTION | WS_SYSMENU | WS_VISIBLE |
                        WS_CLIPSIBLINGS | WS_DLGFRAME | WS_MINIMIZEBOX |
                        WS_THICKFRAME;
    mdicreate.lParam = (LPARAM)(LPVOID)node;

    drawarea = (HWND)SendMessage( ClientWindow, WM_MDICREATE, 0,
                                        (LPARAM)(LPVOID)(&mdicreate) );

    if( drawarea != (HWND)NULL ) {
        RECT    rect;
        int     w,h;
        _wpi_getclientrect( drawarea, &rect );
        w = _wpi_getwidthrect( rect );
        h = _wpi_getheightrect( rect );
        if( w != pad_x || h != pad_y ) {
            GetWindowRect( drawarea, &rect );
            w = _wpi_getwidthrect( rect ) + ( pad_x - w );
            h = _wpi_getheightrect( rect ) + ( pad_y - h );
            SetWindowPos( drawarea, HWND_TOP, 0, 0, w, h,
                          SWP_SIZE | SWP_NOZORDER | SWP_NOMOVE );
        }
    }

    if( ImgedIsDDE ) {
        sys_menu = GetSystemMenu( drawarea, FALSE );
        if( sys_menu != (HMENU)NULL ) {
            EnableMenuItem( sys_menu, SC_CLOSE, MF_GRAYED );
        }
    }

    BlowupImage( NULL, NULL );
    return( drawarea );
} /* WinNewDrawPad */

/*
 * WinCreateViewWin - creates the view window for the windows version
 */
HWND WinCreateViewWin( HWND hviewwnd, BOOL foneview, int *showstate,
                                                    int width, int height )
{
    HWND        hwnd;
    RECT        location;
    int         x,y;
    int         h_adj;
    int         v_adj;

    if ((hviewwnd) && (foneview)) {
        GetWindowRect( hviewwnd, &location );
        x = location.left;
        y = location.top;
    } else {
        x = ImgedConfigInfo.view_xpos;
        y = ImgedConfigInfo.view_ypos;
    }

    width += 2*BORDER_WIDTH;
    height += 2*BORDER_WIDTH;

    h_adj = 2*GetSystemMetrics(SM_CXDLGFRAME);
    v_adj = 2*GetSystemMetrics(SM_CYDLGFRAME) +
#ifndef __NT__
                GetSystemMetrics(SM_CYCAPTION) - 1;
#else
                GetSystemMetrics(SM_CYSMCAPTION) - 1;
#endif

#ifndef __NT__
    hwnd = CreateWindow(
            ViewWinClass,                       /* Window class name */
            "View",
            WS_POPUPWINDOW | WS_CAPTION |
            WS_VISIBLE | WS_CLIPSIBLINGS |
            WS_DLGFRAME,                        /* Window style */
            x,                                  /* Initial X position */
            y,                                  /* Initial Y position */
            h_adj + width,
            v_adj + height,
            HMainWindow,                        /* Parent window handle */
            (HMENU) NULL,                       /* Window menu handle */
            Instance,                           /* Program instance handle */
            NULL);                              /* Create parameters */
#else
    hwnd = CreateWindowEx(
            WS_EX_TOOLWINDOW,
            ViewWinClass,                       /* Window class name */
            "View",
            WS_POPUPWINDOW | WS_CAPTION |
            WS_VISIBLE | WS_CLIPSIBLINGS |
            WS_DLGFRAME,                        /* Window style */
            x,                                  /* Initial X position */
            y,                                  /* Initial Y position */
            h_adj + width,
            v_adj + height,
            HMainWindow,                        /* Parent window handle */
            (HMENU) NULL,                       /* Window menu handle */
            Instance,                           /* Program instance handle */
            NULL);                              /* Create parameters */
#endif
    ShowWindow( hwnd, SW_HIDE );

    if( hwnd != (HWND)NULL ) {
        RECT    rect;
        int     w,h;
        _wpi_getclientrect( hwnd, &rect );
        w = _wpi_getwidthrect( rect );
        h = _wpi_getheightrect( rect );
        if( w < width || h < height ) {
            GetWindowRect( hwnd, &rect );
            w = _wpi_getwidthrect( rect ) + ( width - w );
            h = _wpi_getheightrect( rect ) + ( height - h );
            SetWindowPos( hwnd, HWND_TOP, 0, 0, w, h,
                          SWP_SIZE | SWP_NOZORDER | SWP_NOMOVE );
        }
    }

    if ( ImgedConfigInfo.show_state & SET_SHOW_VIEW ) {
        *showstate = SW_SHOWNORMAL;
    } else {
        *showstate = SW_HIDE;
    }
    return( hwnd );
} /* WinCreateViewWin */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -