短视频带货源码,观看视频时双击放大
短视频带货源码,观看视频时双击放大实现的相关代码
1.在播放视频的DIALOG里面获取当前播放框
CRect curRect;
GetClientRect(&curRect);
2.确定当前需要放大的倍数,确定放大后的框长和宽(z为倍数)。
normalWidth = curRect.right;
normalHeight = curRect.bottom;
amplifyWidth = curRect.right * z;
amplifyHeight = curRect.bottom * z;
else
{
if (point.x<normalWidth / 2*z)
{
if (point.y < normalHeight / 2*z || point.y>normalHeight - normalHeight / 2*z)
{
if (point.y<normalHeight / 2*z)
{
MoveWindow(0, 0, amplifyWidth, amplifyHeight);
}
else
{
MoveWindow(0, -(amplifyHeight - normalHeight), amplifyWidth, amplifyHeight);
}
}
else
{
MoveWindow(0, -point.y * z+0.5*normalHeight, amplifyWidth, amplifyHeight);
}
}
else if (point.x>normalWidth - normalWidth / 2*z)
{
if (point.y < normalHeight / 2*z || point.y>normalHeight - normalHeight / 2*z)
{
if (point.y<normalHeight / 2*z)
{
MoveWindow(-(amplifyWidth - normalWidth), 0, amplifyWidth, amplifyHeight);
}
else
{
MoveWindow(-(amplifyWidth - normalWidth), -(amplifyHeight - normalHeight), amplifyWidth, amplifyHeight);
}
}
else
{
MoveWindow(-(amplifyWidth - normalWidth), -point.y * z+0.5*normalHeight, amplifyWidth, amplifyHeight);
}
}
else if (point.y<normalHeight / 2*z)
{
MoveWindow(-point.x * z+0.5*normalWidth, 0, amplifyWidth, amplifyHeight);
}
else
{
MoveWindow(-point.x * z+0.5*normalWidth, -(amplifyHeight - normalHeight), amplifyWidth, amplifyHeight);
}
3.到这里逻辑性的代码基本上就结束了。如果要进行放大,以及放大还原。那就在外面套一层if判断。
if (isZoom==false)
{
isZoom=true;
········
}
else
{
MoveWindow(0,0,normalWidth,normalHeight);
isZoom = false;
}
以上就是 短视频带货源码,观看视频时双击放大实现的相关代码,更多内容欢迎关注之后的文章