powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / C++ [игнор отключен] [закрыт для гостей] / контрол Picture
1 сообщений из 1, страница 1 из 1
контрол Picture
    #33729278
Санька2
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Visual C++ 6.0
Project MDI

На всё окно вывожу картинку
clouds.bmp
( плывущие облака)
Как только изменю рахмер окна
Картинка исчезает.
Как избежать этого, т.е. исчезновение картинки.

Код находится в классе вида,
вызывю через пункт меню.

Если это в WM_SIZE, то какой код
Должен быть?

CDC* pDC = GetDC();
CMy_MDI5Doc * pDoc = GetDocument();
ASSERT_VALID(pDoc);

// Load IDB_BITMAP1 from the resources.
CBitmap bmp;
if (bmp.LoadBitmap(IDB_BITMAP6))
{
// Get the size of the bitmap.
BITMAP bmpInfo;
bmp.GetBitmap(&bmpInfo);

// Create an in-memory device context compatible with the
// display device context that is used to paint.
CDC dcMemory;
dcMemory.CreateCompatibleDC(pDC);

// Select the bitmap into the in-memory device context.
CBitmap* pOldBitmap = dcMemory.SelectObject(&bmp);

// Find a center point for the bitmap in the client area.
CRect rect;
GetClientRect(&rect);
int nX = rect.left + (rect.Width() - bmpInfo.bmWidth) / 2;
int nY = rect.top + (rect.Height() - bmpInfo.bmHeight) / 2;

// Copy the bits from the in-memory device context to the on-
// screen device context to do the painting. Use the computed center
// point for the target offset.
pDC->BitBlt(nX, nY, bmpInfo.bmWidth, bmpInfo.bmHeight, &dcMemory,
0, 0, SRCCOPY);

dcMemory.SelectObject(pOldBitmap);
}

СПАСИБО
...
Рейтинг: 0 / 0
1 сообщений из 1, страница 1 из 1
Форумы / C++ [игнор отключен] [закрыт для гостей] / контрол Picture
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]