c# - Breaking cumulative transformations -


i using drawingcontext object draw series of rectangles. requirement this:

  1. first rectangle want place at(100, 100)
  2. second rectangle want place at(200, 200)
  3. third rectangle want place at(0, 0)

i using transformation matrix achieve follows:

  1. to position first rectangle @ (100, 100) use following:

    drawingcontext.pushtransform(new translatetransform(100, 100)); drawingcontext.drawrectangle(brushes.blue, null, new rect(0, 0, 100, 100));

  2. to position second rectangle @ (200, 200) use following: drawingcontext.pushtransform(new translatetransform(100, 100)); drawingcontext.drawrectangle(brushes.blue, null, new rect(0, 0, 100, 100));

  3. to position third rectangle @ (0, 0) can use (-200, -200). curious there way can replace cumulative chain , overwrite entire matrix new position like: drawingcontext.pushtransform(new translatetransform(0, 0));

this possible on winforms graphics setting transform property follows:

g.transform = new matrix(); 

is there way in can break cumulative chain in wpf

you this:

drawingcontext.pushtransform(new translatetransform(100, 100));       drawingcontext.drawrectangle(brushes.blue, null, new rect(0, 0, 100, 100)); drawingcontext.pop(); 

the pop() method resets transform state before call pushtransform().


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -