دوست عزیز اینجا هیچ کس وظیفه نداره به سوالات شما جواب بده و جواب دادن به سوالات شما، لطفی ست که در حق شما می شود ...
من فکر کنم شما بیشتر تو جاوااسکریپت مشکل دارید که گذشته از اون که به این بخش مربوط نمی شه ولی حتما سورس زیر رو مورد مطالعه قرار بدید بلکم گره گشای کارتون باشد.
<script language="javascript">
var mousedown=false;
var xstep=-1;
var ystep=-1;
var cropperX=0;
var cropperY=0;
var cropperWidth=0;
var cropperHeight=0;
var imgWidth=0;
var imgHeight=0;
function Cropper_Onmouseover()
{
document.getElementById("Cropper").style.cursor='m ove';
}
function Cropper_Onmouseout()
{
document.getElementById("Cropper").style.cursor='' ;
}
function Cropper_Onmousedown()
{
cropperWidth=parseInt(document.getElementById("Cro pper").width);
cropperHeight=parseInt(document.getElementById("Cr opper").height);
imgWidth=parseInt(document.getElementById("Image1" ).width);
imgHeight=parseInt(document.getElementById("Image1 ").height);
xstep=event.x-parseInt(document.getElementById("Cropper").style. left);
ystep=event.y-parseInt(document.getElementById("Cropper").style. top);
document.getElementById("hiWidth").value=cropperWi dth;
document.getElementById("hiHeight").value=cropperH eight;
mousedown=true;
}
function Cropper_Onmouseup()
{
xtep=ystep=-1;
mousedown=false;
}
function Cropper_Onmousemove()
{
if(mousedown)
{
var leftset=false,topset=false;
var nextx=event.x-xstep,nexty=event.y-ystep;
cropperX=parseInt(document.getElementById("Cropper ").style.left);
cropperY=parseInt(document.getElementById("Cropper ").style.top);
if(nextx+cropperWidth>imgWidth)
{
document.getElementById("Cropper").style.left=imgW idth-cropperWidth;
leftset=true;
}
if(nexty+cropperHeight>imgHeight)
{
document.getElementById("Cropper").style.top=imgHe ight-cropperHeight;
topset=true;
}
if(nextx<0)
{
document.getElementById("Cropper").style.left=0;
leftset=true;
}
if(nexty<0)
{
document.getElementById("Cropper").style.top=0;
topset=true;
}
if(!leftset)
document.getElementById("Cropper").style.left=next x;
if(!topset)
document.getElementById("Cropper").style.top=nexty ;
document.getElementById("hiX").value=nextx;
document.getElementById("hiY").value=nexty;
}
}
</script>
...
<table class="Cropper" id="Cropper" onmouseover="Cropper_Onmouseover()" onmouseout="Cropper_Onmouseout()"
onmousedown="Cropper_Onmousedown()" onmouseup="Cropper_Onmouseup()" onmousemove="Cropper_Onmousemove()"
style="left: 135px; top: 75px; position: absolute" height="100" width="100">
<tr>
<td>
</td>
</tr>
<tr>
<td align="center">
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Crop" /></td>
</tr>
</table>
<input type="hidden" id="hiX" runat="server" />
<input type="hidden" id="hiY" runat="server" />
<input type="hidden" id="hiWidth" runat="server" />
<input type="hidden" id="hiHeight" runat="server" />
<table style="position: absolute; left: 1px; top: 437px; width: 153px" height="100"
width="100">
<tr>
<td height="46">
Simple Cropper
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
<asp:Image ID="Image1" CssClass="img" runat="server" ImageUrl="~/images/image.jpg" /></div>
کل هلو رو هم .... ببخشید اشتباه گفتم کل برنامه رو هم براتون نوشتم ، کلمه عبور فایل هم www.dotnetsource.com هست.
در ضمن جناب آقای m.hamidreza شما مطالعه بفرمائید :
دوست من تئوری دادن راحته! انجامش سخته! مخصوصا دادن تئوری بدون علم به اینکه توانایی این کار وجود داره یا نه !