C# NX二次开发:字符串控件StringBlock讲解
大家好,今天介绍ug二次开发过程中的一个叫字符串的控件,这个控件在块UI编辑器中可以使用。
下面是这个控件中的一些属性和方法:
1、 protected internal StringBlock();
//
// 摘要:
// Returns or sets the WideValue.返回或设置宽值。
//
// 备注:
// Specifies the International text. This property accepts international characters
// supported by NX.
// Created in NX8.5.0
// Deprecated in NX12.0.0. Use 'Value' instead which supports Internationalization.
// License requirements to get this property: None.
// License requirements to set this property: None.
[Obsolete("Deprecated in NX12.0.0. Use 'Value' instead which supports Internationalization.")]
2、 public string WideValue { get; set; }
//
// 摘要:
// Returns or sets the Value:返回或设置值
//
// 备注:
// Created in NX8.5.0
// License requirements to get this property: None.
// License requirements to set this property: None.
//
// 摘要:
// Returns or sets the Tooltip
//
// 备注:
// Created in NX8.5.0
// License requirements to get this property: None.
// License requirements to set this property: None.
public string Tooltip { get; set; }
//
// 摘要:
// Returns or sets the RetainValue
//
// 备注:
// Created in NX8.5.0
// License requirements to get this property: None.
// License requirements to set this property: None.
public bool RetainValue { get; set; }
//
// 摘要:
// Returns or sets the ReadOnlyString
//
// 备注:
// Created in NX8.5.0
// License requirements to get this property: None.
// License requirements to set this property: None.
public bool ReadOnlyString { get; set; }
//
// 摘要:
// Returns or sets the PresentationStyle as string
//
// 备注:
// Created in NX8.5.0
// License requirements to get this property: None.
// License requirements to set this property: None.
public string PresentationStyleAsString { get; set; }
//
// 摘要:
// Returns or sets the MaxTextLength
//
// 备注:
// Created in NX8.5.0
// License requirements to get this property: None.
// License requirements to set this property: None.
public int MaxTextLength { get; set; }
//
// 摘要:
// Returns or sets the Localize
//
// 备注:
// Created in NX8.5.0
// License requirements to get this property: None.
// License requirements to set this property: None.
public bool Localize { get; set; }
//
// 摘要:
// Returns or sets the IsPassword.
//
// 备注:
// If true, characters will not be readable. They will be displayed as *.
// Created in NX8.5.0
// License requirements to get this property: None.
// License requirements to set this property: None.
public bool IsPassword { get; set; }
//
// 摘要:
// Returns or sets the Bitmap
//
// 备注:
// Created in NX8.5.0
// License requirements to get this property: None.
// License requirements to set this property: None.
public string Bitmap { get; set; }
//
// 摘要:
// Returns or sets the Width as string
//
// 备注:
// Created in NX8.5.0
// License requirements to get this property: None.
// License requirements to set this property: None.
public string WidthAsString { get; set; }
//
// 摘要:
// Returns or sets the BalloonTooltipLayout as string
//
// 备注:
// Created in NX8.5.0
// License requirements to get this property: None.
// License requirements to set this property: None.
public string BalloonTooltipLayoutAsString { get; set; }
//
// 摘要:
// Returns or sets the AllowInternationalTextInput
//
// 备注:
// Created in NX8.5.0
// Deprecated in NX12.0.0. Not required from NX10 onwards. Internationalization
// is available by default.
// License requirements to get this property: None.
// License requirements to set this property: None.
[Obsolete("Deprecated in NX12.0.0. Not required from NX10 onwards. Internationalization is available by default.")]
public bool AllowInternationalTextInput { get; set; }
//
// 摘要:
// Gets the BalloonTooltipImages
//
// 备注:
// Created in NX8.5.0
// License requirements: None.
public string[] GetBalloonTooltipImages();
//
// 摘要:
// Gets the BalloonTooltipLayout members
//
// 返回结果:
// Values to get from the property
//
// 备注:
// Created in NX8.5.0
// License requirements: None.
public string[] GetBalloonTooltipLayoutMembers();
//
// 摘要:
// Gets the BalloonTooltipTexts
//
// 返回结果:
// Values to get from the property.
//
// 备注:
// Created in NX8.5.0
// License requirements: None.
public string[] GetBalloonTooltipTexts();
//
// 摘要:
// Gets the ListItems
//
// 返回结果:
// Values to get from the property
//
// 备注:
// Created in NX8.5.0
// License requirements: None.
public string[] GetListItems();
//
// 摘要:
// Gets the PresentationStyle members
//
// 返回结果:
// Values to get from the property.
//
// 备注:
// Created in NX8.5.0
// License requirements: None.
public string[] GetPresentationStyleMembers();
//
// 摘要:
// Gets the Width members
//
// 返回结果:
// Values to get from the property.
//
// 备注:
// Created in NX8.5.0
// License requirements: None.
public string[] GetWidthMembers();
//
// 摘要:
// Sets the BalloonTooltipImages
//
// 参数:
// imageStrings:
//
// 备注:
// Created in NX8.5.0
// License requirements: None.
public void SetBalloonTooltipImages(string[] imageStrings);
//
// 摘要:
// Sets the BalloonTooltipTexts
//
// 参数:
// tooltipTextArray:
// Value to set for the property.
//
// 备注:
// Created in NX8.5.0
// License requirements: None.
public void SetBalloonTooltipTexts(string[] tooltipTextArray);
//
// 摘要:
// Sets the keystroke callback for Block Styler String Block.
//
// 参数:
// cb:
// Callback function for keystroke event.
//
// 备注:
// Created in NX12.0.1
// License requirements: None.
public void SetKeystrokeCallback(KeystrokeCallback cb);
//
// 摘要:
// Sets the ListItems
//
// 参数:
// itemStrings:
// Value to set to the property
//
// 备注:
// Created in NX8.5.0
// License requirements: None.
public void SetListItems(string[] itemStrings);
//
// 摘要:
// The keystroke callback that is registered by calling NXOpen.BlockStyler.StringBlock.SetKeystrokeCallback(NXOpen.BlockStyler.StringBlock.KeystrokeCallback).
//
// 参数:
// stringBlock:
// String Block object for which keystroke event is invoked
//
// uncommittedValue:
// The text being typed in the string block at runtime
//
// 备注:
// It will get called for each key stroke the user makes in the String Block input
// field.
// Created in NX12.0.1
// License requirements: None.
public delegate int KeystrokeCallback(StringBlock stringBlock, string uncommittedValue);
上面这些中比较常用的有以下几个:
1、获取字符串控件中的值: public string Value { get; set; }
2、返回或设置控件只读:public bool ReadOnlyString { get; set; }
本篇文章要介绍的就是这么多,我们下篇文章再见。