用DLL中的函数在主对话框上,或控件上绘图,输出文字


用DLL中的函数在主对话框上,或控件上绘图,输出文字
 


DLL:


// Insert your headers here
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers

#include <afx.h>//z

#include <windows.h>




#include "stdafx.h"
#include <AFXWIN.H>
#include "WBDLL.h"

#ifdef _DEBUG
#pragma comment(lib, "libcmtd.lib")
#else
#pragma comment(lib, "libcmt.lib")
#endif

#ifdef _X86_
extern "C" { int _afxForceUSRDLL; }
#else
extern "C" { int __afxForceUSRDLL; }
#endif






extern "C" __declspec(dllexport) void DrawLinePP(CDC *pDC,CWnd *pWnd,CPoint pt1,CPoint pt2);



void DrawLinePP(CDC *pDC,CWnd *pWnd,CPoint pt1,CPoint pt2)
{
pDC->MoveTo(pt1);
pDC->LineTo(pt2);
pDC->TextOut(50,50,"2012世界末日",sizeof("2012世界末日")-1);

CString str,str1;
str = "123";
pDC->TextOut(50,70,str);

str1 = "平凡中亦有不平凡!";
pDC->TextOut(80,90,str1);
}


背景透明和红色字


void DrawLinePP(CDC *pDC,CWnd *pWnd,CPoint pt1,CPoint pt2)
{
pDC->MoveTo(pt1);
pDC->LineTo(pt2);
pDC->TextOut(50,50,"2012世界末日",sizeof("2012世界末日")-1);

pDC->SetTextColor(RGB(255,0,0));
pDC->SetBkMode(TRANSPARENT);

CString str,str1;
str = "123";
pDC->TextOut(50,70,str);

str1 = "平凡中亦有不平凡!";
pDC->TextOut(80,90,str1);
pDC->SetTextColor(RGB(0,0,0));
}