2

.NET 4.0 を使用して Windows エクスプローラー用のカスタム プロパティ ハンドラーを実装しました。複数の値を持つ列が「;」で区切られた同じ行に表示されることを除いて、すべてが機能しています。drawControl のコントロール属性を Default、MultiLineText、MultiValueText に設定しようとしましたが、うまくいきません。私が達成したいのは、「;」で区切るのではなく、各値を別々の行に入れることです。

登録した propdesc ファイルの propertyDescription は次のとおりです。

<propertyDescription name="Test.Property" formatID="{A5D0A4B0-EC4D-43DA-86F6-55448D9E9430}" propID="555">
  <description>Description</description>
  <searchInfo inInvertedIndex="True" isColumn="True" columnIndexType="OnDisk"/>
  <typeInfo type="Any" multipleValues="True" isViewable="True" isQueryable="True" isInnate="False"/>
  <labelInfo label="Test Property"/>
  <displayInfo displayType="String" mnemonics="testproperty">
    <drawControl control="MultiLineText" />
  </displayInfo>
</propertyDescription>

IPropertyStore インターフェイスの GetValue メソッドの実装を次に示します。

[DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true)]
    internal static extern void InitPropVariantFromStringVector([In, Out] string[] prgsz, uint cElems, out PropVariant ppropvar);

public int GetValue(ref PropertyKey key, out PropVariant pv)
{

    pv = new PropVariant();
    pv.variantType = (short)(VarEnum.VT_VECTOR | VarEnum.VT_LPWSTR);
    string[] stringArray = new string[] { "Test1", "Test2" };
    InitPropVariantFromStringVector(stringArray, (uint)stringArray.Length, out pv);
    return HR_OK;
}
4

0 に答える 0