Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
Picture Control Zoom property
I use the code below for setup and the OnFileDrop event. The issue is the last two lines of code. The value of the variable ZoomFactor for Set_Property is different from the value of ZoomFactor immediately returned by the Get_Property.
Get_Property always returns a larger (incorrect value) value than what was set. That is, the picture is sized (incorrectly) according to the value that Get_Property returns, not what was in Set_Property.
In the example code below the VeiwerWidth = 210, ImageWidth = 640. ZoomFactor calculates to 0.328125. Get_Property returns .500, and the picture is sized to a ZoomFactor of .500.
Setup
OnFileDrop event
Get_Property always returns a larger (incorrect value) value than what was set. That is, the picture is sized (incorrectly) according to the value that Get_Property returns, not what was in Set_Property.
In the example code below the VeiwerWidth = 210, ImageWidth = 640. ZoomFactor calculates to 0.328125. Get_Property returns .500, and the picture is sized to a ZoomFactor of .500.
Setup
Ctrl = @Window:".PIC_VIEWER"
Set_Property(Ctrl, "OLE.BackgroundColor", "Black")
Set_Property(Ctrl, "OLE.AutoLoadDropFile", True$)
Set_Property(Ctrl, "OLE.BorderType", "Bevel Sunken")
Set_Property(Ctrl, "OLE.Caption", "No Picture Available":@TM:@TM:"Drag and drop image files here.")
Set_Property(Ctrl, "OLE.CaptionColor", "White")
Set_Property(Ctrl, "OLE.Font", Arial_8_Reg$)
Set_Property(Ctrl, "OLE.Layout", "Pan")
OnFileDrop event
Ctrl = @Window:".PIC_VIEWER"
ViewerWidth = Get_Property(Ctrl, "SIZE")<3> ;* Width of the picture control.
ImageWidth = Get_Property(Ctrl, "OLE.ImageSize")<1>
If ImageWidth > 0 then
ZoomFactor = ViewerWidth / ImageWidth
end else
ZoomFactor = 1
end
Set_Property(Ctrl, "OLE.Zoom", ZoomFactor)
ZoomFactor = Get_Property(Ctrl, "OLE.Zoom")
Comments
Don
Your image viewer, is this on the MDI Frame itself or in an MDI Child?
The viewer is on the Frame. The user can associate any row in the MDI Child EditTable with an image. There is an indicator on each row that allows the user to know which rows have images associated with them. If the viewer pane is not visible, they can click on the indicator or the Viewer Pane toolbar button to view it. If the pane is already visible, the images are automatically displayed in the pane as the user naviagtes from row to row.
Don
Thanks for the update. However, there appears to be a problem with the picture control using the new 3.0.6 OCX. On the CREATE event it causes the event chain "ding" sound. To test this, create a new form with an edit line and an OLE picture control. Save it and test run the form. You should here the "ding" sound.
I'm using OI 9.3.1 and SRP Controls Pro.
Don
I traced the source of the "ding" sound to the code below in the FrameWorks promoted CREATE event. This code does not trigger the sound with the previous version of the OCX. Is this FrameWorks code still necessary?
Don
// Turn on the WS_CLIPCHILDREN style but to avoid OLE control flicker when windows // are being resized. This is a problem introduced in OpenInsight 7.1 Style = Get_Property(Ctrl, "STYLE") If Style[1, 2] _EQC "0x" then Convert @LOWER.CASE to @UPPER.CASE in Style Style = IConv(Style[3, 99], "MX") end Style = BitOr(Style, WS_CLIPCHILDREN$) Set_Property(Ctrl, "STYLE", Style)