Topic: WTK2。0怎么画一张图片的一部分上去?

  Print this page

1.WTK2。0怎么画一张图片的一部分上去? Copy to clipboard
Posted by: LOCKEY_WU
Posted on: 2003-07-16 08:53

WTK2。0怎么画一张PNG图片的一部分上去?
或者让图片左右移动,应该如何写?
是用drawimages吗?
请详细说明

2.Re:WTK2。0怎么画一张图片的一部分上去? [Re: LOCKEY_WU] Copy to clipboard
Posted by: javaspirit
Posted on: 2003-07-18 10:27

//Load the image
try{
Image img=Image.createImage("/bg.png");
}
catch(IOException e){
System.out.println("Image Loading Error:"+e);
}
//In canvas's paint()
public void paint(Graphics g){
g.drawImage(img,10,20,20); //x=10,y=20
}
//you can change the x coordinate of the anchor point or the y coordinate of the anchor point in canvas's keyPressed(int keyCode) and then repaint()

3.Re:WTK2。0怎么画一张图片的一部分上去? [Re: LOCKEY_WU] Copy to clipboard
Posted by: yiruo
Posted on: 2003-08-09 13:20

你用setClip或是clipRect方法不就可以了吗?


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923