Thread View: borland.public.cppbuilder.nativeapi
12 messages
12 total messages
Started by George P Boutwell
Thu, 20 Apr 2006 13:17
XP Style close button on Form
Author: George P Boutwell
Date: Thu, 20 Apr 2006 13:17
Date: Thu, 20 Apr 2006 13:17
8 lines
1421 bytes
1421 bytes
Hello, I'm trying to manually paint an XP style close button on a portion of a BCB6 form (other than the caption, as this form is an captionless form). Anyone have any experience doing this. As near as I can tell I need to somehow get the uxtheme.h, uxtheme.lib, and link to them and make calls in them, but I'm know sure how to go about getting borland-friendly versions of these. Any help please? Thanks, George
Re: XP Style close button on Form
Author: Michael Gillen
Date: Thu, 20 Apr 2006 14:34
Date: Thu, 20 Apr 2006 14:34
16 lines
1332 bytes
1332 bytes
George P Boutwell wrote: > > Hello, > > I'm trying to manually paint an XP style close button on a portion of a BCB6 form (other than > the caption, as this form is an captionless form). Anyone have any experience doing this. As > near as I can tell I need to somehow get the uxtheme.h, uxtheme.lib, and link to them and make > calls in them, but I'm know sure how to go about getting borland-friendly versions of these. Any > help please? For BCB6 I use Theme Manager. http://www.soft-gems.net/ThemeManager.php -- -Michael Gillen
Re: XP Style close button on Form
Author: JD
Date: Thu, 20 Apr 2006 21:36
Date: Thu, 20 Apr 2006 21:36
180 lines
8214 bytes
8214 bytes
"George P Boutwell" <lewtuobg.reverse-for-email@valleyhope.com> wrote:
>
Please wrap your lines when you post. Your editor may visually
wrap them for you but you need to enter a hard retuen at the
end of each line. If you're using a reader, look for an option
to set it's line width.
> I'm trying to manually paint an XP style close button
//-------------------------------------------------------------
#ifndef Unit2H
#define Unit2H
//-------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
//-------------------------------------------------------------
#include <tmschema.h>
//-------------------------------------------------------------
typedef HANDLE HTHEME;
typedef BOOL WINAPI (*DLLISTHEMEACTIVE)();
typedef HTHEME WINAPI (*DLLOPENTHEMEDATA)( HWND, LPCWSTR );
typedef HRESULT WINAPI (*DLLDRAWTHEMEBACKGROUND)( HTHEME, HDC, int, int, const RECT*, OPTIONAL const RECT* );
typedef HRESULT WINAPI (*DLLCLOSETHEMEDATA)( HTHEME );
//-------------------------------------------------------------
class TForm2 : public TForm
{
private:
bool FCanTheme;
HINSTANCE hUxTheme;
DLLISTHEMEACTIVE IsThemeActive;
DLLOPENTHEMEDATA OpenThemeData;
DLLDRAWTHEMEBACKGROUND DrawThemeBackground;
DLLCLOSETHEMEDATA CloseThemeData;
bool __fastcall InitializeTheming();
public:
__fastcall TForm2(TComponent* Owner);
__fastcall ~TForm2();
};
//-------------------------------------------------------------
extern PACKAGE TForm2 *Form2;
//-------------------------------------------------------------
#endif
//-------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit2.h"
//-------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;
//-------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner) : TForm(Owner)
{
hUxTheme = NULL;
IsThemeActive = NULL;
OpenThemeData = NULL;
DrawThemeBackground = NULL;
CloseThemeData = NULL;
FCanTheme = InitializeTheming();
}
//-------------------------------------------------------------
__fastcall TForm2::~TForm2()
{
if( hUxTheme ) ::FreeLibrary( hUxTheme );
}
//-------------------------------------------------------------
bool __fastcall TForm2::InitializeTheming()
{
bool Result = false;
if( !hUxTheme )
{
hUxTheme = ::LoadLibrary( "UxTheme.dll" );
if( hUxTheme )
{
IsThemeActive = reinterpret_cast<DLLISTHEMEACTIVE>( ::GetProcAddress(hUxTheme, "IsThemeActive") );
if( IsThemeActive )
{
if( IsThemeActive() )
{
OpenThemeData = reinterpret_cast<DLLOPENTHEMEDATA> ( ::GetProcAddress(hUxTheme, "OpenThemeData" ));
DrawThemeBackground = reinterpret_cast<DLLDRAWTHEMEBACKGROUND> ( ::GetProcAddress(hUxTheme, "DrawThemeBackground" ));
CloseThemeData = reinterpret_cast<DLLCLOSETHEMEDATA> ( ::GetProcAddress(hUxTheme, "CloseThemeData" ));
if( OpenThemeData && DrawThemeBackground && CloseThemeData ) Result = true;
}
}
}
}
return Result;
}
//-------------------------------------------------------------
An example of drawing a ThemePart (small themed close button):
if( FCanTheme )
{
HTHEME hTheme = OpenThemeData( Handle, L"WINDOW" );
if( hTheme )
{
TRect R = Rect( 0, 0, ::GetSystemMetrics(SM_CXMENUSIZE), ::GetSystemMetrics(SM_CYMENUSIZE) );
// use win32 API OffsetRect to position the TRect accordlingly
DrawThemeBackground( hTheme, Canvas->Handle, WP_CLOSEBUTTON, CBS_NORMAL, &R, NULL );
CloseThemeData( hTheme );
}
else
{
// draw it un-themed
}
}
else
{
// draw it un-themed
}
If you want a normal close button, use SM_CXSIZE and SM_CYSIZE
with the calls to GetSystemMetrics when sizing the TRect. If
you want to clip the extra pixels that surround the button,
the last parameter in the call to DrawThemeBackground is a
clipping rect.
Here's a list of parts and their states for the WINDOW class.
Where no states are listed, use a one (1) for the state.:
WP_CAPTION CS_ACTIVE, CS_DISABLED, CS_INACTIVE
WP_CAPTIONSIZINGTEMPLATE
WP_CLOSEBUTTON CBS_DISABLED, CBS_HOT, CBS_NORMAL, CBS_PUSHED
WP_DIALOG
WP_FRAMEBOTTOM FS_ACTIVE, FS_INACTIVE
WP_FRAMEBOTTOMSIZINGTEMPLATE
WP_FRAMELEFT FS_ACTIVE, FS_INACTIVE
WP_FRAMELEFTSIZINGTEMPLATE
WP_FRAMERIGHT FS_ACTIVE, FS_INACTIVE
WP_FRAMERIGHTSIZINGTEMPLATE
WP_HELPBUTTON HBS_DISABLED, HBS_HOT, HBS_NORMAL, HBS_PUSHED
WP_HORZSCROLL HSS_DISABLED, HSS_HOT, HSS_NORMAL, HSS_PUSHED
WP_HORZTHUMB HTS_DISABLED, HTS_HOT, HTS_NORMAL, HTS_PUSHED
WP_MAX_BUTTON MAXBS_DISABLED, MAXBS_HOT, MAXBS_NORMAL, MAXBS_PUSHED
WP_MAXCAPTION MXCS_ACTIVE, MXCS_DISABLED, MXCS_INACTIVE
WP_MDICLOSEBUTTON CBS_DISABLED, CBS_HOT, CBS_NORMAL, CBS_PUSHED
WP_MDIHELPBUTTON HBS_DISABLED, HBS_HOT, HBS_NORMAL, HBS_PUSHED
WP_MDIMINBUTTON MINBS_DISABLED, MINBS_HOT, MINBS_NORMAL, MINBS_PUSHED
WP_MDIRESTOREBUTTON RBS_DISABLED, RBS_HOT, RBS_NORMAL, RBS_PUSHED
WP_MDISYSBUTTON SBS_DISABLED, SBS_HOT, SBS_NORMAL, SBS_PUSHED
WP_MINBUTTON MINBS_DISABLED, MINBS_HOT, MINBS_NORMAL, MINBS_PUSHED
WP_MINCAPTION MNCS_ACTIVE, MNCS_DISABLED, MNCS_INACTIVE
WP_RESTOREBUTTON RBS_DISABLED, RBS_HOT, RBS_NORMAL, RBS_PUSHED
WP_SMALLCAPTION CS_ACTIVE, CS_DISABLED, CS_INACTIVE
WP_SMALLCAPTIONSIZINGTEMPLATE
WP_SMALLCLOSEBUTTON CBS_DISABLED, CBS_HOT, CBS_NORMAL, CBS_PUSHED
WP_SMALLFRAMEBOTTOM FS_ACTIVE, FS_INACTIVE
WP_SMALLFRAMEBOTTOMSIZINGTEMPLATE
WP_SMALLFRAMELEFT FS_ACTIVE, FS_INACTIVE
WP_SMALLFRAMELEFTSIZINGTEMPLATE
WP_SMALLFRAMERIGHT FS_ACTIVE, FS_INACTIVE
WP_SMALLFRAMERIGHTSIZINGTEMPLATE
WP_SMALLHELPBUTTON HBS_DISABLED, HBS_HOT, HBS_NORMAL, HBS_PUSHED
WP_SMALLMAXBUTTON MAXBS_DISABLED, MAXBS_HOT, MAXBS_NORMAL, MAXBS_PUSHED
WP_SMALLMAXCAPTION MXCS_ACTIVE, MXCS_DISABLED, MXCS_INACTIVE
WP_SMALLMINCAPTION MNCS_ACTIVE, MNCS_DISABLED, MNCS_INACTIVE
WP_SMALLRESTOREBUTTON RBS_DISABLED, RBS_HOT, RBS_NORMAL, RBS_PUSHED
WP_SMALLSYSBUTTON SBS_DISABLED, SBS_HOT, SBS_NORMAL, SBS_PUSHED
WP_SYSBUTTON SBS_DISABLED, SBS_HOT, SBS_NORMAL, SBS_PUSHED
WP_VERTSCROLL VSS_DISABLED, VSS_HOT, VSS_NORMAL, VSS_PUSHED
WP_VERTTHUMB VTS_DISABLED, VTS_HOT, VTS_NORMAL, VTS_PUSHED
For a complete list of theme Classes, their parts and their
states, examine tmschema.h.
For a complete list of theming functions, examine uxtheme.h.
~ JD
Re: XP Style close button on Form
Author: Regis St-Gelais
Date: Fri, 21 Apr 2006 13:29
Date: Fri, 21 Apr 2006 13:29
15 lines
1511 bytes
1511 bytes
"JD" <nospam@nospam.com> a �crit dans le message de news: 4447fece$1@newsgroups.borland.com... > > Please wrap your lines when you post. Your editor may visually > wrap them for you but you need to enter a hard retuen at the > end of each line. If you're using a reader, look for an option > to set it's line width. > I read his post with Outlook Express and I have no wrap problems. I think that your reader should wrap the lines himself. -- Regis St-Gelais www.laubrass.com
Re: XP Style close button on Form
Author: Mark Jacobs
Date: Fri, 21 Apr 2006 14:03
Date: Fri, 21 Apr 2006 14:03
20 lines
1743 bytes
1743 bytes
"Regis St-Gelais" <regis.st-gelais@NOSPAMlaubrass.com> wrote in message news:4448de53$1@newsgroups.borland.com... > "JD" <nospam@nospam.com> a �crit dans le message de news: > 4447fece$1@newsgroups.borland.com... >> >> Please wrap your lines when you post. Your editor may visually >> wrap them for you but you need to enter a hard retuen at the >> end of each line. If you're using a reader, look for an option >> to set it's line width. >> > > I read his post with Outlook Express and I have no wrap problems. > I think that your reader should wrap the lines himself. I also get no wrapping problems with his post under OE. -- Mark Jacobs DK Computing http://www.dkcomputing.co.uk
Re: XP Style close button on Form
Author: JD
Date: Fri, 21 Apr 2006 15:18
Date: Fri, 21 Apr 2006 15:18
22 lines
1707 bytes
1707 bytes
"Regis St-Gelais" <regis.st-gelais@NOSPAMlaubrass.com> wrote:
>
>> [...] If you're using a reader, [...]
> I read his post with Outlook Express and I have no wrap
> problems. I think that your reader should wrap the lines
> himself.
I, like many others, do not use a reader and prefere the web
interface. Have a look at what it looks like if the lines are
not wrapped:
http://newsgroups.borland.com/cgi-bin/dnewsweb?cmd=article&group=borland.public.cppbuilder.nativeapi&item=18520&utag=
If you then click on Post Response (you can cancel later just
by closing the window), you'll notice that you are asked to
press enter at the end of each line. The server wants cr/lf
pairs and it's a one-time fix to set the line width of your
reader.
~ JD
Re: XP Style close button on Form
Author: Bob Gonder
Date: Fri, 21 Apr 2006 15:20
Date: Fri, 21 Apr 2006 15:20
7 lines
1295 bytes
1295 bytes
Regis St-Gelais wrote: >I read his post with Outlook Express and I have no wrap problems. >I think that your reader should wrap the lines himself. If I wanted to use MS's crappy software, I wouldn't be in a Borland newsgroup.
Re: XP Style close button on Form
Author: JD
Date: Fri, 21 Apr 2006 15:22
Date: Fri, 21 Apr 2006 15:22
9 lines
1214 bytes
1214 bytes
"Mark Jacobs" <http://www.jacobsm.com/mjmsg?Borland%20Newsgroup> wrote: > > I also get no wrapping problems with his post under OE. It's not about how your reader reads it. It's about how his reader writes it. See my other reply. ~ JD
Re: XP Style close button on Form
Author: Regis St-Gelais
Date: Mon, 24 Apr 2006 12:10
Date: Mon, 24 Apr 2006 12:10
29 lines
1923 bytes
1923 bytes
"JD" <nospam@nospam.com> a �crit dans le message de news: 4448f7e2$1@newsgroups.borland.com... > > I, like many others, do not use a reader and prefere the web > interface. Have a look at what it looks like if the lines are > not wrapped: > > > http://newsgroups.borland.com/cgi-bin/dnewsweb?cmd=article&group=borland.public.cppbuilder.nativeapi&item=18520&utag= > Then I think that the web interface should wrap it automaticaly. >If you then click on Post Response (you can cancel later just >by closing the window), you'll notice that you are asked to >press enter at the end of each line. The server wants cr/lf >pairs and it's a one-time fix to set the line width of your >reader. When I hit Post Response I can see a line wrapped version and the browser does not ask me to press enter. -- Regis St-Gelais www.laubrass.com
Re: XP Style close button on Form
Author: Alan Bellingham
Date: Mon, 24 Apr 2006 12:55
Date: Mon, 24 Apr 2006 12:55
19 lines
1814 bytes
1814 bytes
"Regis St-Gelais" <regis.st-gelais@NOSPAMlaubrass.com> wrote: >Then I think that the web interface should wrap it automaticaly. You may think so. But that is changing the spec, and many would be rather unhappy about a unilateral spec change. Ideally, all mail and news clients should always have used automatic wrapping, including getting quoting right. But when email/news was invented, most clients had fixed fonts and fixed size windows, so wrapping wasn't considered. Instead, all halfway-decent mail/news clients have the ability to set line lengths. Or in other words, the historic design decision has been to place the burden of line breaking on the sender, not the receiver. Alan Bellingham -- ACCU Conference 2007 - venue to be determined.
Re: XP Style close button on Form
Author: JD
Date: Mon, 24 Apr 2006 15:16
Date: Mon, 24 Apr 2006 15:16
8 lines
1165 bytes
1165 bytes
"Regis St-Gelais" <regis.st-gelais@NOSPAMlaubrass.com> wrote: > > [...] the browser does not ask me to press enter. Look again. ~ JD
Re: XP Style close button on Form
Author: Boba
Date: Mon, 24 Apr 2006 16:23
Date: Mon, 24 Apr 2006 16:23
14 lines
1335 bytes
1335 bytes
"Bob Gonder" <notbg@notmindspring.invalid> wrote in message news:vuth42lp643pg8s0kp9eifuhjom88dq455@4ax.com... > If I wanted to use MS's crappy software, I wouldn't be in a Borland > newsgroup. If Borland's good software worked the way it's suppose to, There wouldn't be a need for this newsgroup... \|/ o^o - Boba
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads