ISymbolEditor.EditSymbol(...) does not commit edits to existing ISymbol reference parameter.
上次发布: November 30, 2018ArcObjects SDK
漏洞 ID 编号
BUG-000117337
已提交
October 9, 2018
上次修改时间
June 5, 2024
适用范围
ArcObjects SDK
找到的版本
10.6
操作系统
Windows OS
操作系统版本
10.0 64 Bit
状态
Will Not Be Addressed
开发团队已考虑过该问题或请求,并决定不会解决该问题。 问题的“其他信息”部分可能包含进一步说明。
附加信息
The symbol parameter on EditSymbol is a reference parameter, which means a reference must be passed in and cannot be cast on that assignment.
An updated version of the OnClick function that fixes the issue is below:
protected override void OnClick()
{
pStyleGallery = GetStyleGallery();
pStyleStorage = pStyleGallery as IStyleGalleryStorage;
pStyleStorage.TargetFile = STYLE_PATH;
pStyleStorage.AddFile(STYLE_PATH);
pEnumStyleGalleryItem = GetEnumStyleGalleryItem(pStyleGallery);
// Gets the specified symbol from the style gallery.
IStyleGalleryItem styleGalleryItem = LoadStyleSymbol(pEnumStyleGalleryItem, SYMBOl_NAME);
//------------------------------------------------------------------------
// Editing Symbol.
//------------------------------------------------------------------------
// Using existing item from style gallery.
IMarkerSymbol markerSymbol = styleGalleryItem.Item as IMarkerSymbol;
ISymbolEditor symbolEditor = new SymbolEditor();
symbolEditor.Title = "Edit " + styleGalleryItem.Name;
// Print marker detail before edit.
Console.WriteLine("Before dialog edit.");
PrintMultiLayerMarkerDetails(markerSymbol as IMultiLayerMarkerSymbol);
// "markerSymbol" is pasted as a reference and is ment to change
// directly from the dialog inputs by the user.
ISymbol editSymbol = markerSymbol as ISymbol;
bool isSymbolEdited = symbolEditor.EditSymbol(ref editSymbol, 0);
if (!isSymbolEdited)
{
//Return a message here if the dialog is canceled.
Console.WriteLine("Cancel was clicked.");
}
else
// If the user clicks OK.
{
// EditSymbol is ment to return "markerSymbol" as an IMultiLayerMarkerSymbol.
IMultiLayerMarkerSymbol multiMarker = editSymbol as IMultiLayerMarkerSymbol;
// Print marker details after the edit.
Console.WriteLine("After dialog edit.");
PrintMultiLayerMarkerDetails(multiMarker);
styleGalleryItem.Item = multiMarker;
pStyleGallery.UpdateItem(styleGalleryItem);
}
}