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

📄 playlist.c

📁 VC++视频开发实例集锦(包括“远程视频监控”"语音识别系统"等13个经典例子)
💻 C
📖 第 1 页 / 共 2 页
字号:
       SelectPalette(ds->hDC, oldpal, FALSE);
       SelectObject(winmemdc, h);
       DeleteDC(winmemdc);
    */
}

#define	 MIDUP	1
#define  MIDDOWN	2
#define  MIDLEFT	3
#define  MIDRIGHT	4
#define	 CENTER		5

BOOL    playlist_skin_draw_side(HDC hdc, HDC winmemdc, BITMAP * bm,
                                RECT * winrect, int type)
{
    /*
       RECT    Siderect;
       RECT    Destrect;
       int     mode;
       switch (type) {

       case MIDUP:
    Siderect.left = PlayListBitmap.UpLeft.cx;
    Siderect.top = 0;
    Siderect.right = bm->bmWidth - PlayListBitmap.UpRight.cx;
    Siderect.bottom = PlayListBitmap.UpMid.cx;

    Destrect.left = PlayListBitmap.UpLeft.cx;
    Destrect.top = 0;
    Destrect.right = winrect->right - (PlayListBitmap.UpRight.cx);
    Destrect.bottom = PlayListBitmap.UpMid.cx;
    mode = PlayListBitmap.UpMid.cy;
    break;
       case MIDDOWN:
    Siderect.left = PlayListBitmap.DownLeft.cx;
    Siderect.top = bm->bmHeight - PlayListBitmap.DownMid.cx;
    Siderect.right = bm->bmWidth - PlayListBitmap.DownRight.cx;
    Siderect.bottom = bm->bmHeight;

    Destrect.left = PlayListBitmap.DownLeft.cx;
    Destrect.top = winrect->bottom - (PlayListBitmap.DownMid.cx);
    Destrect.right = winrect->right - (PlayListBitmap.DownRight.cx);
    Destrect.bottom = winrect->bottom;
    mode = PlayListBitmap.DownMid.cy;

    break;

       case MIDLEFT:
    Siderect.left = 0;
    Siderect.top = PlayListBitmap.UpLeft.cy;
    Siderect.right = PlayListBitmap.LeftMid.cx;
    Siderect.bottom = bm->bmHeight - PlayListBitmap.DownLeft.cy;

    Destrect.left = 0;
    Destrect.top = PlayListBitmap.UpLeft.cy;
    Destrect.right = PlayListBitmap.LeftMid.cx;
    Destrect.bottom = winrect->bottom - PlayListBitmap.DownLeft.cy;
    mode = PlayListBitmap.LeftMid.cy;

    break;

       case MIDRIGHT:
    Siderect.left = bm->bmWidth - (PlayListBitmap.RightMid.cx);
    Siderect.top = PlayListBitmap.UpRight.cy;
    Siderect.right = bm->bmWidth;
    Siderect.bottom = bm->bmHeight - PlayListBitmap.DownRight.cy;

    Destrect.left = winrect->right - PlayListBitmap.RightMid.cx;
    Destrect.top = PlayListBitmap.UpRight.cy;
    Destrect.right = winrect->right;
    Destrect.bottom = winrect->bottom - PlayListBitmap.DownRight.cy;
    mode = PlayListBitmap.RightMid.cy;
    break;

       case CENTER:
    Siderect.left = PlayListBitmap.LeftMid.cx;
    Siderect.top = PlayListBitmap.UpMid.cx;
    Siderect.right = bm->bmWidth - PlayListBitmap.RightMid.cx;
    Siderect.bottom = bm->bmHeight - PlayListBitmap.DownMid.cx;

    Destrect.left = PlayListBitmap.LeftMid.cx;
    Destrect.top = PlayListBitmap.UpMid.cx;
    Destrect.right = winrect->right - PlayListBitmap.RightMid.cx;;
    Destrect.bottom = winrect->bottom - PlayListBitmap.DownMid.cx;

    mode = 1;

    break;
       }

       if (mode == 1) {
    StretchBlt(hdc,		// handle to destination DC
    	   Destrect.left,	// x-coord of destination upper-left corner
    	   Destrect.top,	// y-coord of destination upper-left corner
    	   Destrect.right - Destrect.left,	// width of destination rectangle
    	   Destrect.bottom - Destrect.top,	// height of destination rectangle
    	   winmemdc,	// handle to source DC
    	   Siderect.left,	// x-coord of source upper-left corner
    	   Siderect.top,	// y-coord of source upper-left corner
    	   Siderect.right - Siderect.left,	// width of source rectangle
    	   Siderect.bottom - Siderect.top,	// height of source rectangle
    	   SRCCOPY	// raster operation code
        );

       } else {
    //      Figure out when our last images will be drawn.
    int     nEndCol =
        (Destrect.right - Destrect.left) / (Siderect.right -
    					Siderect.left) + 1;
    int     nEndRow =
        (Destrect.bottom - Destrect.top) / (Siderect.bottom -
    					Siderect.top) + 1;
    int     nCol, nRow;

    //
    //      We would use clipping when the tiling is used as a background bitmap.
    //      This would substantially reduce the number of BitBlt's we do.

    for (nCol = 0; nCol < nEndCol; nCol++) {
        int     xcount, xrest = 0;
        xcount =
    	(Destrect.right - Destrect.left) -
    	((Siderect.right - Siderect.left) * (nCol + 1));
        if (xcount < 0)
    	xrest = xcount;
        for (nRow = 0; nRow < nEndRow; nRow++) {
    	int     ycount, yrest = 0;
    	ycount =
    	    (Destrect.bottom - Destrect.top) -
    	    ((nRow + 1) * (Siderect.bottom - Siderect.top));
    	if (ycount < 0)
    	    yrest = ycount;
    	BitBlt(hdc,
    	       Destrect.left +
    	       ((Siderect.right - Siderect.left) *
    		nCol),
    	       Destrect.top +
    	       ((Siderect.bottom - Siderect.top) *
    		nRow),
    	       Siderect.right - Siderect.left + xrest,
    	       Siderect.bottom - Siderect.top + yrest,
    	       winmemdc, Siderect.left, Siderect.top, SRCCOPY);
        }
    }

       }
    */
    return TRUE;
}
//
//
//
LRESULT CALLBACK playlist_windowproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
    /*
       switch (msg) 
    {
       case WM_ERASEBKGND:
    	if(!PlayListBitmap.UpLeft.cx)
    		return FALSE;
    	else
    		return TRUE;
       case WM_PAINT:
    	{
    		HDC     winhdc, winmemdc;
    		HBITMAP h;
    		BITMAP  bm;
    		HPALETTE oldpal;
    		PAINTSTRUCT Paint;
    		RECT    winrect;
    		RECT    Listviewrect;
    		if (!PlayListBitmap.UpLeft.cx)
    		break;
    		winhdc = BeginPaint(hwndDlg, &Paint);

    		GetClientRect(hwndDlg, &winrect);
    		GetWindowRect(windows.m_hWndPlaylist_ListView, &Listviewrect);

    		Listviewrect.right -= Listviewrect.left;
    		Listviewrect.bottom -= Listviewrect.top;

    		ScreenToClient(hwndDlg, (LPPOINT) & Listviewrect);

    		Listviewrect.right += Listviewrect.left;
    		Listviewrect.bottom += Listviewrect.top;

    		ExcludeClipRect(winhdc, Listviewrect.left, Listviewrect.top,
    				Listviewrect.right, Listviewrect.bottom);

    		winmemdc = CreateCompatibleDC(winhdc);
    		GetObject(graphics.bmp_playlist_bg, sizeof(bm), &bm);
    		h = (HBITMAP) SelectObject(winmemdc, graphics.bmp_playlist_bg);
    		oldpal = SelectPalette(winhdc, graphics.pal_main, FALSE);
    		RealizePalette(winhdc);
    		BitBlt(winhdc, 0, 0, PlayListBitmap.UpLeft.cx,
    		   PlayListBitmap.UpLeft.cy, winmemdc, 0, 0, SRCCOPY);
    		playlist_skin_draw_side(winhdc, winmemdc, &bm, &winrect,
    					MIDUP);
    		BitBlt(winhdc, winrect.right - (PlayListBitmap.UpRight.cx), 0,
    		   PlayListBitmap.UpRight.cx, PlayListBitmap.UpRight.cy,
    		   winmemdc, bm.bmWidth - PlayListBitmap.UpRight.cx, 0,
    		   SRCCOPY);
    		playlist_skin_draw_side(winhdc, winmemdc, &bm, &winrect,
    					MIDLEFT);
    		playlist_skin_draw_side(winhdc, winmemdc, &bm, &winrect,
    					MIDRIGHT);
    		BitBlt(winhdc, 0, winrect.bottom - PlayListBitmap.DownLeft.cy,
    		   PlayListBitmap.DownLeft.cx, PlayListBitmap.DownLeft.cy,
    		   winmemdc, 0, bm.bmHeight - PlayListBitmap.DownLeft.cy,
    		   SRCCOPY);
    		playlist_skin_draw_side(winhdc, winmemdc, &bm, &winrect,
    					MIDDOWN);
    		BitBlt(winhdc, winrect.right - (PlayListBitmap.DownRight.cx),
    		   winrect.bottom - PlayListBitmap.DownRight.cy,
    		   PlayListBitmap.DownRight.cx,
    		   PlayListBitmap.DownRight.cy, winmemdc,
    		   bm.bmWidth - PlayListBitmap.DownRight.cx,
    		   bm.bmHeight - PlayListBitmap.DownRight.cy, SRCCOPY);
    		SelectPalette(winmemdc, oldpal, FALSE);
    		SelectObject(winmemdc, h);
    		DeleteDC(winmemdc);
    		EndPaint(hwndDlg, &Paint);
    	}
    	return 0;

       case WM_DRAWITEM:
    	playlist_draw_control(wParam, (LPDRAWITEMSTRUCT) lParam);
    	return TRUE;

       case WM_INITDIALOG:
    	windows.wnd_playlist_IPEdit = NULL;
    	playlist_skin_read();
    	return TRUE;

       case WM_SIZE:
    {
        RECT    NewPlaylistrect;
        int     moveflag;

    	InvalidateRect(windows.dlg_playlist, NULL, TRUE);
        if (wParam != SIZE_MINIMIZED) {

    	GetWindowRect(hwndDlg, &NewPlaylistrect);
    	windows.dlg_playlist = hwndDlg;
    	playlist_move_control(IDC_PLAYLIST, &NewPlaylistrect,
    			      RESIZE);

    	if (!
    	    (moveflag =
    	     GetWindowLong(GetDlgItem
    			   (hwndDlg, IDC_SORTTEXT),
    			   GWL_USERDATA))) moveflag = TOPRIGHT;
    	playlist_move_control(IDC_SORTTEXT, &NewPlaylistrect,
    			      moveflag);

    	if (!
    	    (moveflag =
    	     GetWindowLong(GetDlgItem
    			   (hwndDlg, IDC_OPENLIST),
    			   GWL_USERDATA))) moveflag = TOPRIGHT;
    	playlist_move_control(IDC_OPENLIST, &NewPlaylistrect,
    			      moveflag);

    	if (!
    	    (moveflag =
    	     GetWindowLong(GetDlgItem
    			   (hwndDlg, IDC_SAVELIST),
    			   GWL_USERDATA))) moveflag = TOPRIGHT;
    	playlist_move_control(IDC_SAVELIST, &NewPlaylistrect,
    			      moveflag);

    	if (!
    	    (moveflag =
    	     GetWindowLong(GetDlgItem(hwndDlg, IDC_CLEAR),
    			   GWL_USERDATA))) moveflag = TOPRIGHT;
    	playlist_move_control(IDC_CLEAR, &NewPlaylistrect,
    			      moveflag);

    	if (!
    	    (moveflag =
    	     GetWindowLong(GetDlgItem
    			   (hwndDlg, IDC_CLEARSEL),
    			   GWL_USERDATA))) moveflag = TOPRIGHT;
    	playlist_move_control(IDC_CLEARSEL, &NewPlaylistrect,
    			      moveflag);

    	if (!(moveflag = GetWindowLong(GetDlgItem(hwndDlg, IDC_MOVETEXT), GWL_USERDATA)))
    		moveflag = TOPRIGHT;
    	playlist_move_control(IDC_MOVETEXT, &NewPlaylistrect, moveflag);

    	if (!
    	    (moveflag =
    	     GetWindowLong(GetDlgItem
    			   (hwndDlg, IDC_MOVEUP),
    			   GWL_USERDATA))) moveflag = TOPRIGHT;
    	playlist_move_control(IDC_MOVEUP, &NewPlaylistrect,
    			      moveflag);

    	if (!
    	    (moveflag =
    	     GetWindowLong(GetDlgItem
    			   (hwndDlg, IDC_MOVEDOWN),
    			   GWL_USERDATA))) moveflag = TOPRIGHT;
    	playlist_move_control(IDC_MOVEDOWN, &NewPlaylistrect,
    			      moveflag);

    	if (!
    	    (moveflag =
    	     GetWindowLong(GetDlgItem(hwndDlg, IDOK),
    			   GWL_USERDATA))) moveflag = BOTTOMRIGHT;
    	playlist_move_control(IDOK, &NewPlaylistrect, moveflag);

    	if (!
    	    (moveflag =
    	     GetWindowLong(GetDlgItem
    			   (hwndDlg, IDC_SHUFFLE),
    			   GWL_USERDATA))) moveflag = TOPRIGHT;
    	playlist_move_control(IDC_SHUFFLE, &NewPlaylistrect,
    			      moveflag);

    	if (!
    	    (moveflag =
    	     GetWindowLong(GetDlgItem
    			   (hwndDlg, IDC_ADDDIR),
    			   GWL_USERDATA))) moveflag = TOPRIGHT;
    	playlist_move_control(IDC_ADDDIR, &NewPlaylistrect,
    			      moveflag);

    	if (!
    	    (moveflag =
    	     GetWindowLong(GetDlgItem
    			   (hwndDlg, IDC_MINIMIZE),
    			   GWL_USERDATA))) moveflag = TOPRIGHT;
    	playlist_move_control(IDC_MINIMIZE, &NewPlaylistrect,
    			      moveflag);

    	if (!
    	    (moveflag =
    	     GetWindowLong(GetDlgItem
    			   (hwndDlg, IDC_MAXIMIZE),
    			   GWL_USERDATA))) moveflag = TOPRIGHT;
    	playlist_move_control(IDC_MAXIMIZE, &NewPlaylistrect,
    			      moveflag);

    	if (!
    	    (moveflag =
    	     GetWindowLong(GetDlgItem(hwndDlg, IDC_CLOSE),
    			   GWL_USERDATA))) moveflag = TOPRIGHT;
    	playlist_move_control(IDC_CLOSE, &NewPlaylistrect,
    			      moveflag);

    	if (!
    	    (moveflag =
    	     GetWindowLong(GetDlgItem(hwndDlg, IDC_FIND),
    			   GWL_USERDATA))) moveflag = TOPRIGHT;
    	playlist_move_control(IDC_FIND, &NewPlaylistrect,
    			      moveflag);

    	GetWindowRect(hwndDlg, &globals.playlist_rect);
    	CopyRect(&options.playlist_window_pos,
    		 &globals.playlist_rect);
        }
        break;
    }

    return 0;

       }
    */
    return FALSE;
}

⌨️ 快捷键说明

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