Witam,
Mam następujący problem. Napisałem program, którego zadaniem jest rejestracja obrazu ekranu. W tym celu skorzystałem z klasy Microsoft.Expression.Encoder.ScreenCapture. Dla pierwszego ekranu (laptop) wszystko działa poprawnie. Tworzy się plik *.xesc z zarejestrowanym obrazem. Natomiast dla drugiego ekranu (dołączony monitor) obraz co prawda zostaje zarejestrowany, jednak po otwarciu pliku okazuje się, że nagrany obraz ekranu jest pomniejszony i zajmuje tylko część pełnego pola obrazu. Czy ktoś wie co można zrobić, żeby w tym przypadku obraz ekranu również zajął cały obszar obrazu video? Poniżej wklejam metody napisane przeze mnie dla celów rejestracji obrazu:
public bool StartRecording
{
get
{
return startrecording;
}
set
{
if (RecordingInOperation)
{
StopRecording = true;
}
startrecording = value;
if (Directory.Exists(DirectoryPath.Substring(0, DirectoryPath.IndexOf("\\") + 1)) && value && !this.StopRecording)
{
try
{
job = new ScreenCaptureJob();
Rectangle Resolution = Screen.AllScreens[ScreenID].Bounds;
int offset = 0;
for (int i = 0; i < ScreenID; i++)
{
offset += Screen.AllScreens[i].Bounds.Width;
}
job.ScreenCaptureVideoProfile.Quality = this.Quality;
job.ScreenCaptureVideoProfile.FrameRate = this.FrameRate;
ConstantBitrate b = new ConstantBitrate(this.BitRate);
job.ScreenCaptureVideoProfile.Bitrate = b;
// Sets the top right coordinates of the capture rectangle
int topRightX = offset;
int topRightY = 0;
// Sets the bottom left coordinates of the capture rectangle
int BottomLeftX = topRightX + Resolution.Width;
int BottomLeftY = topRightY + Resolution.Height;
//job.CaptureRectangle = new Rectangle(topRightX, topRightY, BottomLeftX, BottomLeftY);
job.CaptureRectangle = new Rectangle(topRightX, topRightY, BottomLeftX, BottomLeftY);
job.ScreenCaptureVideoProfile.AutoFit = true;
job.ShowFlashingBoundary = false;
job.OutputScreenCaptureFileName = DirectoryPath + @"\" + FileNamePrefix + "_" + DateTime.Now.Year.ToString("0000") + DateTime.Now.Month.ToString("00") + DateTime.Now.Day.ToString("00") + "_" + DateTime.Now.Hour.ToString("00") + DateTime.Now.Minute.ToString("00") + DateTime.Now.Second.ToString("00") + ".xesc";
job.Start();
startTim = DateTime.Now;
recording = true;
try
{
RecordingStatusChanged();
}
catch (Exception)
{
}
}
catch (Exception)
{
throw;
}
this.StartRecording = false;
}
}
}
public bool StopRecording
{
get
{
return stoprecording;
}
set
{
stoprecording = value;
if (value && !this.StartRecording)
{
try
{
recording = false;
job.Stop();
try
{
RecordingStatusChanged();
}
catch (Exception)
{
}
}
catch(Exception)
{
throw;
}
this.StopRecording = false;
}
}
}
mad_penguin