Announcement

Collapse
No announcement yet.

LoadImage again....

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Chris Boss
    replied
    Try using LoadIconEx instead, since you can define the width and height !


    ------------------

    Leave a comment:


  • Cecil Williams
    Guest replied
    Mark,

    From the help file:

    The DrawIcon function draws an icon in the client area of the window of the specified device context.

    BOOL DrawIcon(

    HDC hDC, // handle to device context
    int X, // x-coordinate of upper-left corner
    int Y, // y-coordinate of upper-left corner
    HICON hIcon // handle to icon to draw
    );


    Parameters

    hDC

    Identifies the device context for a window.

    X

    Specifies the logical x-coordinate of the upper-left corner of the icon.

    Y

    Specifies the logical y-coordinate of the upper-left corner of the icon.

    hIcon

    Identifies the icon to be drawn.
    Windows NT: The icon resource must have been previously loaded by using the LoadIcon function.
    Windows 95: The icon resource must have been previously loaded by using the LoadIcon or LoadImage functions.



    Return Values

    If the function succeeds, the return value is nonzero.
    If the function fails, the return value is zero. To get extended error information, call GetLastError.

    Remarks

    DrawIcon places the icon's upper-left corner at the location specified by the X and Y parameters. The location is subject to the current mapping mode of the device context.
    Chris was right about System Default metric sizes SM_CXICON, SM_CYICON (which are likely 32 x 32).

    As you can see, the DrawIcon() function only has two parameters for location and they are the upper left corner location for the icon. Nothing wrong with this function as far as I can see.

    Cheers,
    Cecil



    ------------------

    Leave a comment:


  • mark smit
    Guest replied
    Hello...

    Guess what... %LR_LOADREALSIZE does not exist! I looked in the MSDN and searched through ALL of the header files in Visual Studio v6. The problem seems to be not with LoadImage but rather with DrawIcon(). I guess it assumes that icon was 32x32, so to fix this problem I ended up using DrawIconEx() instead.

    Cheers!

    ------------------

    Leave a comment:


  • Chris Boss
    replied
    Mark;

    Use must use the LR_LOADREALSIZE Flag or the icon gets stretched to the System Default metric sizes SM_CXICON, SM_CYICON (which are likely 32 x 32).

    DrawIcon will not Size the Icon to anything other than what you loaded.

    Read the MS docs "carefully" !




    ------------------

    Leave a comment:


  • mark smit
    Guest started a topic LoadImage again....

    LoadImage again....

    Hello all...

    I just dont understand LoadImage(), It doesnt work the way MSDN says that its supposed to work. MSDN states that if cxDesired and cyDesired are zero and you do NOT use the LR_DEFAULTSIZE flag then the image size will be used from the resource. DrawIcon() forces my 16x16 icon to be draw at 32x32! Lance I hope you or someone else can shed some light on this because this is annoying...


    Cheers!



    [This message has been edited by mark smit (edited April 20, 2000).]
Working...
X