Tag Archives: Qhov rais tom khw App

Txoj kev sai thiab yooj yim: Txav mus rau ib tug duab plaub siv C# ntawm lub qhov rais tom khw App

Kuv blog philosophy zuag qhia tag nrho yog tias nws tseem zoo txig rau blog hais txog kev laus, tswm compound uas tau raug tuag sim lwm qhov.  Kuv xav tias cov npe no yog ib cov, tab sis kuv yog blogging nws lawm.

Kuv twb tau ua hauj lwm rau ntawm lub qhov rais tom khw app thiab kuv yog tus nyob rau qhov twg kuv yuav tsum tau ua ib co animating.  Rau qhov tus kawg, Koj khom lub kuv twb tau tsheb tawm cov khoom thiab tej daim ntawm qhov rais cia app animation uas, thaum nws puv, yog heev ze rau, tab sis xyov tsis nyiam, Raws li XAML animations nyob .NET (Kuv tabtom tseem tabtom mus grips uas muaj txog ntawd WinRT <> .NET 🙂 ).

No sawv ntxov kuv xav tau ib tug kov rau drag thiab poob haujlwm.  Siv cov lawv kom uas, Kuv bogged tau nqes mus ib cov duab plaub xwb :).  Ntawm no yog cov chaws uas txav ib tug duab plaub thaum cov neeg clicks lub khawm:

   1:   
   2:              MatrixTransform i = (MatrixTransform)rectBig.RenderTransform;
   3:              Matrix m = i.Matrix;
   4:              m.OffsetX  = 10;
   5:              m.OffsetY  = 10;
   6:              i.Matrix = m;
   7:              rectBig.RenderTransform = i;

Qhov ua kom yuam kev ntawm no yog hais tias kuv ncaj qha mus hloov tsis tau OffsetX los yog OffsetY.  Tej zaum yuav muaj ib txoj kev ntse ntau ua qhov no (Yog hais tias koj paub thiab hnov nyiam, thov rooj vag hauv cov lus). 

Yuav kom ua li no, Kuv yuav tau mus:

1. Tau qhov MatrixTransform ntawm tus duab plaub (ntawm casting RenderTransform).

2. Mus rau Matrix ntawm tus txiv leej tub.

3. Hloov cov Matrix offsets.

4. Reassign hauv Matrix rov qab mus rau lub MatrixTransform.

5. Reassign lub MatrixTransform rov rau cov duab plaub.

Sim nws, Muab ib cov duab plaub thiab button qhov screen. Thaum kuv nias lub khawm, cov hais los saum toj logic executes thiab txav tus duab plaub tam sim.

Ntawm tej taw tes, Kuv xav animate no tab sis kuv muaj tsis muaj lub tswv yim ua tau li cas muaj DoubleAnimation ua hauj lwm rau nws (Storyboard.SetTargetProperty() yog tsis rau kuv ntawm no rau lub sij hawm tau).

</kawg>

undefinedSubscribe rau kuv blog.

Raws li kuv nyob Twitter tom http://www.twitter.com/pagalvin