Icon on Command Button

Icon on Command Button

Post by Jeff Gaine » Sun, 28 Oct 2001 05:38:27

I have written a program in VB6 which allows the user to drag a file
on to a frame and then makes visible a previously loaded command
button so that pressing the button fires up the file.

I use ExtractIcon, GetDC and DrawIcon to paint the icon from the
dragged file (only playing with executables at the moment) on the
button, whose style is set to graphical.

The problem I have is that the drawing of the Icon is not persistent
and I have to drag the form about to force it to repaint when
sometimes it repaints the icon and sometimes it doesn't. (I use the
DrawIcon function in the Form_Paint routine but it seems that having
drawn the icon the form continues to paint my buttons grey again).

Has anybody any ideas on this, there isn't an AutoRedraw option for
command buttons as far as I can see.

Many thanks.
Jeff Gaines Damerham Hampshire UK


Icon on Command Button

Post by Dan » Tue, 30 Oct 2001 10:52:18

I suspect the when the button is set to graphical, it
expects you to set it's internal-contained bitmap. For
drawing the button in a dynamic manner as you are
suggesting, you may have to subclass the button's WM_PAINT

Dan I


1. UI - Command button group in OpenGL app

Have you checked out FLTK (pronounced "fulltick") yet? That's a free,
object-oriented (C++), platform independent GUI/widget library, which also
actively supports OpenGL. It has many widgets such as light buttons and
(as far as I remember) you already have inbuilt functionality to change
button colors, even OpenGL shaded buttons. There are sliders, radio
buttons, check boxes, round knobs, labels, OpenGL and overlay windows,
text fields, combo boxes, menus, scroll bars, color choosers, ............
ZZZ! It is very popular, not to say good. No MFC.

Go to http://www.fltk.org and also visit their newly installed sourceforge
host, where you can also see the rating.


Anti SPAM:
Remove 123 from email address to reply.
Entferne 123 von der Emailadresse, um zu antworten.

2. PSP Tutorial books

3. VB Command Button Font Color

4. Weird menu font problem (linux version)

5. Command Button Graphic Style

6. Job Posting-PORTLAND, OREGON-Sr SW Engineer-Cognex/Acumen

7. Making a command button look depressed.

8. Ellipsoidial Technology

9. command button alignment...

10. Transparent command button

11. Removing rectangle when command button has focus

12. Command button foreground color

13. Desktop image bleeding through around command buttons