<HTML>
<HEAD>
<TITLE>DirectX Media SDK DirectAnimation Tutorial</TITLE>
<LINK REL=STYLESHEET HREF="../../../../../webcd/da/tutorial.css">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso8859-1">
<META NAME="MS.LOCALE" CONTENT="EN-US">
<META NAME="ROBOTS" CONTENT="noindex">
</HEAD>
<BODY BGCOLOR="WHITE" LINK=#0033CC TOPMARGIN=0 LEFTMARGIN=20>
<!--TOOLBAR_START-->
<!--TOOLBAR_EXEMPT-->
<!--TOOLBAR_END-->

<DIV CLASS="flush">
<TABLE WIDTH=100% BORDER=0 BGCOLOR=#000000>
<TR ALIGN=RIGHT><TD VALIGN=TOP><FONT CLASS=desc1 SIZE=2>
<A HREF="Section3.html" TARGET="_top">
<IMG SRC="../../../../../media/image/u_prev.gif"
 WIDTH=71 HEIGHT=16 BORDER=0 ALT="Previous Topic">
</A><A HREF="../../../../../webcd/da/tutorial_main.htm" TARGET="_top">
<IMG SRC="../../../../../media/image/d_home.gif" WIDTH=48 HEIGHT=16 BORDER=0 ALT="Tutorial Home Page"></A>
<A HREF="Section5.html" TARGET="_top">
<IMG SRC="../../../../../media/image/u_next.gif" WIDTH=48 HEIGHT=16 BORDER=0 ALT="Next Topic">
</A></FONT></TD><TD WIDTH=30></TD></TR></TABLE></DIV>
<FONT CLASS=title><CENTER>Using Draggables for Control Points</CENTER></FONT>

<FONT CLASS=code>
</FONT>

<TABLE><TR><TD WIDTH=500><FONT CLASS=desc1><BR>
 Here, use the draggable class from the utility library.
 Construct a draggable based on a small (4 mm) cube with a reactive color
 the color is green while dragged and red otherwise. Provide accessors to get
 back the image and the position point of the draggable.
<BR></TD></TR></FONT></TABLE>
<FONT CLASS=code><BR>
class DraggableButton extends Statics {<BR>
<BR>
<DIV STYLE="margin-left: 0.125in">public DraggableButton(Point2Bvr initPt2) {<BR>
</DIV><BR>
<DIV STYLE="margin-left: 0.25in">NumberBvr halfDimNum = toBvr(2*mm);<BR>
ColorBvr cClr = ColorBvr.newUninitBvr();<BR>
ImageBvr blockImg = solidColorImage(cClr).<BR>
</DIV><DIV STYLE="margin-left: 0.375in">crop(point2(neg(halfDimNum), neg(halfDimNum)), point2(halfDimNum, halfDimNum));<BR>
</DIV><DIV STYLE="margin-left: 0.5in"><BR>
</DIV><DIV STYLE="margin-left: 0.25in">_dragImg = new DraggableImage(blockImg, initPt2);<BR>
</DIV><BR>
<DIV STYLE="margin-left: 0.25in">cClr.init(until(red, _dragImg.getGrabEvent(),<BR>
</DIV><DIV STYLE="margin-left: 0.9375in">until(green, _dragImg.getReleaseEvent(), cClr)));<BR>
</DIV><DIV STYLE="margin-left: 0.125in">}<BR>
<BR>
public ImageBvr getImageBvr() { return _dragImg.getImageBvr(); }<BR>
public Point2Bvr getPointBvr() { return _dragImg.getPointBvr(); }<BR>
DraggableImage _dragImg;<BR>
</DIV>}<BR>
<BR>
<BR>
</FONT><FONT CLASS=link><A ID=cpslug HREF="../../../../../help/da/dalegal.htm" TARGET="_top">&#169; 1997 Microsoft Corporation. All rights reserved. Terms of Use.</A></FONT>

<BR>
<BR>
<DIV CLASS="flush">
<TABLE WIDTH=100% BORDER=0 BGCOLOR=#000000>
<TR ALIGN=RIGHT><TD VALIGN=TOP><FONT CLASS=desc1 SIZE=2>
<A HREF="Section3.html" TARGET="_top">
<IMG SRC="../../../../../media/image/u_prev.gif"
 WIDTH=71 HEIGHT=16 BORDER=0 ALT="Previous Topic">
</A><A HREF="../../../../../webcd/da/tutorial_main.htm" TARGET="_top">
<IMG SRC="../../../../../media/image/d_home.gif" WIDTH=48 HEIGHT=16 BORDER=0 ALT="Tutorial Home Page"></A>
<A HREF="Section5.html" TARGET="_top">
<IMG SRC="../../../../../media/image/u_next.gif" WIDTH=48 HEIGHT=16 BORDER=0 ALT="Next Topic">
</A></FONT></TD><TR><TD WIDTH=30></TD></TR></TABLE></DIV>

</BODY>
</HTML>
