我在使用medical测试加载图片时,图片一直加载不出来;
查看Leadtools.Controls.Medical.js 后发现了这段代码
好像是set_imageURL时没有设置上!
我的代码如下:
window.onload = function () {
// Get the parent DIV
var imageViewerDiv = document.getElementById("MedicalViewerParentDiv");
// Create the medical viewer control, and specify the number or rows and columns.
var viewer = new lt.Controls.Medical.MedicalViewer(imageViewerDiv, 2, 2);
// [optional] Update the splitter size so it become thick and easy to move.
viewer.get_gridLayout().set_splitterSize(7);
// Create a cell name var
cellName = 'MedicalCell' + Date.now();
// Create a cell. It will contain an image or a series of images, based on how many Frames are added (see below for more details).
var cell = new lt.Controls.Medical.Cell(viewer, viewer.get_divId(), 1, 1);
// Set the show border to "true", to show a border around the cell.
cell.set_showFrameBorder(true);
// Add the cell to the viewer.
viewer.layout.get_items().add(cell);
// [optional] Select the cell (it can also be selected by clicking on it.)
cell.set_selected(true);
// Now create a frame object which will hold the image inside the cell.
var cellFrame = new lt.Controls.Medical.Frame(cell);
cellFrame.set_imageURL("http://localhost/testLT/script/img/a.jpg");
// Add the frame to the cell class.
cell.get_frames().add(cellFrame);
console.log(cellFrame.imageURL);
// Now load an image inside the frame by using the following method (and change the url to a valid image url).
//cellFrame.set_imageURL("http://pic6.huitu.com/res/20130116/84481_20130116142820494200_1.jpg");
// [optional] Add an action that allows the user to move the loaded image using either the mouse or by touch and drag. we are adding an offset action.
// var cellFrame2 = new lt.Controls.Medical.Frame(cell);
// cell.get_frames().add(cellFrame2);
// cellFrame2.set_imageURL("script/img/b.jpg");
cell.setCommand(1, new lt.Controls.Medical.OffsetAction());
// [optional] Run the action. Now if the user clicks or touches the image and drags it, the image will move correspondingly.
cell.runCommand(1);
// [optional] Create an overlay text that will appear at the top of the loaded image.
var overlay = new lt.Controls.Medical.OverlayText();
// [optional] Set the aligment for the overlay text.
overlay.set_alignment(lt.Controls.Medical.OverlayAlignment.topLeft);
// [optional] Set the row index of overlay text.
overlay.set_positionIndex(0);
// [optional] Specify that this overlay text is filled by the user through the method (set_text) which is called after this line.
overlay.set_type(lt.Controls.Medical.OverlayTextType.userData);
// [optional] Specify the overlay text.
overlay.set_text("testing overlay text");
// [optional] Add this overlay to the overlay list of the cell. Currently there is only one overlay, but the user can add multiple overlay texts.
cell.get_overlays().add(overlay);
};
<div id="MedicalViewerParentDiv" style="width: 600px; height: 600px; "></div>
|