Вот фрагмент, который я использую для запуска CameraCaptureDialog:
cameraDialog.Owner = this;
cameraDialog.InitialDirectory = @"\My Documents";
cameraDialog.DefaultFileName = "test.jpg";
cameraDialog.Title = "iCOMM Camera Demo";
cameraDialog.StillQuality = CameraCaptureStillQuality.Default;
cameraDialog.Mode = CameraCaptureMode.Still;
Разница в том, что я использую не свободно определенный объект Size, а существующую константу разрешения, заданную классом CameraCaptureDialog.
Как сказано, в реестре должен быть список поддерживаемых разрешений. В другом коде я использую следующее, чтобы получить известные res:
public cResolution[] getResolutions(){
cResolution[] cRes;
RegistryKey rKey = Registry.LocalMachine.OpenSubKey(regSubResolution, false);
string[] subKeys = rKey.GetSubKeyNames();
cRes = new cResolution[subKeys.Length];
int i=0;
foreach (string s in subKeys)
{
RegistryKey rKeySub = Registry.LocalMachine.OpenSubKey(regSubResolution + "\\" + s, false);
string item;
int w, h, hqfs, nqfs, lqfs, pw, ph;
item = (string)rKeySub.GetValue("ItemString");
w = (int)rKeySub.GetValue("Width");
h = (int)rKeySub.GetValue("Height");
hqfs = (int)rKeySub.GetValue("HighQualityFileSize");
lqfs = (int)rKeySub.GetValue("LowQualityFileSize");
nqfs = (int)rKeySub.GetValue("NormalQualityFileSize");
ph = (int)rKeySub.GetValue("PreviewHeight");
pw = (int)rKeySub.GetValue("PreviewWidth");
cRes[i] = new cResolution(item, h, w, pw, ph, hqfs, nqfs, lqfs);
i++;
rKeySub = null;
}
Но, как уже говорилось, это зависит от OEM-реализации камеры.
~ Йозеф
person
josef
schedule
27.10.2012