Loading...

C# questions

Support for GdPicture Light Imaging Toolkit and GdPicture Pro Imaging ActiveX/SDK.

C# questions

Postby krebsgshannon » Fri Jun 01, 2007 12:01 am

If I instance a form, with the viewer docked to fill said form, and then do the form init as such:

Code: Select all
public frmViewer(string s)
        {
            InitializeComponent();
            axGDV.SetLicenceNumber("deleted");
            System.Threading.Thread.Sleep(50);
            axGDV.DisplayFromFile(s);
        }


(axGDV is the AXGDPicturePro.axgdViewer component)

I get a white display. No image.

If I init as normal:

Code: Select all
        public frmViewer()
        {
            InitializeComponent();
            axGDV.SetLicenceNumber("deleted");
        }


Then I add a toolstrip with a button and put the following in:

Code: Select all
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            axGDV.DisplayFromFile("c:\\test1.jpg");
        }


It displays the image just fine.

Why does it work perfectly one way and not the other?

EDIT: Also, if I init as in the first example that produces a white box, and leave in the toolstrip button, and I click the button, it still displays a white box, no image.
krebsgshannon
 
Posts: 11
Joined: Thu May 31, 2007 9:36 pm

Postby Loïc » Fri Jun 01, 2007 2:41 pm

Hi,

Could you send me this project test by email at esupport (at) gdpicture (dot) com ?

Thanks,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4437
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Postby krebsgshannon » Fri Jun 01, 2007 6:06 pm

Sent via email (it should come from my registered email address).

Thanks again!
krebsgshannon
 
Posts: 11
Joined: Thu May 31, 2007 9:36 pm

Postby Loïc » Mon Jun 04, 2007 10:58 am

Hi,

I've found the problem in your code:

Code: Select all
 Form childForm = new frmViewer("c:\test.jpeg");
// Make it a child of this MDI form before showing it.
childForm.MdiParent = this;
childForm.Text = "Window " + childFormNumber++;
childForm.Show();



In this line:
Code: Select all
 Form childForm = new frmViewer("c:\test.jpeg");


You are trying to show an image file into a GdViewer object but this object is not yet visible at this step.

You can display an image only after this call:


Code: Select all
childForm.Show();


I am not a C# developper but I think it can be possible to do something like that into the form which contains the viewer:


Code: Select all
static string sImagePath;

 
        public frmViewer(string s)
        {
            InitializeComponent();
            axGDV.SetLicenceNumber("XXX");
            sImagePath = s;
        }

        public new void Show()
        {
            axGDV.DisplayFromFile(sImagePath);
        }



Regards,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4437
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Postby krebsgshannon » Mon Jun 04, 2007 7:11 pm

What I actually wound up doing is implementing your solution with a minor twist:

Code: Select all
frmViewer childForm = new frmViewer("c:\test.jpeg");
// Make it a child of this MDI form before showing it.
childForm.MdiParent = this;
childForm.Text = "Window " + childFormNumber++;
childForm.Show2();


then in the frmViewer file:

Code: Select all
        public void Show2()
        {
            this.Show();
            if (strImagePath.Length > 0)
            {
                axGDV.DisplayFromFile(strImagePath);
            }
        }


For some odd reason, I didn't realize that the Show() function was happening *after* the initialization of the control.

Thanks for your help!!
krebsgshannon
 
Posts: 11
Joined: Thu May 31, 2007 9:36 pm

Postby Loïc » Tue Jun 05, 2007 10:02 am

Ok Good ! :D

C# seems to be a very interesting laguage...


Best regards,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4437
Joined: Tue Oct 17, 2006 10:48 pm
Location: France


Return to GdPicture [Pro] ActiveX

Who is online

Users browsing this forum: No registered users and 2 guests

cron