CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2002
    Posts
    298

    Unhappy how to display icon in a dialog box,urgent

    Hi!
    How to display icon in a dialog box?

    Gupta.

  2. #2
    Join Date
    Jun 2001
    Location
    UK
    Posts
    128

    DrawIcon API

    All you need to do to draw an icon in the dialog is load the icon in and use the api, DrawIcon(..).

    DrawIcon(hDC, x_position, y_position, hIcon);


    for example, if you have an icon as a resource in your file - e.g. IDI_ICON1

    you would do something like this:

    HICON hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));

    DrawIcon(hDC, 10, 10, hIcon);


    Hope this helps

    Ben

  3. #3
    Join Date
    Mar 2002
    Location
    India
    Posts
    106

    Inserting Icon

    Hello,
    Try this:
    First of all insert an icon in to your poject by clicking the insert menu in your editor and then click Resource and then click icon.To add an existing icon click import and give the path of icon file in the select box which appear on clicking import.To add a new icon click new and design it using the pen and colours.Now in your resource view under Icon section you can see that icon (say IDI_ICON1).Now insert a picture control to your dialog.Right click your mouse and take its property.In that drop down the combo seen against type and select I con.Now the combo against Image will be visible.Drop down it and select your icon name(say IDI_ICON1).Close the propertis Dialog.Now the icon will be visible in your dialog.You can move it to whatever position you like in your Dialog.
    Let me know is it helpful to you.
    Shibu K.V.
    Sr.Research Associate
    VLSI-ASIC Hardware Design Group
    Electronics R&D Centre of India,
    Trivandrum,Kerala
    India

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured