如何在VS2005中使用GDI+

GDI+ 画路径(消除锯齿的效果很不错) 在VS2005里使用GDI+ 1、 先包含相应的头文件并引入库 #define GDIPVER 0x0110  #include #include #include #include #pragma comment(lib,"GdiPlus.lib") using namespace Gdiplus;2 、在合适的位置 初始化GDI+,具体位置自己随机应变哦 / 阅读详情

如何在VS2005中使用GDI+

日期:2008-11-11 | 分类:MFC 编程笔记 | Tags:

版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明http://www.blogbus.com/keegoo-logs/31245186.html

(2008-11-11)

     最开始在VS2005中编写GDI+的程序时,并不知道实际上VS2005是支持GDI+开发的。所以特意上网下了一个GDI+的库,并用VS2005与其进行关联。后来在网上看了一个帖子教如何在VS2005下配置GDI+,这才发现自己走了弯路。以下是在VS2005下配置GDI+的方法,贴出来和大家共享:

 

 Visual Studio 2005本身带有GDI+的所有库函数,所以不用像在VC++6.0里那样,需要将GDI+的头文件和lib文件手工加入到工程中。 
 
但在使用GDI+之前需要首先完成以下几步: 
1.在stdafx.h文件中加入以下几句话: 
 
#include <gdiplus.h> //将GDI+头文件加入到工程中 
#pragma comment(lib, "gdiplus.lib") //将GDI+的lib文件加入到工程中 
using namespace Gdiplus; //使用GDI+的命名空间 
 
2.假设工程名叫abc,则在自动生成的abc.h文件中添加成员变量: 
protected: 
GdiplusStartupInput m_gdiplusStartupInput; 
ULONG_PTR m_gdiplusToken; 
 
3.重载ExitInstance函数,在abc.h文件中添加: 
public: 
virtual int ExitInstance(); 
 
在abc.cpp文件中添加: 
int CabcApp::ExitInstance() 
{ 
// TODO: Add your specialized code here and/or call the base class 
GdiplusShutdown(m_gdiplusToken); 
 
return CWinApp::ExitInstance(); 
} 
 
4.在abc.cpp的函数BOOL CabcApp::InitInstance()中添加: 
GdiplusStartup(&m_gdiplusToken, &m_gdiplusStartupInput, NULL); 
 
 
在完成以上几步之后,就可以在窗口或者视图的函数中进行绘图了。


以上的方法经过测试非常好用!! 


注意要写在OnPaint()中

http://czy.t.blog.163.com/blog/static/11691154820120260917596/

CClientDC *pDC = new CClientDC(GetDlgItem(IDC_STATIC_PIC));
CRect rect;
GetDlgItem(IDC_STATIC_PIC)->GetWindowRect(&rect);
Graphics graphics(pDC->m_hDC); // Create a GDI+ graphics object
Image image(_T("1.png")); // Construct an image
graphics.DrawImage(&image, 0, 0, image.GetWidth(), image.GetHeight());
delete pDC;

http://www.cnblogs.com/Lexy/archive/2011/04/09/2010418.html

OpenCL编译环境配置 在 Linux 系统上配置 OpenCL 开发环境需要安装适当的驱动、运行时和开发工具。 阅读详情

相关推荐

WinInet 编程:MFC 中的互联网编程

WinInet 是一套 Windows API(应用程序编程接口),用于实现互联网应用程序的网络通信和数据传输。WinInet 抽象了底层网络协议和硬件细节,为程序员提供了一套统一的接口,简化了互联网应用程序的开发过程。WinInet 广泛应用于各种 Windows 应用程序中,包括网页浏览器、下载管理器、网络游戏等。MFC WinInet 是一套强大的类库,为 MFC 程序员提供了在 Windows 平台上实现互联网通信和数据传输的工具。

JAZJD的博客 1643

VC 2005 GDI+环境配置

原作出处:http://sroply.blog.163.com/blog/static/170926519201089102539257/  Visual Studio 2005本身带有GDI+的所有库函数,不用像VC++6.0那样,还需要将GDI+的头文件和lib文件手工加入到

莫认真,认真你就输了 1207

用C++手把手教你连接SimNow期货模拟盘:从CTP API封装到第一个订单(附完整代码)

本文详细介绍了如何使用C++连接SimNow期货模拟盘,从CTP API的基础架构解析到实现第一个订单的完整流程。内容涵盖CTP API的封装、SimNow环境配置、交易通道实现、行情接收与处理等核心环节,并提供完整代码示例,帮助开发者快速掌握量化交易中的期货模拟盘连接技术。

weixin_27215337的博客 339

VS2005中使用GDI+准备工作

1.在stdafx.h文件中加入以下几句话:   #include //将GDI+头文件加入到工程中 #pragma comment(lib, "gdiplus.lib") //将GDI+的lib文件加入到工程中 using namespace Gdiplus; //使用GDI+的命名空间   2.假设工程名叫abc,则在自动生成的abc.h文件中添加成员变量: prot

没难度、有态度、不泄气、不放弃 743

FastDDS之共享内存

transport层负责为DDS用户数据收发和服务发现提供通信。包含UDP,TCP,SHM。

u010378559的博客 3092

基于大模型的重度膝关节骨关节炎全流程预测与治疗方案研究

本研究基于大模型构建了重度膝关节骨关节炎(KOA)预测体系,涵盖术前风险预测、手术方案优化、术中监测和术后康复指导全流程。通过分析临床和影像数据,模型在手术风险预测准确率(85%)、并发症预警(血栓预测准确率88%)等方面显著优于传统方法。研究实现了临床数据与AI技术的深度融合,术前预测指导麻醉选择(如高危患者推荐椎管内麻醉),术中实时监测生命体征,术后个性化康复方案使患者HSS评分平均提升45分。

嵌入式毕设/课设资料清单(速查手册·文档模板·题库,持续更新)→ 见最新文章 1397

如何用VS2005制作Web安装程序

网站完成后,需要部署到目标机器上,方法有很多,直接把文件Copy到目标机器上,执行SQL脚本,配置IIS,这样可以做到;也可以使用InstallShield这样到专业制作软件来打包。本篇文章是使用VS2005自带到安装部署工具来制作exe安装文件。 涉及到到内容包括:使用安装部署工具,建立数据库,配置IIS,文件操作,注册表等。参考了网上关于使用VS制作安装程序的文章。环境:Windows

cqfeng的专栏 1万+

手把手教你用STM32实现三相永磁同步电机FOC控制(附代码)

本文详细介绍了基于STM32的三相永磁同步电机(PMSM)FOC控制实现方法,涵盖硬件设计、软件架构、参数调试及完整代码解析。通过磁场定向控制(FOC)算法,实现高效精准的电机控制,适用于工业自动化、电动汽车等领域。文章还提供了硬件选型建议、电流采样方案对比及PID参数整定技巧,助力开发者快速掌握FOC控制技术。

weixin_29168675的博客 101

如何在VS2005中使用GDI+ - [MFC 编程笔记]

最开始在VS2005中编写GDI+的程序时,并不知道实际上VS2005是支持GDI+开发的。所以特意上网下了一个GDI+的库,并用VS2005与其进行关联。后来在网上看了一个帖子教如何在VS2005下配置GDI+,这才发现自己走了弯路。以下是在VS2005下配置GDI+的方法,贴出来和大家共享:    Visual Studio 2005本身带有GDI+的所有库函数,所以不用像在VC++6.0

wayaoqiang的专栏 819

保姆级教程:手把手教你用Jacquard V2数据集训练机器人抓取模型(附完整代码)

本文提供了一份详细的保姆级教程,手把手教你使用Jacquard V2数据集训练机器人抓取模型。从环境配置、数据准备到模型架构设计、训练优化和实际部署,全程解析并附完整代码,帮助开发者快速掌握视觉抓取技术。

weixin_29031057的博客 321

OpenCLI入门:让任何网站变成你的命令行工具(超详细版)

最有用的工具,往往是最简单的。 opencli就是这样。 它不会帮你写代码,不会帮你做决策,但它能把200+个平台装进你的命令行。 让你用最简单的方式,获取最丰富的数据。

weixin_66295112的博客 2104

在vs2005使用GDI+

但在使用GDI+之前需要首先完成以下几步:  1.在stdafx.h文件中加入以下几句话:    #include //将GDI+头文件加入到工程中  #pragma comment(lib, "gdiplus.lib") //将GDI+的lib文件加入到工程中  using namespace Gdiplus; //使用GDI+的命名空间    2.假设工程名叫abc,则在自动生

kisswawawa的专栏 604

避坑指南:STM32F4的ADC采样FSR传感器,如何稳定读数并校准压力值?

本文详细解析了STM32F4的ADC采样FSR薄膜压力传感器时遇到的读数不稳定和非线性校准问题,提供了从硬件配置到软件滤波的完整解决方案。通过优化ADC设置、改进滤波算法和实施分段线性校准,帮助工程师实现高精度压力测量,特别适用于智能手套和医疗监测等应用场景。

weixin_28675839的博客 280

VC的MFC程序VS2008与VS2005的两个不同点

1:GDI+使用 VS2008新建立一个MFC的应用程序,把MFC类库以静态方式引用,使用Release模式编译,发现文件1.65M左右。把程序Copy到一个干净的Win2000上,报错为找不到GdiPlus类型库,看来在VS2008中MFC里引用了GDI+的内容。 而使用VS2005同样建立一个MFC的程序,同样的方式编译后文件大小只有304k,小多了。放到Win2000上可以正常的执行

hbxtlhx的专栏 3294

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

VS2005向导生成的win32程序编译GDI+问题

昨天用VS2005向导生成的Win32程序,当向其中添加GDI+相关文件引用时会提示如下错误 1>f:/microsoft visual studio 8/vc/platformsdk/include/gdiplusimaging.h(67) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int1>f:/microsoft visual st

ToCpp的专栏 3275

InTheHand.Net.Personal+BlueTooth4,蓝牙开发

项目中有蓝牙开发的必备dll,现在网上相关的文档博客不少,有的说的多有的说少,但是却很少有这两个dll,分享一下。

GDI+在VS2008 编译不过的解决方法

今天写程序的时候用到GDI+,不过编译不通过。出现的错误为:1>------ Build started: Project: Label, Configuration: Debug Win32 ------1>Compiling...1>stdafx.cpp1>c:/program files/microsoft sdks/windows/v6.0a/include/gdi...

weixin_34274029的博客 215

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

MFC和GDI+开发电子时钟小程序

利用GDI+和PNG素材实现电子时钟小程序,支持缩放。程序技术简单,仅供新手参考学习使用。 先看效果: 原理: 工程:VS2005,MFC(对话框)工程。 绘图类:CClockST继承CStatic 控件关联:DDX_Control(pDX, IDC_CLOCK, m_ctrClock); 程绘图原理: 1.重载OnEraseBkgnd() 2.创建位图、画刷。 3.随着TIMER,

心碎瞬间的博客 2716

MFC和GDI+制作蝴蝶苍蝇飞舞小程序

MFC和GDI+制作蝴蝶苍蝇飞舞小程序 看到网上有个老外写的蝴蝶飞舞程序,一时兴起,自己开发了个功能相似的小程序。实现功能屏幕:上有蝴蝶或者是苍蝇在飞舞。素材是通过提取工具提取出来的。老外程序的网址记不清了。 本文仅供新手学习参考用。 先看效果: 下面来说说程序原理吧: 工程:MFC(对话框)工程。 窗口:每个飞舞的元素(蝴蝶/苍蝇)各是一个窗口,这些窗口的父窗口是Desk

心碎瞬间的博客 4570

PNG button (按钮) files with transparency, for Visual C++ 6.0 and VS2005

PNG button (按钮) files with transparency, for Visual C++ 6.0 and VS2005 2008年11月06日 下午 02:47 要用到PNG格式的按钮,起初使用CxImage,发现有些地方实现起来很不方便。最终找到了他。 希望对大家有用。 Download demo - 478 KB Download ...

weixin_30606669的博客 104

C#托管环境下释放COM对象

开发小组在VS2005 c++环境中,使用ATL编写了一组COM组件,在VS 2005 C#项目中引入后使用,浏览地图,使用一段 时间后,发现无法正常显示地图了,显示有些线无法绘制、然后一些多边形无法绘制...最后整个地图不显示了。 debug后发现,GDI对象无法创建,已创建的GDI对象没有释放。 在VC++开发环境中调用组件时,一旦脱离组件对象的生命周期,组件对象便会自动释放,而在VS2...

straw hat in the wind 244

机器视觉入门之路(三,微软的gdi+,c++)

自从有了微软的gdi+,界面的画图和交互简单了。 我们不解释gdi+了,可以百度,我们直接示范在vs2005 c++编程中使用: 第一,在stdafx.h中添加: #include <gdiplus.h> using namespace Gdiplus; 第二,在你的cwinapp派生类中添加: public:GdiplusStartupInput m_GdiplusStartupInput; ULONG_PTR m_GdiplusToken; 第三...

ganggangwawa的博客 657

ocx开发经验,ActiveX开发快速入门

1. ocx下载解压的目标位置,由注册表项指定 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\ActiveX Cache 默认为C:\WINDOWS\Downloaded Program Files inf文件也解压到该目录 下载的ocx在资源管理器中不可见,使用dir命令可见。可以使用copy

xiaoxiaoyu85的专栏 8565

GDI在VS2005中的初始化

之前写了一个很简单的GDI画图程序,却始终无法在视图中显示,上网查询,才知道vs2005需要设置一些舒适化才能进行gdi画图。于是转载一篇:     Visual Studio 2005本身带有GDI+的所有库函数,所以不用像在VC++6.0里那样,需要将GDI+的头文件和lib文件手工加入到工程中。   但在使用GDI+之前需要首先完成以下几步: 1.在stdafx.h文件中加入

xuqiang918的专栏 681
上一篇: 泛泰A880S再次救砖成功,记录一下
下一篇: MFC 小笔记
码农兼养猪
博客等级 码龄17年 19粉丝 7原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址