View Full Version : [CLOSED] changing already created sprite data from code behind

Sep 03, 2013, 9:30 AM

I ask myself a question since a while. I have solved it, but want to know it there is a better solution.

I my soft, I have to play with sprites to draw arrows (I make a "sort of" visio interface).

To create my sprites, I do something like that:

Dim mySpriteArrow As Sprite = New Sprite 'path sprite

With mySpriteArrow 'define arrow
.SpriteID = "myArrow" + ds.Tables("arrows").Rows(i).Item("ArrowID").ToString 'ID (myArrow1, myArrow2, ..., myArown
.Type = SpriteType.Path
.Path = NewPath
.Stroke = "#3457B6"
.StrokeWidth = 2
'.Fill = "#34ADB6" 'in case inner arrow must be filled
End With

drwVMProcess.Add(mySpriteArrow) 'add sprites to drawer
mySpriteArrow.Show(True) 'show it

All works fine. I have panels at start and en of arrow to simulate some process of course.

But, when I move process, I will have to change the path.

I use


drwVMProcess is my DrawComponent and
ArrowsToDealWith(i) my sprite name, but the only thing I'm able to do with that is to call the Remove method, and create a new sprites with modified path.

It works, but the question is :

is there a way to get all javascript sprite object and change only data needed to redraw it?

Sep 03, 2013, 2:04 PM
Hi @feanor91,

It is possible to change some sprite attributes without removing it.

Please clarify what exactly do you need to change in a sprite?

Sep 03, 2013, 2:25 PM

i will check that.

For now, I need to change path (and redraw it), position and size for sprite circles

Sep 03, 2013, 3:23 PM
I am not sure what "path" do you mean regarding circles... Could you, please, elaborate?

As for sizing and positioning, I think it is possible to do without removing a sprite.

Sep 03, 2013, 3:54 PM
I mean nothing regarding circle. Ihave path sprite on a side and circle sprite on another, I have both type

Sep 04, 2013, 5:31 AM
Thank you for clarifying.

It appears to be possible to change a Path as well.


<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<script runat="server">
protected void ChangePath(object sender, DirectEventArgs e)
Draw1.GetSprite("Sprite1").SetAttributes(new SpriteAttributes
Path = "M200,200 h-50 a50,50 0 1,0 50,-50 z"

<!DOCTYPE html>
<head runat="server">
<title>Ext.NET v2 Example</title>
<form runat="server">
<ext:ResourceManager runat="server" />

<ext:Viewport runat="server" Layout="FitLayout">
<ext:Panel runat="server" Layout="FitLayout">
<ext:Toolbar runat="server">
<ext:Button runat="server" Text="Change Path" OnDirectClick="ChangePath" />
<ext:DrawComponent ID="Draw1" runat="server">
Path="M 100 100 L 300 100 L 200 300 z"
Fill="green" />


Sep 04, 2013, 7:26 AM
Works like a charm. Thank you