in AliRTC2.5/Windows/MFC Demo/RtcSample/RtcSampleDlg.cpp [187:226]
void CRtcSampleDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // 用于绘制的设备上下文
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
// 使图标在工作区矩形中居中
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// 绘制图标
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CPaintDC dc(this);
if (!m_Img.IsNull())
m_Img.Destroy();
CString strPicPath = ObtainFilePath() + "CONFIG\\LOGO.png";
m_Img.Load(strPicPath.GetBuffer(0)); //load载入,否则不显示
TransparentPNG(&m_Img); //调用透明化处理函数
CRect rect;
GetClientRect(&rect);
int iHeight = rect.Width() / 2 - m_Img.GetWidth() / 2;
if (!m_Img.IsNull()) m_Img.Draw(dc.m_hDC, iHeight, 28); //以左上角为原点,按原始大小,在(80,20)处贴图
CDialogEx::OnPaint();
}
}