Solved

Pictures in ActiveX controls

Posted on 1998-06-10
3
218 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
pre4 challenge 19 116
Dell Alienware Graphics Amplifier Driver for non-Alienware systems 18 628
Problem to App 4 145
Problem to App source 6 120
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

734 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