<pre name="code" class="cpp">// 写字
int UsrSurfNoteCreate(ProDrawing drawing,
// ProSelection surf_sel, /* The surface - where the note leader
// should be attached. */
ProVector pos, wchar_t * notestr) /* The location of the note itself */
{
ProDtlnotetext text;
ProName font;
ProDtlnoteline line;
ProDtlnotedata ndata;
ProView view;
ProDtlattach attach;
ProDtlnote note;
ProDtlnotetextAlloc(&text);
ProDtlnotetextHeightSet(text, -1.0);
ProDtlnotetextWidthSet(text, -1.0);
ProDtlnotetextSlantSet(text, 0.0);
ProDtlnotetextThicknessSet(text, 0.0);
ProStringToWstring(font, "font");
ProDtlnotetextFontSet(text, font);
ProDtlnotetextStringSet(text, notestr);
ProDtlnotelineAlloc(&line);
ProDtlnotelineTextAdd(line, text);
ProDtlnotedataAlloc(drawing, &ndata);
ProDtlnotedataLineAdd(ndata, line);
int cur_sheet;
ProDrawingCurrentSheetGet (drawing, &cur_sheet);
ProDrawingBackgroundViewGet (drawing, cur_sheet, &view);
//ProSelectionViewGet(surf_sel, &view);
ProDtlattachAlloc(PRO_DTLATTACHTYPE_FREE, view, pos, NULL, &attach);
ProDtlnotedataAttachmentSet(ndata, attach);
ProDtlnoteCreate(drawing, NULL, ndata, ¬e);
ProDtlnoteShow(¬e);
ProDtlnotedataFree(ndata);
return 0;
}
// 写字
void CTestDlg2::OnBnClickedButton12()
{
ProMdl mdl;
ProError err = ProMdlCurrentGet(&mdl);
ProDrawing drawing = (ProDrawing)mdl;
//ProVector pos = {100,100,0};
wchar_t* notes = {L"WERTYU"};
ProMouseButton expected_button = PRO_LEFT_BUTTON;
ProMouseButton button_pressed;
ProPoint3d position;
err = ProMousePickGet(expected_button, &button_pressed, position);
UsrSurfNoteCreate(drawing, position, notes);
}