How can I assign jpg file name(picFileName parameter) to mic

Posted by memoxoz on 02-Jul-2019 07:42

My class name is ornekrpr.cls. I have OpenEdge Progress Developer Studio 11.7. I call ornekrpr.cls by another procedure and I send picFileName parameter as input parameter. How can I assign the picFilename parameter to picturebox1.image.


USING Progress.Lang.*.
USING Progress.Windows.Form.
USING System.Windows.Forms.PropertyGridInternal.PropertiesTab FROM ASSEMBLY.

ROUTINE-LEVEL ON ERROR UNDO, THROW.

CLASS ornekrpr INHERITS Form:

DEFINE PRIVATE VARIABLE components AS System.ComponentModel.IContainer NO-UNDO.
DEFINE PRIVATE VARIABLE pictureBox1 AS System.Windows.Forms.PictureBox NO-UNDO.


CONSTRUCTOR PUBLIC ornekrpr (INPUT picFileName AS CHARACTER):

SUPER().
InitializeComponent(picFileName).
THIS-OBJECT:ComponentsCollection:ADD(THIS-OBJECT:components).
CATCH e AS Progress.Lang.Error:
UNDO, THROW e.
END CATCH.

END CONSTRUCTOR.

METHOD PRIVATE VOID InitializeComponent(INPUT picFileName AS CHARACTER):

/* NOTE: The following method is automatically generated.

We strongly suggest that the contents of this method only be modified using the
Visual Designer to avoid any incompatible modifications.

Modifying the contents of this method using a code editor will invalidate any support for this file. */
@VisualDesigner.FormMember (NeedsInitialize="true").
DEFINE VARIABLE resources AS Progress.Util.ResourceManager NO-UNDO.
resources = NEW Progress.Util.ResourceManager("ornekrpr").
THIS-OBJECT:pictureBox1 = NEW System.Windows.Forms.PictureBox().
CAST(THIS-OBJECT:pictureBox1, System.ComponentModel.ISupportInitialize):BeginInit().
THIS-OBJECT:SuspendLayout().
/* */
/* pictureBox1 */
/* */
THIS-OBJECT:pictureBox1:Dock = System.Windows.Forms.DockStyle:Fill.
THIS-OBJECT:pictureBox1:Image = CAST(resources:GetObject("pictureBox1.Image"), System.Drawing.Image).
THIS-OBJECT:pictureBox1:Location = NEW System.Drawing.Point(0, 0).
THIS-OBJECT:pictureBox1:Name = "pictureBox1".
THIS-OBJECT:pictureBox1:Size = NEW System.Drawing.Size(1112, 634).
THIS-OBJECT:pictureBox1:SizeMode = System.Windows.Forms.PictureBoxSizeMode:Zoom.
THIS-OBJECT:pictureBox1:TabIndex = 0.
THIS-OBJECT:pictureBox1:TabStop = FALSE.
THIS-OBJECT:pictureBox1:Click:Subscribe(THIS-OBJECT:pictureBox1_Click).
/* */
/* ornekrpr */
/* */
THIS-OBJECT:ClientSize = NEW System.Drawing.Size(1112, 634).
THIS-OBJECT:Controls:Add(THIS-OBJECT:pictureBox1).
THIS-OBJECT:Name = "ornekrpr".
THIS-OBJECT:Text = "ornekrpr".
CAST(THIS-OBJECT:pictureBox1, System.ComponentModel.ISupportInitialize):EndInit().
THIS-OBJECT:ResumeLayout(FALSE).
CATCH e AS Progress.Lang.Error:
UNDO, THROW e.
END CATCH.
END METHOD.

/*------------------------------------------------------------------------------
Purpose:
Notes:
------------------------------------------------------------------------------*/
@VisualDesigner.
METHOD PRIVATE VOID pictureBox1_Click( INPUT sender AS System.Object, INPUT e AS System.EventArgs ):

RETURN.

END METHOD.

DESTRUCTOR PUBLIC ornekrpr ( ):

END DESTRUCTOR.

END CLASS.

Posted by frank.meulblok on 02-Jul-2019 09:32

Use:

pictureBox1:ImageLocation = picFileName.

or

pictureBox1:Load(picFileName).

Do that in the Constructor, after the call to InitializeComponent.

Modifying the InitializeComponent method itself for this kind of thing is asking for trouble, since that is auto-generated by the tooling for the designer. You risk breaking the designer, or losing your added code.

All Replies

Posted by frank.meulblok on 02-Jul-2019 09:32

Use:

pictureBox1:ImageLocation = picFileName.

or

pictureBox1:Load(picFileName).

Do that in the Constructor, after the call to InitializeComponent.

Modifying the InitializeComponent method itself for this kind of thing is asking for trouble, since that is auto-generated by the tooling for the designer. You risk breaking the designer, or losing your added code.

Posted by memoxoz on 02-Jul-2019 11:24

Hi Frank,

I really appreciate the assistance you have provided me. The problem is solved with your guidance. Thanking you.

Best regards,

Mehmet Özcan

This thread is closed