.NET 3.5 SP1에서 컴파일 된 Windows Forms 프로젝트에서 기본 제공 WPF 시작 화면 기능을 사용할 수 있습니까? Studio 2008?.NET 3.5 Windows Forms에서 WPF SplashScreen 사용
답변
네, 할 수는 있지만 다소 연약하고 그리 간단하지는 않습니다.
SplashScreen 클래스는 AssemblyName + ".g"리소스 파일을 찾습니다. 이 파일을 만들려면 프로젝트에 "g.resx"파일을 포함시켜야합니다. 프로젝트 속성에 설정된 루트 네임 스페이스는 어셈블리 이름과 동일해야합니다.
이 리소스 파일에는 System.Drawing.Bitmap이 아닌 MemoryStream 이미지가 있어야합니다. 아마 쉬운 방법이 있지만, 난 그냥 파일을 포함하고 수동으로 같이 할 수있는 항목을 변경 :
<data name="splash.png" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Splash.png;System.IO.MemoryStream, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
그런 다음 당신의 Main 메서드에 다음 줄을 포함한다 :
var splash = new SplashScreen("Splash.png");
splash.Show(true);
희망을 그 도움이됩니다.
자크 츠코의 대답은 정확하지만 약간은 명시되어 있습니다.
먼저 WindowsBase에 대한 참조를 추가하십시오. 특정 코드가없는 속성 폴더, 프로젝트 레벨에 있어야합니다 귀하의 g.resx 파일을 작업이 위해서는
var splash = new System.Windows.SplashScreen("guru_logo.png");
splash.Show(true);
입니다. resx가 기본적으로 Properties (내 것 같은)에 있었던 경우 프로젝트 레벨까지 끌어다 놓아야합니다.
이 내 g.resx의 관련 섹션
SplashScreen로 데이터 이름이 아닌 값을 호출하는 것을<data name="guru_logo.png" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\guru_logo.png;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
공지 사항처럼 보였다 것입니다. 또한 값에 표시된 경로를 기록하십시오.
어떤 이유에서든 이것이 작동하지 않는다면 (예외적으로 리소스를 찾을 수 없음) g.Designer.cs 뒤에있는 코드를 살펴보십시오. 네임 스페이스는 어셈블리 이름이어야합니다. 그렇지 않은 경우 올바른 위치로 이동하거나 자칫코 (Jachymko) 상태와 같이 프로젝트 속성을 변경해야합니다. 이 파일의 코드를 변경하면 자동 생성되는 b/c가 손실됩니다.
나는 makefile로 컴파일 된 간단한 명령 줄 프로그램에서이 작업을 수행했습니다. 요약하면 :
- 는 내용이 당신이 시작 화면에 사용할 그래픽 이미지를 인용해야 g.resx 파일
- 를 추가합니다. 그것은 당신이 더에서/입술 옵션
를 사용하여, resgen.exe는
- 입니다.RESX 파일은 다음과 같다 :
<?xml version="1.0" encoding="utf-8"?>
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="hourglass.jpg" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>hourglass.jpg;System.IO.MemoryStream, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>
- 컴파일을 윈도우 SDK에 포함되어 resgen.exe와 함께. 예를 들어 :
c:\winsdk\bin\resgen.exe g.resx g.resources
- 는에는 Csc.exe 명령 행에서 결과 .resources을 지정합니다.
csc.exe /t:exe /debug+ /win32icon:MyApp.ico /res:g.resources,MyApp.g.resources /R:... ...
: 예를 들어,- 1. Windows Forms에서 .NET 패널 순환시키기
- 2. InvalidOperationException Windows Forms에서 PFX 사용
- 3. WPF SplashScreen with UserControl
- 4. Windows Forms에서 호스팅되는 WPF 컨트롤 SplitContainer
- 5. WPF (.net 3.5) ValidationRule, IDataErrorInfo
- 6. WPF WebBrowser 컨트롤 .XBAP 응용 프로그램의 .NET 3.5 SP1 이상
- 7. Oracle Forms에서 .NET 웹 서비스 사용
- 8. .NET 2.0에서 .NET 3.5 클래스 사용
- 9. .net 3.5 SP1에서 사용 가능한 wpf WebBrowser에서 어떻게 인쇄합니까?
- 10. Windows Forms에서 인쇄하기위한 도구
- 11. Windows Forms .NET 3.5 Treeview 컨트롤에 대한 리소스 이미지 사용
- 12. .net 3.5. wpf-forms .net 2.0 응용 프로그램에서
- 13. Windows Forms에서 SagePay 통합
- 14. Windows Forms에서 그래픽 이동하기
- 15. WPF Windows 7 응용 프로그램이 응답하지 않습니다.
- 16. WPF Date Picker 컨트롤 .Net 3.5
- 17. WPF 응용 프로그램 배포 : .NET 3.5 문제
- 18. .NET 3.5 SP1을 사용하는 WPF DataGrid 대신
- 19. WPF 응용 프로그램 창이 SplashScreen 위에 나타납니다
- 20. Colorpicker for .NET 3.5
- 21. Windows 2000 Server 및 .NET 3.5
- 22. .NET 3.5 대 .NET 3.0
- 23. ASP .NET 3.5 사용 리소스 포함 리소스
- 24. .NET 3.5 DLL 자체 구성 파일 사용
- 25. .NET 3.5 런타임/라이브러리와 함께 PowerShell 사용
- 26. .NET 3.5 SP1에서 EF 4 사용
- 27. .NET 4.0 프로젝트의 .NET 3.5 어셈블리 (WPF C#)
- 28. Java SplashScreen
- 29. .NET Windows Forms에서 중복 양식 생성을 피하는 방법은 무엇입니까?
- 30. .NET 및 Windows Forms에서 마우스 후크로 이상한 동작이 발생했습니다.