Autor Beitrag
C#Leon
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16



BeitragVerfasst: Mi 16.04.14 15:19 
Hallo

Ich habe einen Würfel der mit 6 Farben bestückt ist. Der gesamte Code ist in C# geschrieben.

ausblenden C#-Quelltext
1:
GeometryModel3D front = new GeometryModel3D(BuildRectangle(a, b, c, d, new Vector3D(00, +1)), new DiffuseMaterial(new SolidColorBrush(Colors.Red)));					

Kann mir jemand sagen wie ich den Würfel mit Bildern bestücken kann?

Bitte helft mir.

Gruss Leon

Moderiert von user profile iconChristian S.: C#-Tags hinzugefügt
Th69
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Moderator
Beiträge: 4764
Erhaltene Danke: 1052

Win10
C#, C++ (VS 2017/19/22)
BeitragVerfasst: Mi 16.04.14 15:59 
C#Leon Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16



BeitragVerfasst: Mi 16.04.14 16:05 
Danke aber das ist alles in WPF ich hätte es sehr ferne in C#.

Danke Gruss Leon

Moderiert von user profile iconTh69: Full-Quote entfernt.
Ralf Jansen
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 4700
Erhaltene Danke: 991


VS2010 Pro, VS2012 Pro, VS2013 Pro, VS2015 Pro, Delphi 7 Pro
BeitragVerfasst: Mi 16.04.14 16:18 
GeometryModel3D gehört zu WPF :gruebel:
Th69
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Moderator
Beiträge: 4764
Erhaltene Danke: 1052

Win10
C#, C++ (VS 2017/19/22)
BeitragVerfasst: Do 17.04.14 10:49 
Hallo Leon,

könntest du deine Frage noch mal präzisieren?
Verstehe ich es richtig, daß du keinen XAML-Code haben möchtest, sondern direkt alles mit eigenem C#-Code erstellen willst? Warum denn?
C#Leon Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16



BeitragVerfasst: Di 22.04.14 10:35 
Hallo Th69

Also ich habe einen Würfel in C# programmiert. Ich habe den Würfel dann mit 6 verschiedenen Farben bestückt.
Der Viewport3D und die PerspectiveCamera ist natürlich in XAML programmiert, wie auch die Knöpfe mit dem man den Würfel auf den 3 Achsen X, Y und Z Achse rotieren lassen kann. Die Rotation ist auch in C# programmiert.
Ich möchte jetzt gerne statt Farben den Würfel mit 6 verschiedenen Bildern bestücken der Dateityp soll .jpg sein.
Es ist richtig dass ich keinen XAML-Code will. Warum ich keinen XAML-Code ist weil ich eigentlich C# lernen soll.

Falls ihr den Code wollt werde ich Ihn noch raufladen.
Danke für die Hilfe.

Gruss Leon
Th69
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Moderator
Beiträge: 4764
Erhaltene Danke: 1052

Win10
C#, C++ (VS 2017/19/22)
BeitragVerfasst: Di 22.04.14 18:49 
Hallo Leon,

XAML ist ja nur eine andere Darstellung, d.h. du kannst diesen Code auch in C# schreiben - einen Sinn sehe ich darin allerdings nicht.
Wenn du wirklich C# lernen willst, dann solltest du m.E. andere Bereiche (anstatt GUI-Programmierung) wählen.

P.S: Warum eigentlich "C# lernen soll"?

Für diesen Beitrag haben gedankt: C#Leon
C#Leon Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16



BeitragVerfasst: Mi 23.04.14 09:26 
Ich würde ja nich C# lernen wenn ich nicht müsste. Die Aufgabe ein GUI zu programmieren habe ich mir nicht selber gesetllt.
Kann mir niemand sagen wie ich das mit dem Bild genau funktioniert?

Moderiert von user profile iconTh69: Full-Quote entfernt.
Th69
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Moderator
Beiträge: 4764
Erhaltene Danke: 1052

Win10
C#, C++ (VS 2017/19/22)
BeitragVerfasst: Do 24.04.14 09:32 
OK, kannst dir ja mal als Vorlage Convert Animation from XAML to C# anschauen, um den XAML-Code aus meinen Links oben nach C# zu konvertieren (im Endeffekt ist es ja nur ein Aufrufen der Eigenschaften und Methoden mit den passenden Parametern).

Am Montag, wenn ich wieder auf der Arbeit bin, kann ich dir auch einen Link zu einem XAML-C# Converter schicken (ich finde den Link leider per Internetsuche hier nicht - ich weiß aber daß es bei einem SourceCode-Repository gehostet wurde).

Für diesen Beitrag haben gedankt: C#Leon
C#Leon Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16



BeitragVerfasst: Do 24.04.14 10:20 
Danke die Links haben mir sehr geholfen und Danke das alle hier helfen ich finde das toll :) . Doch ich habe es nicht geschafft den Code in C# hinzukriegen. Ich kann alles machen nur klappt es nicht das Bild einzufügen. :?

Das ist der Code wie die Farbe definiert wird.

ausblenden C#-Quelltext
1:
2:
GeometryModel3D front = new GeometryModel3D(BuildRectangle(a, b, c, d, new Vector3D(00, +1)),
                                            new DiffuseMaterial(new SolidColorBrush(Colors.Red)));


Soweit bin ich gekommen ziemlich kläglich aber ja hoffe jemand hat einen Tipp.

ausblenden C#-Quelltext
1:
2:
GeometryModel3D front = new GeometryModel3D(BuildRectangle(a, b, c, d, new Vector3D(00, +1)),
                                            new DiffuseMaterial(new ImageBrush()));


Ich brächte jetzt nur noch den Code für das Bild es liegt auf dem Desktop. Oder unter dem Standard Pfad für Bilder C:\Users\Public\Pictures\Sample Pictures\1.jpg

Gruss Leon

Moderiert von user profile iconTh69: Highlight- durch C#-Tags ersetzt
Th69
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Moderator
Beiträge: 4764
Erhaltene Danke: 1052

Win10
C#, C++ (VS 2017/19/22)
BeitragVerfasst: Fr 25.04.14 17:36 
Hallo,

unter ImageBrush.ImageSource ist ein C#-Beispiel angegeben, um ein Bild zu verwenden.
Das hättest du durch Suchen nach ImageBrush aber auch selber herausfinden können...

Die Bilder solltest du aber besser zu deiner EXE packen (und nicht auf dem Desktop), damit das Programm durch Kopieren des gesamten bin-Ordners auch auf anderen Rechnern läuft.

PS. Crossposts bitte immer angeben: myCSharp.de - Würfel mit Bildern ohne xaml nur c#

Für diesen Beitrag haben gedankt: C#Leon
C#Leon Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16



BeitragVerfasst: Mo 28.04.14 08:33 
Danke an alle für die Hilfe.

Gruss Leon
Th69
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Moderator
Beiträge: 4764
Erhaltene Danke: 1052

Win10
C#, C++ (VS 2017/19/22)
BeitragVerfasst: Mo 28.04.14 09:49 
Hier noch der Link: XAML-conversion (ich habe ihn aber selber noch nicht ausprobiert).

Für diesen Beitrag haben gedankt: C#Leon