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

本文介绍如何使用C++编程语言结合Windows SDK绘制线条,并在窗口中显示文字,包括透明背景和红色字体的设置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


用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));
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值