Skip to content

Commit ad4cb44

Browse files
[release/8.0] Fill out FORMATETC on MultilineStringEditor Paste (#11113)
* Fill out FORMATETC on multistringeditor paste * Add debug assert --------- Co-authored-by: Loni Tra <[email protected]>
1 parent e97162e commit ad4cb44

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/System.Windows.Forms.Design/src/System/ComponentModel/Design/MultilineStringEditor.OleCallback.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,23 @@ public HRESULT QueryAcceptData(Com.IDataObject* lpdataobj, ushort* lpcfFormat, R
125125

126126
FORMATETC textFormat = new()
127127
{
128-
cfFormat = (ushort)CLIPBOARD_FORMAT.CF_TEXT
128+
cfFormat = (ushort)CLIPBOARD_FORMAT.CF_TEXT,
129+
dwAspect = (uint)DVASPECT.DVASPECT_CONTENT,
130+
lindex = -1,
131+
tymed = (uint)(TYMED.TYMED_HGLOBAL | TYMED.TYMED_ISTREAM | TYMED.TYMED_GDI)
129132
};
130133

131134
FORMATETC unicodeFormat = new()
132135
{
133-
cfFormat = (ushort)CLIPBOARD_FORMAT.CF_UNICODETEXT
136+
cfFormat = (ushort)CLIPBOARD_FORMAT.CF_UNICODETEXT,
137+
dwAspect = (uint)DVASPECT.DVASPECT_CONTENT,
138+
lindex = -1,
139+
tymed = (uint)(TYMED.TYMED_HGLOBAL | TYMED.TYMED_ISTREAM | TYMED.TYMED_GDI)
134140
};
135141

136-
return lpdataobj->QueryGetData(&textFormat).Succeeded || lpdataobj->QueryGetData(&unicodeFormat).Succeeded
137-
? HRESULT.S_OK
138-
: HRESULT.E_FAIL;
142+
bool success = lpdataobj->QueryGetData(&textFormat).Succeeded || lpdataobj->QueryGetData(&unicodeFormat).Succeeded;
143+
Debug.Assert(success);
144+
return success ? HRESULT.S_OK : HRESULT.E_FAIL;
139145
}
140146

141147
return HRESULT.E_NOTIMPL;

0 commit comments

Comments
 (0)