在我的应用中绘制了一个图片框,尺寸为432 * 324,位置为x = 100和y = 416。现在,我要捕获这个确切的区域/图片框。我已经做了如下。但是屏幕是在不同大小的不同位置捕获的(在屏幕截图的红色区域中显示)。谁能帮我在上述指定值上获得矩形?
简而言之,我想精确捕获具有以下值的区域:
宽度= 432,高度= 324,x = 100,y = 416
private void CaptureScreen(object sender, EventArgs e)
{
float screenScaleFactor = objGlobalFns.getScalingFactor();//1.25
int Width = 432;
int Height = 324;
int X = Convert.ToInt32(100 * screenScaleFactor);
int Y = Convert.ToInt32(416 * screenScaleFactor);
//------Code for record screen -----------//
_Screenwriter.Open(
fullName,
Width,
Height,
10, VideoCodec.MPEG4, 1000000);
Rectangle rectBounding = new Rectangle(X, Y, Width, Height);
this._streamVideo = new AForge.Video.ScreenCaptureStream(rectBounding);
}