Solved

Pictures in ActiveX controls

Posted on 1998-06-10
3
215 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
ID: 1317844
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
ID: 1317845
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
ID: 1317846
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Unix / Linux grid computing 5 155
WinWaitActive parameters 12 31
dog bark java program 15 94
java ^ examples 8 65
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 …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

805 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