Anzeige mittels Panel

Deutschsprachiges X#-Forum – German language forum

Moderator: wriedmann

User avatar
wriedmann
Posts: 3655
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Anzeige mittels Panel

Post by wriedmann »

Hallo Franz,
eigentlich sollte das schon funktionieren.
Was sagt der Debugger hier?
Begin ... end using brauchst Du nicht zu verwenden.
Das End Using kümmert sich nur darum, das entsprechende Objekt nachher per :Dispose() wieder aufzuräumen.
Ich denke aber, dass das Rendern der Grafik bei jedem Refresh des Fensters passieren muss - das ist zumindestens bei VO so, und ich weiß nicht, wie das bei WinForms geht.
Welche QRcode-Library verwendest Du hier?
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Chris
Posts: 4587
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Anzeige mittels Panel

Post by Chris »

Hi Franz,

In addition to what the guys have said, this code does not include something to show the window:

lagraf wrote:

Code: Select all

CLASS StandardSDIWindow INHERIT DataWindow
METHOD MyQRCodeShow()
	LOCAL oQRCode AS Frames01
	LOCAL lReturn AS LOGIC
	oQRCode := Frames01{"Hello World", 5}
...
What happens if you add a

Code: Select all

oQRCode:Show()
at the end, does it now show the window with the control in it?

.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
lagraf
Posts: 420
Joined: Thu Jan 18, 2018 9:03 am

Anzeige mittels Panel

Post by lagraf »

Chris,
Wolfgang said that the problem is that a WinForms window is called out of a VOGUI so he gave me an example to do this with ChildWinForm. This runs but the remaining problem is that the QRCode graphics is not shown at the window:

Code: Select all

panel := Panel{}
panel:AutoSize := TRUE
graphics := panel:CreateGraphics()     // creates a graphics object
renderer:Draw(graphics, qrCode:Matrix, padding)     // paints qrCode into graphics object
textBox1 := System.Windows.Forms.TextBox{}
panel:Controls:Add(textBox1)     // Add textBox1 to panel
SELF:Controls:Add(panel)     // Add panel to window
qrCode:Matrix should be right because I can save it to file, this code works:

Code: Select all

stream := FileStream{"c:tmpfoo.bmp", FileMode.Create}
renderer:WriteToStream(qrCode:Matrix, ImageFormat.Bmp, stream)
I see the textBox1 but not the QRCode, what's the problem with qrCode:Matrix?
lagraf
Posts: 420
Joined: Thu Jan 18, 2018 9:03 am

Anzeige mittels Panel

Post by lagraf »

Hallo Wolfgang,
BEGIN und END habe ich weggelassen.
Als QRCode Library verwende ich die Gma.QrCodeNet.Encoding.dll, daran kanns aber nicht liegen, denn ich kann den QRCode speichern. Mit dem Debugger habe ich mich noch nicht beschäftigt, was möchtest du damit sehen?
Wie kann ich in X# am Einfachsten eine Anzeige machen und wie wird das dann angezeigt:
- ? wie in VO
- Console.Write
User avatar
wriedmann
Posts: 3655
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Anzeige mittels Panel

Post by wriedmann »

Hallo Franz,
schaue ich mir heute abend an.
? sollte gehen
Console.Write läuft nur, wenn die App als Console-App definiert ist, sonst muss man die Console manuell erstellen. Wenn Du das brauchst, kann ich Dir den Code geben.
Am sinnvollsten ist wie in VO eine Ausgabe mit DebugView, am besten DebugView++ verwenden und mit

Code: Select all

System.Diagnostics.Debug.WriteLine()
oder einer der verwandten statischen Methoden rausschreiben.
Alternativ bietet es sich auch an, eine Log-Datei zu schreiben.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply