本文整理汇总了C#中PropVariant.SetStringVector方法的典型用法代码示例。如果您正苦于以下问题:C# PropVariant.SetStringVector方法的具体用法?C# PropVariant.SetStringVector怎么用?C# PropVariant.SetStringVector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropVariant
的用法示例。
在下文中一共展示了PropVariant.SetStringVector方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateProperty
/// <summary>
/// Handles IUICommandHandler.UpdateProperty function for the supported properties
/// </summary>
/// <param name="key">The Property Key to update</param>
/// <param name="currentValue">A pointer to the current value for key. This parameter can be NULL</param>
/// <param name="newValue">When this method returns, contains a pointer to the new value for key</param>
/// <returns>Returns S_OK if successful, or an error value otherwise</returns>
public override HRESULT UpdateProperty(ref PropertyKey key, PropVariantRef currentValue, ref PropVariant newValue)
{
if (key == RibbonProperties.AutomaticColorLabel)
{
if (_automaticColorLabel != null)
{
newValue.SetString(_automaticColorLabel);
}
}
else if (key == RibbonProperties.Color)
{
if (_color.HasValue)
{
newValue.SetUInt((uint)ColorTranslator.ToWin32(_color.Value));
}
}
else if (key == RibbonProperties.ColorType)
{
if (_colorType.HasValue)
{
newValue.SetUInt((uint)_colorType.Value);
}
}
else if (key == RibbonProperties.MoreColorsLabel)
{
if (_moreColorsLabel != null)
{
newValue.SetString(_moreColorsLabel);
}
}
else if (key == RibbonProperties.NoColorLabel)
{
if (_noColorLabel != null)
{
newValue.SetString(_noColorLabel);
}
}
else if (key == RibbonProperties.RecentColorsCategoryLabel)
{
if (_recentColorsCategoryLabel != null)
{
newValue.SetString(_recentColorsCategoryLabel);
}
}
else if (key == RibbonProperties.StandardColors)
{
if (_standardColors != null)
{
int[] intStandardColors = Array.ConvertAll<Color, int>(_standardColors, new Converter<Color, int>(ColorTranslator.ToWin32));
uint[] uintStandardColors = Array.ConvertAll<int, uint>(intStandardColors, new Converter<int, uint>(Convert.ToUInt32));
newValue.SetUIntVector(uintStandardColors);
}
}
else if (key == RibbonProperties.StandardColorsCategoryLabel)
{
if (_standardColorsCategoryLabel != null)
{
newValue.SetString(_standardColorsCategoryLabel);
}
}
else if (key == RibbonProperties.StandardColorsTooltips)
{
if (_standardColorsTooltips != null)
{
newValue.SetStringVector(_standardColorsTooltips);
}
}
else if (key == RibbonProperties.ThemeColors)
{
if (_themeColors != null)
{
int[] intThemeColors = Array.ConvertAll<Color, int>(_themeColors, new Converter<Color, int>(ColorTranslator.ToWin32));
uint[] uintThemeColors = Array.ConvertAll<int, uint>(intThemeColors, new Converter<int, uint>(Convert.ToUInt32));
newValue.SetUIntVector(uintThemeColors);
}
}
else if (key == RibbonProperties.ThemeColorsCategoryLabel)
{
if (_themeColorsCategoryLabel != null)
{
newValue.SetString(_themeColorsCategoryLabel);
}
}
else if (key == RibbonProperties.ThemeColorsTooltips)
{
if (_themeColorsTooltips != null)
{
newValue.SetStringVector(_themeColorsTooltips);
}
}
return HRESULT.S_OK;
}
示例2: NullCommandUpdateProperty
//.........这里部分代码省略.........
{
string str = "Command." + ((CommandId)commandId).ToString() + ".TooltipDescription";
newValue = new PropVariant(Res.GetProp(str) ?? String.Empty);
}
else if (key == PropertyKeys.Keytip)
{
newValue = new PropVariant("XXX");
}
else if (key == PropertyKeys.ContextAvailable)
{
newValue.SetUInt((uint)ContextAvailability.NotAvailable);
}
else if (key == PropertyKeys.Categories)
{
newValue = new PropVariant();
newValue.SetIUnknown(currentValue);
}
else if (key == PropertyKeys.RecentItems)
{
object[] currColl = (object[])currentValue.PropVariant.Value;
newValue = new PropVariant();
newValue.SetSafeArray(currColl);
return HRESULT.S_OK;
}
else if (key == PropertyKeys.ItemsSource)
{
// This should only be necessary if you have created a gallery in the ribbon markup that you have not yet put into the command manager.
List<IUISimplePropertySet> list = new List<IUISimplePropertySet>();
OpenLiveWriter.Interop.Com.Ribbon.IEnumUnknown enumUnk = new BasicCollection(list);
newValue = new PropVariant();
newValue.SetIUnknown(enumUnk);
return HRESULT.S_OK;
}
else if (key == PropertyKeys.StringValue)
{
newValue = new PropVariant(String.Empty);
}
else if (key == PropertyKeys.SelectedItem)
{
newValue = new PropVariant(0);
}
else if (key == PropertyKeys.DecimalValue)
{
newValue.SetDecimal(new decimal(0));
}
else if (key == PropertyKeys.MinValue)
{
newValue.SetDecimal(new decimal(0));
}
else if (key == PropertyKeys.MaxValue)
{
newValue.SetDecimal(new decimal(100));
}
else if (key == PropertyKeys.Increment)
{
newValue.SetDecimal(new decimal(1));
}
else if (key == PropertyKeys.DecimalPlaces)
{
newValue.SetDecimal(new decimal(0));
}
else if (key == PropertyKeys.RepresentativeString)
{
newValue.SetString("9999");
}
else if (key == PropertyKeys.FormatString)
{
newValue.SetString(String.Empty);
}
else if (key == PropertyKeys.StandardColors)
{
newValue = new PropVariant();
newValue.SetUIntVector(new uint[] { });
}
else if (key == PropertyKeys.StandardColorsTooltips)
{
newValue = new PropVariant();
newValue.SetStringVector(new string[] { });
}
else if (key == PropertyKeys.BooleanValue)
{
newValue = new PropVariant();
newValue.SetBool(false);
}
else
{
Trace.Fail("Didn't properly update property for " + PropertyKeys.GetName(key) + " on command " + ((CommandId)commandId));
newValue = new PropVariant();
}
}
catch (Exception ex)
{
Trace.Fail("Exception in UpdateProperty for " + PropertyKeys.GetName(key) + " on command " + commandId + ": " + ex);
newValue = new PropVariant();
}
return HRESULT.S_OK;
}