ESTILO XP VB6

CAETANO 30/11/2006 08:55:00
#187106
XP Styles In VB
Achei este artigo no PSC e não entendi bem oque deve ser feito para
dar aparencia do XP no VB6.
Sera que alguem sabe como por isto em prática ?

'''XP STYLE IN VB6

To my surprise, I recently discovered that VB could be made to adopt the modern, sleek
and elegant look that Windows XP has to offer. Applicable to both VB5 & 6. Microsoft
make a very obvious and quite repeated statement that VB has no direct support for visual XP themes or styles. http://support.microsoft.com/kb/309366

However, they do suggest a method in which to enable support for both the IDE and output executable. They neither discourage nor strongly recommend it. Upon testing out their suggested method, I noticed but only three major quirks. This I feel would explain the lack of enthusiasm towards the suggested approach.

1. Option buttons become black solids when inside frames. (prior projects only)
2. Frames inside of other frames only allow for bold, fixed font captions. (always)
3. Absence of mouse-driven colour palette. (all controls & always)

With prior projects, (designed before enabling the XP styles), I noticed that the command buttons aren’t automatically updated. Everything else seems to inherit the new XP style flawlessly. It’s very apparent that the bulk of the problems with enabling the XP theme will be with your already (existing / prior projects). Starting fresh new designs should prove painless. Converting your existing designs will take some considerable time, which would obviously depend on the complexity of the project. The biggest concern is possibly the missing colour palette. Interestingly you can select colours from it, if you have memorized the location of them all. This is
Because all it only shows you a white empty square. Most people will probably hard code all the colour settings. These are my plans anyhow.

Should I Make The Switch ?

Well, you’ve heard all the grief, three reasons for not wanting to make the switch.
Now here are three reasons to make the switch, immediately, as I’ve already done.

1. Windows 9X looks graphically retarded when compared with XP.
2. XP theme allows for much less cluttered, less complex looking designs.
3. It’s newer technology, logic spells out that it just must simply be better. (not always the case I agree)

Vs The choice is obvious!



Enabling The XP Styles In IDE

First we need to create a manifest file containing the code listed below. This can be accomplished by creating a new text document, copy & paste the script, save it as ‘vb6.exe.manifest’. If you’re using vb5 then you’ll obviously need to change the 6 to a 5. This file is then placed in the same directory as your VB.exe

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="CompanyName.ProductName.YourApp"
type="win32"
/>
<description>Your application description here.</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>




Enabling The XP Styles In Your Output Executable

There are two steps with this. Unfortunately, your executable won’t automatically inherit the new XP theme by just placing the manifest file in the VB directory. It actually requires a separate manifest file of its own. Same script as shown above with the only real difference being the filename. It must be given the name of your executable along with the extension .manifest. If the name of your executable is Test.exe, you’ll need to name the manifest file ‘Test.exe.manifest’ and place it in your application directory.

And yes, the manifest file is as such a dependency and must be shipped with your application for it to work on another users machine. In your application, the next thing we need to do is tell VB that we want to use the XP styles. The following declaration and call must be present to ensure that the new styles are applied. InitCommonControls must be called from the Form_Initialize event.

Private Declare Sub InitCommonControls Lib "comctl32.dll" ()

Private Sub Form_Initialize()
InitCommonControls

End Sub



The fact that Microsoft even make mention of this method tells me that it can’t be all that bad. VB was never initially designed with the XP themes in mind, so you have to expect some rather less than perfect results. Microsoft have a name to up hold, standards to regulate, more customer than you or I have had baked dinners in the past 1,000 life times. They wouldn’t make mention of this method if it had any disastrous potential. It’s certainly a much sounder alternative than using a dozen or so home brewed half-baked User Controls which often make crude attempts at emulating the characteristics of XP objects. VB has been a complete dead product for Microsoft for almost half a decade. Last I read they plan to completely drop support for it in 2007.

Happy coding, ‘XP style’

Trent Jackson 24/11/06


LEONARDOVB 30/11/2006 09:41:33
#187115
quando vc compilar seu programa, crie um arquivo assim: seuprog.exe.manifest, o nome do arquivo manifest tem que ser igual ao do EXE, por exemplo, seu prog é VENDAS.EXE, vai ficar, VENDAS.exe.manifest, dai abra esse arquivo pelo bloco de notas e cole isso:
Citação:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="CompanyName.ProductName.YourApp"
type="win32"
/>
<description>Your application description here.</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>




e cole esse código no topo de seu form inicial (se não da erro):

Private Declare Sub InitCommonControls Lib "comctl32.dll" ()

[c]Private Sub Form_Initialize()
InitCommonControls

End Sub

[/c]

e seu prog vai ser totalmente windows XP ^^
LEONARDOVB 30/11/2006 09:41:40
#187116
Veja ai se da certo

olhe esse link: http://planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=51893&lngWId=1
ele ve se ja existe um arquivo manifest, se nao existir ele cria um, é só chamar uma função chamada CreateManifest
CRAFTY 30/11/2006 09:50:35
#187119
Tem um probleminha, os OptionButton ficam pretos, alguem sabe como arrumar???
LEONARDOVB 30/11/2006 10:02:24
#187121
sei la, acho q se vc usa em um frame, tira ele do frame q acho q da certo

ow, uma dica muito massa, crie esse manifest com o nome de 'vb6.exe.manifest' e cole em "C:\arquivos de programas\Microsoft Visual Studio\vb98\" q seu vb fica estilo vb6

olhem o anexo pra verem
CAETANO 30/11/2006 10:25:05
#187126
Para criar este arquivo .manifest eu colei o código no blovo de notas e salvei com
vb6.exe.manifest, colei na pasta do vb e não aconteceu nada
RODRIGOGBGOMES 30/11/2006 11:32:45
#187144
Resposta escolhida
bem interessante ... agora é o seguinte... alguem ja testou isso em outros sistemas operacionais???
FELIPEA 30/11/2006 11:35:56
#187146
Eu botei o código do LEONARDOVB e salvei como VB6.EXE.MANIFEST e botei na pasta onde está o arquivo VB6.EXE, abri o vb e agora ta com aparencia do XP normalz

lembre-se:
- é necessario ter o windows XP para que o código funcione (O Manifest só vai no XP)
- Se vc tem 200 ou -, baixe componentes que funcionem no 2000 mesmo assim


t+
FELIPEA 30/11/2006 11:37:37
#187147
CRAFTY,
Esse é um BUG do manifest e não sei como corrige, mas isso acontece porque ta dentro de um frame certo? substitua o frame por shape.. sei la

xD

DANIELCPAETE 30/11/2006 11:41:24
#187150
Qual a versão do seu windows se não me engano para este codigo funcionar seu windows tem que ser XP
RODRIGOGBGOMES 30/11/2006 11:44:06
#187151
so funciona no xp mesmo... acabei de olhar no windows 98... da erro...
system errors...
Página 1 de 2 [11 registro(s)]
Tópico encerrado , respostas não são mais permitidas