在Image上画一条长长的直线---如何画(100分)

  • 主题发起人 whitelion
  • 开始时间
W

whitelion

Unregistered / Unconfirmed
GUEST, unregistred user!
在Form上放一个Scrollbox,
在ScrollBox上放一个Image
设Scroll的height为100,width为100
Image的height为500,width为500
如果我用鼠标拖动的方法画橡皮筋从Image的10,10,到300,300,如何在画线的同时移动
Scroll的位置,以使鼠标能在按下的状态下从10,10,移动下300,300
谢谢了
 
if (x>image1.left+image1.width and x<290 then
if (y<iamge1.top+image1.height and y>290 then
ScrollBox1.ScrollBy(x+10,y-10) else 。。。。
 
image1.Canvas.MoveTo ()
image1.Canvas.LineTo ()
 
to weekboy
能给出一段完整一些的程序吗
 
多人接受答案了。
 
把下面的cad换成image即可
if x <= abs(mycad1.Left) + 5 then
begin
sb1.Perform(WM_HSCROLL, sb_lineLeft, 0);
end;
if x - (sb1.HorzScrollBar.Position) >= sb1.ClientWidth - 20
then
begin
sb1.Perform(WM_HSCROLL, sb_lineRight, 0);
end;
if y <= abs(mycad1.top) + 5 then
begin
sb1.Perform(WM_VSCROLL, sb_lineup, 0);
end;
if y - (sb1.VertScrollBar.Position) >= sb1.ClientHeight - 20
then
begin
sb1.Perform(WM_VSCROLL, sb_linedown, 0);
end;
 
顶部