Best way to show a picture in an X# VOForm

This forum is meant for questions and discussions about the X# language and tools
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Best way to show a picture in an X# VOForm

Post by ic2 »

Hello,

In a VO datawindow we have a FabPaintLibCtrl which can show a picture with code like this:

Code: Select all

			oImg := FabPaintLib{}
			oImg:CreateFromFile(cJpgFile)
			SELF:oDCfab:Image := oImg
For X#, the Fab libs in the download area are all based on the 2.1 Assembly's for the X# files so they are useless in everything above X# 2.6. Besides, if only a few functions are used a .Net solution is preferable I think.

What is the best solution to do so on a VO style X# window? I assume a Winforms PictureBox control can not be used?

Dick
User avatar
vzeljko
Posts: 35
Joined: Wed Sep 28, 2016 8:02 pm

Best way to show a picture in an X# VOForm

Post by vzeljko »

Dick,
I think that Fab libs are based on X# 2.9.1.1 version.
I prefer .NET classes.

Zeljko
User avatar
Chris
Posts: 4899
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Best way to show a picture in an X# VOForm

Post by Chris »

Hi Dick,

If the dlls are indeed for X# 2.1, you can ask Fabrice to update them.

But I think they include source code as well, so I guess you can simply recompile them (unless there's an error compiling them, in which case again Fabrice would need to have a look).
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Frank Müßner
Posts: 280
Joined: Sat Dec 12, 2015 2:22 pm
Location: Germany

Best way to show a picture in an X# VOForm

Post by Frank Müßner »

Hello Dick,

I use this code when I need a .Netcontrol on a VO window.

Code: Select all

    self:pictureEdit1:= DevExpress.XtraEditors.PictureEdit{}
    self:pictureEdit1:Location := System.Drawing.Point{self:size:Width-175, 124} //tt:Height-289}
    self:pictureEdit1:Name := "e""pictureEdit1"
    self:pictureEdit1:Properties:SizeMode := DevExpress.XtraEditors.Controls.PictureSizeMode.Zoom
    self:pictureEdit1:Properties:BorderStyle := DevExpress.XtraEditors.Controls.BorderStyles.NoBorder
    self:pictureEdit1:Properties:ShowMenu := false
    self:pictureEdit1:Size := System.Drawing.Size{162, 162}
    self:pictureEdit1:Visible := True
    self:pictureEdit1:TabIndex := 500
    SetParent(SELF:pictureEdit1:Handle, self:Handle())
runs without problems until now.

Maybe it will help you

Frank
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Best way to show a picture in an X# VOForm

Post by ic2 »

Hello,

Thanks for all replies. I've downloaded the zip in the download area of this website and checked the assembly in ILSpy. Also the last update date is 11 March 2020 so they can't be up to date.

@Frank: what kind of control is self:pictureEdit1 in your VO datawindow?

We don't have DevExpress but probably we can assign the Winforms PictureEdit the same way as you do for DevExpress?

Otherwise we need to access the code of Fab Paint. Some (but not all) is on Github.

Dick
User avatar
Fabrice
Posts: 458
Joined: Thu Oct 08, 2015 7:47 am
Location: France

Best way to show a picture in an X# VOForm

Post by Fabrice »

Hi Dick,
I see my name and FabPaint, so I jump in....

ALL the source of FabPaint is available on github, int the FabTools repository : https://github.com/X-Sharp/FabTools
If you look closely to the Release area, you will find 3 releases : The latest has been build with 2.9a, 23 days ago.

If it is no young enough, I can rebuild it with 2.10, but as it is all OpenSource code, you can download it and built it yourself...but you will have to use MS Visual Studio for that, sorry... ;)

HTH,
Fab
XSharp Development Team
fabrice(at)xsharp.eu
Frank Müßner
Posts: 280
Joined: Sat Dec 12, 2015 2:22 pm
Location: Germany

Best way to show a picture in an X# VOForm

Post by Frank Müßner »

Hi Dick,

you can take any .Net Control just an example.

Code: Select all

this.pictureBox1 = new System.Windows.Forms.PictureBox();
look at this X# Help:
https://www.xsharp.eu/help/example-4-th ... t-exa.html

Frank
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Best way to show a picture in an X# VOForm

Post by ic2 »

Hello Fabrice,
Fabrice wrote: ALL the source of FabPaint is available on github, int the FabTools repository : https://github.com/X-Sharp/FabTools
Thanks for your reply; we saw that but didn't realize that FabPaint,Zip & More is now part of FabTools. I see it now.
About the download: I think anyone converting a VO application to X# will look in the download area first. It took us quite some time before we realized this pre-2.6 download was responsible for the exception preventing the program to proceed, because VS isn't really helpful in that and the exception that 2.1 references were used did not occur on calling a Fab function but a few lines in the Start function.

Maybe the download on https://www.xsharp.eu/itm-downloads/dow ... XSharp.zip should be called Fabtools 2.1 with some comments? And another one for 2.6 would be helpful for some too. Or otherwise maybe change the last sentence to something like this?


All the source can be found at : ... You will need this solution instead of the above download for X# versions from 2.6 and higher (=Assembly version 2.6)

Dick
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Best way to show a picture in an X# VOForm

Post by ic2 »

Hello Frank,

you can take any .Net Control just an example.
this.pictureBox1 = new System.Windows.Forms.PictureBox();


The sample says:

For this method we use a Windows.Forms.Form window as "Host" for the ActiveX control.

The question is what to use in a VO Form from the Toolbox that appears. I only see FixedBitmap, never used that, but it looks like for that a bitmap should be a predefined resource.

And as FabPaintLib.prg alone is 1721 lines of code, I was wondering if there's a more efficient way of showing a picture on a VO form, like the included pictureBox of Winforms which can be filled with even 1 line of code.

Dick
User avatar
Fabrice
Posts: 458
Joined: Thu Oct 08, 2015 7:47 am
Location: France

Best way to show a picture in an X# VOForm

Post by Fabrice »

ic2 wrote: And as FabPaintLib.prg alone is 1721 lines of code, I was wondering if there's a more efficient way of showing a picture on a VO form, like the included pictureBox of Winforms which can be filled with even 1 line of code.
:lol:
You are right, FabPaintLib is "big", but it does a lot of things.... and you can use it in 2/3 lines to show an image.
I would be curious to know how long is the PictureBox code in .NET to show images....certainly not only one line ! ;)

Cheers,
Fab
XSharp Development Team
fabrice(at)xsharp.eu
Post Reply