Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Pictures in ActiveX controls

Posted on 1998-06-10
3
Medium Priority
?
221 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 100 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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 tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

688 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