Note: This article is original. For more information, see http://blog.csdn.net/david hsing/. thank you!
I have always been fascinated by the Nullsoft install system installer and want to achieve the banner effect above.
If you are not a fan of Delphi, you should stop reading it. The third-party component tmxgradientbckgndpanel can fully meet your requirements (if you do not know it, look at gosurf ). This article uses Visual C ++ for implementation. Let's take a look:
Maybe some VC fans will say that this is not easy, and cstatic is not enough? Haha, that's not the case. If you want to implement the functions mentioned below, cstatic is not easy. Besides, if you want to use Spy ++, cstatic, not professional: Since VC is selected, it should be a bit in-depth. How can I componentize it?
As a result, I also went crazy about Google on Baidu. In addition to the help of an article on codeproject, I got nothing else. No way, you have to do it yourself. After some hard work, we finally put a full stop. Send it to commemorate it.
It is easy to use this component xdialogheader. To achieve the effect, the core only needs two or three sentences. Like this:
Bool cdemoprojdlg: oninitdialog ()
...{
Cdialog: oninitdialog ();
// Initialization dialog box
M_xdialogheader.setcaptiontext (_ T ("registered file types on this computer "));
M_xdialogheader.setdescriptiontext (_ T ("displaying all registered file types for this computer below ."));
M_xdialogheader.makedialogheader (this );
Return true; // return true unless focus is set to the control.
}
Of course, the text content of the title and description is basically set here, and many advanced options are not enabled, such:
Void clearbitmap ();
Void setbackgroundcolor (const colorref crcolor );
Bool setbitmap (const uint nbitmapid );
Bool setbitmap (const lpctstr lpszpathname );
Void setbitmapalignment (const uint ualignment = default_dh_bitmap_alignment );
Void setbitmapstyle (const uint nstyle = default_dh_bitmap_style );
Void setbottomstyle (const uint ustyle = default_dh_bottom_style );
Void setcaptionfontcolor (const colorref crcolor );
Void setcaptionfontface (const lpctstr lpszfacename = default_dh_caption_font_face );
Void setcaptionfontsize (const int nsize = default_dh_caption_font_size );
Void setcaptionoffset (const int noffset = default_dh_caption_offset );
Void setcaptiontext (const lpctstr lpsztext = _ T (""));
Void setdescriptionfontcolor (const colorref crcolor );
Void setdescriptionfontface (const lpctstr lpszfacename = default_dh_description_font_face );
Void setdescriptionfontsize (const int nsize = default_dh_description_font_size );
Void setdescriptionoffset (const int noffset = default_dh_description_offset );
Void setdescriptiontext (const lpctstr lpsztext = _ T (""));
Void setgradientcolorflag (bool bflag );
Void setgradientstartcolor (const colorref crcolor );
Void setgradientendcolor (const colorref crcolor );
Void setheaderheight (const int nheight = default_dh_header_height );
Void seticon (const hicon = NULL );
Void seticonalignment (const uint ualignment = default_dh_icon_alignment );
Void seticonoffset (const int noffset = default_dh_icon_offset );
Void settextalignment (const uint ualignment = default_dh_text_alignment );
The above function name is easy to understand and can be used simply. It mainly sets various font styles, bitmap styles (stretch, tile, etc.), style at the bottom of the dialog box (border line, etc.), background color, and gradient.