PDOI: Image display.

I hope to be able to display an image. I've looked at and tried to
apply sample code from a number of sources, including Sam's _Teach
Yourself Visual C++ in 21 Days_, an MFC Bible, Jeff Proise's MFC book,
etc.

I would like to set up an array as follows 

data[0] = 0;
data[1] = 0;
data[2] = 255;

to draw a red square, rect, or triangle. Once I see I can control
pixel values, invoke the CBitmap class and control the display of the
pixels, I'll worry about the code that reads the image file to be
displayed. 

Can someone point me in the right direction. 

I also started a basic MFC dialog application and added a Kodak Image
edit control from the ActiveX controls. But I'm too much on a learning
cliff to be able to figure out how to use it and web searches for
examples a fruitless to date. Anybody ever engage in using this sort
of thing?
My ancestors swung by their necks, not their tails.
I suport publick skool
0
phychobm (24)
2/7/2004 5:11:22 AM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
338 Views

Similar Articles

[PageSpeed] 3

Hi,

To draw an image in MFC, you dont have to worry about the pixel values, as
MFC provides a very good framework for doing that.
You can load a bitmap either from file or from resource into a
CBitmap/HBITMAP structre using LoadBitmap(...).
Once the bitmap is loaded, write a message handler for WM_PAINT in your view
class
and then you can use CreateCompatibleDC(...), SelecteObject(...) and
BitBlt(...) functions to draw the image.

You can see a variety of samples here
http://www.codeproject.com/bitmap/

Cheers
Jagadeesh


"Special Agent Orange" <phychobm@mindspring.com> wrote in message
news:59b920hh08pup13ron98i6sdr6dlssa15g@4ax.com...
> I hope to be able to display an image. I've looked at and tried to
> apply sample code from a number of sources, including Sam's _Teach
> Yourself Visual C++ in 21 Days_, an MFC Bible, Jeff Proise's MFC book,
> etc.
>
> I would like to set up an array as follows
>
> data[0] = 0;
> data[1] = 0;
> data[2] = 255;
>
> to draw a red square, rect, or triangle. Once I see I can control
> pixel values, invoke the CBitmap class and control the display of the
> pixels, I'll worry about the code that reads the image file to be
> displayed.
>
> Can someone point me in the right direction.
>
> I also started a basic MFC dialog application and added a Kodak Image
> edit control from the ActiveX controls. But I'm too much on a learning
> cliff to be able to figure out how to use it and web searches for
> examples a fruitless to date. Anybody ever engage in using this sort
> of thing?
> My ancestors swung by their necks, not their tails.
> I suport publick skool


0
jagadeeshvn (256)
2/7/2004 7:44:03 AM
Reply:

Similar Artilces:

How to load .rtf file with images?
Dear everyone: Currently I have a CRichEditCtrl, I want to load a file with StreamIn(), the file contains image. But I fail, It seams that SteamIn() does not work with images. Is there any code sample? Your help will save me. Sincerely Yours Richard Huang. ...

stop images exceeding page margins from printing in Excel
I am working on an excel doc. and some of the images I've inserted exceed the page margins and portions of the images are printed out on separate pages at the end of the print job. It is important that I keep the images the size they are for legibility reasons. How do I stop the extra portion of the image exceeding the right margin from printing out at the end of the print job. It wastes a lot of paper. Hi Wallace, I believe you can highlight the area you want printed and go to File/Print Area/Set Print Area Hope this helps Larry -- keithl816 -----------------------------...

PDOI: My program worked, and then
I hope this is the right newsgroup for this public dispay of ignorance. I'm using visual C++ to do a console application. The program works to my satisfaction. Then I swtich from debug to release mode. Then the program does not work the same in reading an integer from a file by using fgetc 4 times and then doing the big/little endian thing. any ideas? My ancestors swung by their necks, not their tails. I suport publick skool Special Agent Orange, You are in the right place! Not only the original posters, but we who answer as well, shamelessly flaunt everything from a weak grasp of rea...

Changing Photos in a Image Object
I have named a file path and file location in VB to locate a particular photo. As the user selects different items from a droplist the file path and name change. In the change event on that droplist I need to know how to call the load event for the Image object. So far I have tried: Image1.Picture = LoadPicture(PictureFileName1) - Where PictureFileName is my path and file name as well as hard coding to Image1.Picture = LoadPicture("e:\monthlyreport\Photo1.bmp") I don't understand the correct syntax to change the picture file. Please help. Thank you! Hi Troubled...

Create an image in VBA
Hiya, I have been given a task to do which involves generating a graph inside Access 2003 using VBA. I then have to output the image as a jpg, gif or bmp. I'm just in the early stage of planning this and I really have no idea which direction to go in at the moment because I have never done any image creation in VBA. Any suggestions of tutorials, tools or modules which may help will be appreciated Thanks, Alan On 4 Apr 2007 01:39:53 -0700, aclelland@gmail.com wrote: >Hiya, > >I have been given a task to do which involves generating a graph >inside Access 2003 using VBA. I...

GIF images won't print
Publisher 2000 printing to HP970 CXI Deskjet Inserted GIF pictures into a publisher documentation on page 4 of a front and bach top fold card. If I print page 4 only, image prints. If I print entire document the image is missing? This has happened on a number of different publications, does any one know why? Or how to fix this? Thanks... When you create a top fold card page four is usually blank. The message is page three, the colophon is page two, the greeting is page one. Anything on page four will be printed upside down by default. Could be the .gif can't be rotated for some r...

Chart.Export images are shrinking as I export more images
Hi, I have a chart object in an excel sheet, that I have programmatically exporting the chart to JPG file. I have a button the the page, that I have tied to VB MOD in the worksheet that does this: Dim chartObject As chartObject Set chartObject = Sheet3.ChartObjects(2) chartObject.Chart.Export GetFilePath(), "jpg", False Set chartObject = Nothing The export works fine and creates new images every time the user clicks on the button, but the problem is user is exporting the chart many times the chart image file starts to shrink in size? I am using Excel 2003. Ha...

display off at intel atom board
I found the lcd panel can't go power off at suspend mode. When I used lx800, it worked well. any modificaton should need for it? although AMD LX800 and ATOM are both x86 processors they are quite different, so their BSP's and their display device drivers. You have to figure out yourself why the display does not act correctly, using the debugger for example -- Luca Calligaris (MVP-Windows Embedded) l.calligaris.nospam@eurotech.it.nospam www.eurotech.it "daniel" <daniel@discussions.microsoft.com> ha scritto nel messaggio news:4F290303-F3A0-4F6D-...

Wrong Fonts displayed in the Tree View.
In my application i have to use Custom fonts for the item's text in the tree view,these fonts gets displayed correctly on Windows 2000 but picks up the Windows default font which is Sytem ,wehn run on Windows 98. Code Snippet : --------------- CMyView is derived from CTreeView and has member varibles, m_pTreeCtrl and m_oFont. CMyView::CMyView:m_pTreeCtrl(NULL) { m_oFont.CreatePointFont(10 * 10, _T("CustomFont")); m_pTreeCtrl = &GetTreeCtrl(); } CMyView::OnInitialUpdate() { CTreeview::OnInitialUpdate(); m_pTreeCtrl->SetFont(&m_oFont,TRUE); } This piece of c...

how i convert excel files with images to access
hey im working fora telecom company and they want me to make a program that converts excel to access i know theres a converter in access but....... heres my problem the excel file that they have has an image/logo and i dont have any idea of a converter that reads excel files with images and saves them as an access file i need help thanks If the grahic is an image/logo it sounds like its a static graphic that would be used many times within Access on invoices, forms, reports, etc. What you can do is first link your Excel table into Access (right click in the Access Database window, cli...

background not saving with image
when i do a save as on a slide it is only saving the image on the slide and not the background image. how is this done? tia, mcnewsxp Which version of PowerPoint are you using, and what are you saving it as? -- Michael Koerner MS MVP - PowerPoint "Michael Courter" <mcourter@mindspring.com> wrote in message news:%23$UpNpgaKHA.2184@TK2MSFTNGP04.phx.gbl... when i do a save as on a slide it is only saving the image on the slide and not the background image. how is this done? tia, mcnewsxp On Nov 20, 2:04=A0pm, "Michael Koerner" <...

Images in signatures
Hi I recently created a signature in outlook 2002 with my company logo in it. It worked for a while but recently all i get when i write a new mail is a blank square with a red X (like you see on web pages when the image does not load). I've tried it with several different images and none will appear, however if i use a sig that is just text it appears fine, am i missing something simple? Cheers Paul I have the same problem, Paul. Have you ever figured this out? Frank "Paul" wrote: > Hi > > I recently created a signature in outlook 2002 with my company l...

how to use STATIC control to display temperature in degree (oC)?
I want to use the Static control as a label to display temperature unit in degree (that is oC). How to do that? CString Temp; Temp.Format("%ld%cC",Degrees,0xB0); AliR. "kathy" <yqin_99@yahoo.com> wrote in message news:1129056720.751477.33580@o13g2000cwo.googlegroups.com... > I want to use the Static control as a label to display temperature unit > in degree (that is oC). How to do that? > ...

UPLOADING IMAGES (PHOTOS AND GRAPHICS) TO THE WEB SITE
I HAVE JUST CREATED MY FIRST WEB SITE, AND PUBLISHED IT HOWEVER NONE OF THE IMAGES ARE DISPLAYED ON THE WEB PAGES. OK SO OBVIOUSLY THEY WERE NOT SENT UP TO THE WEB SITE WHEN IT WAS PUBLISHED. PLEASE COULD SOMEONE TELL ME HOW TO GET THEM THERE USING MS PUBLISHER. REGARDS HL It sounds like you did not upload all the html output. Assuming that you use Pub 2003 at its default settings, then when you Publish to the Web, an index.htm file (your home page) and an index_files folder is produced. The index_files folder is where your other pages and supporting graphics and images are contained. Up...

PDOI: Image display.
I hope to be able to display an image. I've looked at and tried to apply sample code from a number of sources, including Sam's _Teach Yourself Visual C++ in 21 Days_, an MFC Bible, Jeff Proise's MFC book, etc. I would like to set up an array as follows data[0] = 0; data[1] = 0; data[2] = 255; to draw a red square, rect, or triangle. Once I see I can control pixel values, invoke the CBitmap class and control the display of the pixels, I'll worry about the code that reads the image file to be displayed. Can someone point me in the right direction. I also started a basic M...

document imager
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel <i>have microsoft office for mac 2008, student edition, i am trying to scan a document so that i can edit it, older versions of word had something called OCR that would enable you to do this, i cannot find it on my version, how do i do it?</i> What you're referring to is Twain support which requires VBA. Since there's no VBA in Office 2008 there's no Twain support. The only real difference is that you cannot scan directly into your document. You'll need to use the software that c...

Unable display folder
Hi, My system can not receive email. I upgrade it from Office 2000 to Office XP. Screen has message: Unable to display the folder. Microsoft outlook could not access the specified folder location. The .DLL file for the information service could not be found. MAPI was unable to load the information service PSTRX.DLL. Be sure the service is correcty installed and configured. I need help. Please email me cchen@glbtecx.com or call 949 450 8725. Thank you. .. ...

Shortcut to display formulas ?
Hi, I work in France, with an AZERTY keyboard, and I use Vista Home, french version, Excel french versions Excel Help (2002, 2003, 2007) says that to display formulas instead of values (and back) I must hit CTR+ ` This second character is what I can get when I hit AltGr+7. But trying to type AltGr + CTRL + 7 or CTRL+AltGr+7 does not do anything. I tried to switch to a QWERTY keyboard (Alt + Shift for 3 seconds), this ` is now where I had the � character, but CTRL + � does no good. So back to AZERTY... I know how to make formulas appear (Options...) but a shortcut is much faster. Can any...

Document Imaging
I have two issues related to this. First, Document Imaging is not showing in 2010 beta. I have done a complete install, and told the install to run all from my computer. I have Windows 7 64 and I cannot find Document Imaging. A related problem is on my machine also running 7 64 and I have Office 2007, Document Imaging appears but the Document Imaging Printer doesn't appear. Is this a 64 bit issue? If so, why are they making a big fuss that 2010 will be available in 64 bit. Why have the 64 bit if you have reduced functionality? ...

IMAGE
Hello I have set up some stationery but my nice crisp clean company logo looks poor qualiy when I do a test and receive it back in the email. It looks very good in outlook when sending but not so on receiving - does Outlook compress images to a certain quality - can I do something to ensure good quality image? thanks Jeff ...

Add image over other images
Hey guys, Basically I have two pictures: A map (quite a large picture) A symbol (quite small and to be placed over the map at specified points) Anyone have any idea how I could go about this? Thanks in advance for any help! Am 05.05.2010 05:51, schrieb bourkeyo: > Basically I have two pictures: > > A map (quite a large picture) > A symbol (quite small and to be placed over the map at specified points) > > Anyone have any idea how I could go about this? Take a look at the following classes/methods: 'Bitmap': Constructor and 'Save' m...

Sharpen Images
I have a problem with Publisher 2003. It seems that whenever I import an image from a file and then try to resize it, it becomes very blurry. How do I sharpen these images or make them larger and remain clear? PLEASE HELP!! J. Oakes <J. Oakes@discussions.microsoft.com> was very recently heard to utter: > I have a problem with Publisher 2003. It seems that whenever I > import an image from a file and then try to resize it, it becomes > very blurry. How do I sharpen these images or make them larger and > remain clear? Have you checked View > Pictures > Detailed D...

How do I convert a color raster image to a 1-bit bitonal image
I am attempting to convert a USGS color raster image map into a 1-bit bitonal image so that I can plot the same in an autocad environment as a black & white image. In previous times I could use PHOTOED on Windows 98 to perform this task, but now with XP I seem not to have the functionality. PhotoEd seems to not be compatible with XP. Anyone got a suggestion? hfg kentucky This has nothing to do with Publisher. Sorry. -- JoAnn Paules MVP Microsoft [Publisher] "ENGINEER OF KY" <ENGINEER OF KY@discussions.microsoft.com> wrote in message news:4DC4286A-17BE-4655-90B...

Images
When I insert an image from clipart in Publisher the image shows, but if I convert it to an Office drawing object it disappears. I mean it's still there, (the handles are still showing) but the image isn't visible, this happens in Word as well. Anyone have an idea as to what might be causing this? Read the third FAQ here: Q: Why can I not see images/shapes/lines when editing my publication? http://ed.mvps.org/Static.aspx?=Publisher/FAQs -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "Snapper" <snapcridge@gmai...

displaying spreadsheet info on a web page dynamically
I am trying to display a spreadsheets' contents in a web page, and have it auto-refresh to display changes made to the spreadsheet. I've been messing around with it all morning and cant seem to figure out what I am doing wrong. I know it has something to do with external data ranges, save as a web page with pivot table interactivity I believe but I cant seem to get it to work. Can some one assist me with this problem or point me in the direction of some helpful tutorials other than the microsoft tutorials, I browsed threw them but could not find a sufficient solution. Tha...