Solved

Pictures in ActiveX controls

Posted on 1998-06-10
3
207 Views
Last Modified: 2013-11-20
I have added a picture property to the control which is all working correctly.  However I would like to add an Stretch property.  I am not sure how to access the pictures Width and Height properties to allow the SetControlSize function to be called.
0
Comment
Question by:cdm100497
  • 2
3 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 50 total points
Comment Utility
The m_pPict data member of CPictureHolder Class is a pointer to the CPictureHolder object's IPicture interface. IPicutre has the methods IPicture::get_Width and get_Height.
0
 

Author Comment

by:cdm100497
Comment Utility
I have done this however the value returned is Massive 20000+ what command do I need to use to convert this...
0
 
LVL 23

Expert Comment

by:chensu
Comment Utility
Use CDC::HIMETRICtoLP, CDC::HIMETRICtoDP to convert it. And, you may extract the conversion code from the ATL function AtlHiMetricToPixel (atlctl.h, atlctl.cpp).

#define HIMETRIC_PER_INCH   2540
#define MAP_PIX_TO_LOGHIM(x,ppli)   ( (HIMETRIC_PER_INCH*(x) + ((ppli)>>1)) / (ppli) )
#define MAP_LOGHIM_TO_PIX(x,ppli)   ( ((ppli)*(x) + HIMETRIC_PER_INCH/2) / HIMETRIC_PER_INCH )

ATLAPI_(void) AtlHiMetricToPixel(const SIZEL * lpSizeInHiMetric, LPSIZEL lpSizeInPix)
{
      int nPixelsPerInchX;    // Pixels per logical inch along width
      int nPixelsPerInchY;    // Pixels per logical inch along height

      HDC hDCScreen = GetDC(NULL);
      _ASSERTE(hDCScreen != NULL);
      nPixelsPerInchX = GetDeviceCaps(hDCScreen, LOGPIXELSX);
      nPixelsPerInchY = GetDeviceCaps(hDCScreen, LOGPIXELSY);
      ReleaseDC(NULL, hDCScreen);

      lpSizeInPix->cx = MAP_LOGHIM_TO_PIX(lpSizeInHiMetric->cx, nPixelsPerInchX);
      lpSizeInPix->cy = MAP_LOGHIM_TO_PIX(lpSizeInHiMetric->cy, nPixelsPerInchY);
}

0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now