如何加载图片 [英] How to load picture

查看:123
本文介绍了如何加载图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

推荐答案

嗨宝贝
玩得开心
我像你一样伊朗人!
如果您在mfc类(对话框)中加载并显示该标签,则应该执行以下操作:

1st:
加载atlimage.h以使用CImage,这真的很有用.
#iclude"atlimage.h"

第二名:
定义一个全局CImage.您应该在OnInit函数之前定义它.
CImage image1;

第三名:
很好地定义了它,并且可以在OnPaint之类的函数中使用它;
首先,我们必须从hard加载图片:
bool OnInit(){
i.Load(_T("C:\ a.jpg"));
}


第四名:
现在您必须以以下形式绘制(对话框):

bool OnPaint(){
CClientDC dc(this);
image1.BitBlt(dc.m_hDC,0,0,SRCCOPY);
}


祝你好运宝贝


我的电子邮件是:mahdiacuransx@yahoo.com
hi baby
have a good time
i''m iranian like you!
well if you load and display that in mfc class(dialog) you shoud do these:

1st:
load atlimage.h for using the CImage,that''s really usefull.
#iclude "atlimage.h"

2nd:
define a global CImage.you shoud define that before OnInit function.
CImage image1;

3th:
well you defined that and you can use that in a function like OnPaint;
at first we must load picture from hard :
bool OnInit(){
i.Load(_T("C:\a.jpg"));
}


4th:
and now you must draw that in form(dialog):

bool OnPaint(){
CClientDC dc(this);
image1.BitBlt(dc.m_hDC,0,0,SRCCOPY);
}


good luck baby


my email is: mahdiacuransx@yahoo.com


在C ++中加载图像是什么意思?
您应该更加具体,以获得一个好的答案.但是,如果您使用的是 MFC ATL ,并且要从文件加载图像,然后在屏幕(或打印机)上呈现它,则应使用类(在atlimage.h中声明),它具有用于加载,保存和呈现图像的适当方法(它可以处理最常见的图像文件格式,例如 bmp png jpeg 等).
What do you mean with load image in C++?
You should be more specific to get a good answer; however, if you are using MFC or ATL and you want to load an image from file and then render it on screen (or printer), you should use the class CImage (declared in atlimage.h) which has appropriate methods to load, save and render images (it can handle the most common image file formats, like bmp, png, jpeg and so on).


在C ++ .NET下:

创建一个位图图像对象,并向其传递所需的文件名:

Bitmap^ MyImage= new Bitmap("MyImage.bmp");

要绘制它,请使用在绘制窗口的Paint事件处理程序中传递给您的事件的Graphics:

e->Graphics->DrawImage(MyImage);
Under C++ .NET:

Create a bitmap image object, passing it the desired filename:

Bitmap^ MyImage= new Bitmap("MyImage.bmp");

To draw it, use the Graphics of the event passed to you in the Paint event handler of the drawing window:

e->Graphics->DrawImage(MyImage);


这篇关于如何加载图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆