Solved

Pictures in ActiveX controls

Posted on 1998-06-10
3
220 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Three Considerations for Containers

Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read our article on Experts Exchange.

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

632 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