我想通过代码更改 windows mobile 6.5 中的相机分辨率。但它不起作用我的代码片段如下。
CameraCaptureDialog cameraCaptureDialog = new CameraCaptureDialog();
cameraCaptureDialog.Owner = this;
cameraCaptureDialog.Resolution = new Size(800, 600);
我想通过代码更改 windows mobile 6.5 中的相机分辨率。但它不起作用我的代码片段如下。
CameraCaptureDialog cameraCaptureDialog = new CameraCaptureDialog();
cameraCaptureDialog.Owner = this;
cameraCaptureDialog.Resolution = new Size(800, 600);
这是我用来启动 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 类给出的现有分辨率常量。
如前所述,注册表中应该有一个受支持的决议列表。在另一个代码中,我使用以下代码来获取已知的资源:
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 实施。
~约瑟夫