cdrapi.cpp 1007 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include <windows.h>
  2. #include <stdio.h>
  3. #include "cdrapi.h"
  4. void BeginOpt(corel *cdr)
  5. {
  6. auto name = _bstr_t("Undo");
  7. cdr->EventsEnabled = false;
  8. cdr->ActiveDocument->BeginCommandGroup(name);
  9. cdr->ActiveDocument->Unit = cdrMillimeter;
  10. cdr->Optimization = true;
  11. }
  12. void EndOpt(corel *cdr)
  13. {
  14. cdr->EventsEnabled = true;
  15. cdr->Optimization = false;
  16. cdr->EventsEnabled = true;
  17. cdr->ActiveDocument->ReferencePoint = cdrBottomLeft;
  18. cdr->Application->Refresh();
  19. cdr->ActiveDocument->EndCommandGroup();
  20. }
  21. void Active_CorelWindows(HWND hDlg)
  22. {
  23. // 将焦点返回到父窗口 关闭对话框窗口
  24. SetFocus(GetParent(hDlg));
  25. }
  26. double GetTextValue(HWND hDlg, int IDITEM) {
  27. char ibuf[64];
  28. memset(ibuf, 0, sizeof(ibuf));
  29. GetWindowText(::GetDlgItem(hDlg, IDITEM), ibuf, sizeof(ibuf));
  30. double exp = 0.0;
  31. sscanf_s(ibuf, "%lf", &exp);
  32. return exp;
  33. }
  34. void PutTextValue(HWND hDlg, int IDITEM, char *buf) {
  35. SetWindowText(::GetDlgItem(hDlg, IDITEM), buf);
  36. }