Windows Mobile 6.5中的摄像头分辨率更改

时间:2012-10-24 10:01:04

标签: .net windows-mobile-6.5

我想通过代码更改Windows Mobile 6.5中的相机分辨率。但它不起作用我的代码片段如下。

CameraCaptureDialog cameraCaptureDialog = new CameraCaptureDialog(); 
cameraCaptureDialog.Owner = this; 
cameraCaptureDialog.Resolution = new Size(800, 600);

1 个答案:

答案 0 :(得分:1)

以下是我用来启动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类给出的现有分辨率const。

如上所述,注册表中应该有一个受支持的解决方案列表。在另一个代码中,我使用以下内容来获取已知的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实施。

〜约瑟夫