PDA

View Full Version : بنظر شما ایراد سورس چیه؟



Hamedm
چهارشنبه 23 شهریور 1384, 00:56 صبح
سلام

وقتی که میخواهم بوسیله کد زیر Style برنامه رو بصورت XP دربیارم، دیگه آیکونهای Toolbar نمایش داده نمیشه.

System.Windows.Forms.Application.EnableVisualStyle s()
Application.DoEvents()
بنظر شما برای حل این مشکل چه کاری باید کرد؟
یک نمونه از برنامه ای که این مشکل رو داره رو هم قرار دادم.

در پناه حق موفق باشید و پرتوان

Peyman_Ranjbar
چهارشنبه 23 شهریور 1384, 04:55 صبح
سلام
من کدت رو به این صورت تغییر دادم درست شد:لبخند:


Module MDL
'--- Public Forms ---
Public h_frmMain As New frmMain

'--------------------
Public Sub Main()

'
Application.DoEvents()

Application.Run(h_frmMain)
System.Windows.Forms.Application.EnableVisualStyle s()
End Sub

End Module


از یه راه دیگه هم میتونی استفاده کنی



<?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="XPThemes.exe"
type="win32"
/>
<description>My XPThemes Demo App</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>


این کد رو داخل یه فایل بریز و با اسم
yourapplicationName.exe.manifest
ذخیره کن

یه سوال :
همیشه فایل license رو همراه code snipt میذاری برای داونلود؟:لبخند:

Mohammad .net
چهارشنبه 23 شهریور 1384, 14:11 عصر
من کدت رو به این صورت تغییر دادم درست شد
ولی ویژوال استیل نیست دیگه :چشمک:

من مدتی از روش اول استفاده می کردم . گاهی وقت ها در بازکردن فرم ها ایراد های بدون دلیل پیش می آمد که مدت ها وقتم روگرفت تا معلوم بشه بخاطر استفاده از روش اول است.

توصیه می کنم از Manifest استفاده کنید.

راستی اون license به چه دردی می خوره ؟:لبخند:

Hamedm
چهارشنبه 23 شهریور 1384, 15:01 عصر
سلام


یه سوال :
همیشه فایل license رو همراه code snipt میذاری برای داونلود؟:لبخند:
والا من اون پست رو توی خواب و بیداری فرستادم (12:20 شب بود)، یادم رفت License رو بر دارم.


ولی ویژوال استیل نیست دیگه :چشمک:

من مدتی از روش اول استفاده می کردم . گاهی وقت ها در بازکردن فرم ها ایراد های بدون دلیل پیش می آمد که مدت ها وقتم روگرفت تا معلوم بشه بخاطر استفاده از روش اول است.

توصیه می کنم از Manifest استفاده کنید.

راستی اون license به چه دردی می خوره ؟:لبخند:


ولی من تاحالا با روش اول به مشکل بر نخوردم. :لبخندساده

در پناه حق موفق باشید و پرتوان

Hamedm
چهارشنبه 23 شهریور 1384, 15:20 عصر
سلام


از یه راه دیگه هم میتونی استفاده کنی
کد:



<?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="XPThemes.exe"
type="win32"
/>
<description>My XPThemes Demo App</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>



این کد رو داخل یه فایل بریز و با اسم
yourapplicationName.exe.manifest
ذخیره کن

حالا اگه نخواهم این فایل در مسیر پروژه باشه، چطوری میتونم این فایل رو به پروژه اضافه کنم؟

Chabok
جمعه 25 شهریور 1384, 12:50 عصر
ببینید این به دردتون میخوره :
مال MSDN است .


Add the Manifest to the Executable File

Next, open the executable file within Visual Studio to add the manifest as a resource.

To add the manifest as a resource


In the Visual Studio development environment, on the File menu, point to Open, then click File.
Navigate to the directory containing this Visual Studio solution. This is the directory you saved it in during Step 1 of the "Create the Project" section.
Open the obj directory and then the Debug or Release directory (depending on the build option you set in the development environment).
Locate the executable file (it will be in the form of ProjectName.exe) and double-click it to open it with the Visual Studio environment.
Right-click the executable file in the designer and choose Add Resource.
In the Add Resource dialog box, click the Import button.
Navigate to the manifest file you created, which should be located in the same directory as your solution.
Note Be sure that the Files Of Type field in the dialog box is set to All Files (*.*) so that you can see the manifest file in the file picker.
Double-click the manifest file. The Custom Resource Type dialog box opens.

In the Resource Type box, type RT_MANIFEST and click OK.
In the Properties window, set the ID property to 1.
From the File menu, choose Save All to save the changes you have made.


در ضمن من از این تابع هم استفاده می کنم . مشکلی نداشته ام :


shared sub Main()
Application.Enablevisualstyles()
Application.Run(New Form1)
End sub

حالا استارت پروژه رو روی Sub Main قرار دهید
موفق باشید