Apr 01, 2013, 8:28 PM
[CLOSED] Adding image to draw example not working
Hi,
Ik want to add an image to the draw 'Australia' example (image under the drawn sprites)
It should be possible to add a sprite to the drawcomponent (src='xxx.png' type=SpriteType.Image).
Unfortunately I can't get it working.
Any idea what is wrong?
Hans
Ik want to add an image to the draw 'Australia' example (image under the drawn sprites)
It should be possible to add a sprite to the drawcomponent (src='xxx.png' type=SpriteType.Image).
Unfortunately I can't get it working.
Any idea what is wrong?
Hans
<%@ Page Language="VB" AutoEventWireup="true" CodeFile="Default4.aspx.vb" Inherits="Default4" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style>
.x-state-desc .x-form-display-field{
font-size: 14px;
}
.x-state-name .x-form-display-field{
text-align:center;
font-weight: bold;
font-size: 20px;
}
</style>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Viewport ID="Viewport1" runat="server">
<LayoutConfig>
<ext:HBoxLayoutConfig Align="Middle" Pack="Center" />
</LayoutConfig>
<Items>
<ext:Panel ID="pnlMap" runat="server"
Title="Kaart"
Border="true" Header="true"
Collapsed="false"
Collapsible="false"
MinWidth="900"
Width="900"
MinHeight="500"
Height="500"
MarginsSummary="0 0 0 0"
CMarginsSummary="0 0 0 0"
AutoScroll="false"
Padding="0" >
<Items>
<ext:DrawComponent ID="drawMap" runat="server" ViewBox="false" >
</ext:DrawComponent>
</Items>
</ext:Panel>
</Items>
</ext:Viewport>
</form>
</body>
</html>
Partial Class Default4
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
If (Not Page.IsPostBack) Then
pnlMap.MinHeight = 500
pnlMap.MinWidth = 950
drawMap.MinHeight =500
drawMap.MinWidth = 950
If (Not ExtX.IsAjaxRequest) Then
Dim sprite As Sprite = New Sprite
sprite.SpriteID = "sprite0"
sprite.Type = SpriteType.Image
sprite.Src = "~/images/Afbeelding1.png"
drawMap.Items.Add(sprite)
sprite.Show(True)
addSprites()
End If
End If
End Sub
Sub addSprites()
Dim draw As DrawComponent = Me.drawMap
Dim doc As System.Xml.XmlDocument = New System.Xml.XmlDocument()
doc.Load(Server.MapPath("Australia.xml"))
Dim info As List(Of GeoLocs) = New List(Of GeoLocs)
Dim i As Integer = 0
For Each state As System.Xml.XmlNode In doc.SelectNodes("states/state")
Dim iSelected As Integer = CInt(state.SelectSingleNode("selected").InnerText)
Dim sprite As Sprite = New Sprite
sprite.SpriteID = "sprite" + CStr(i)
sprite.Type = SpriteType.Path
sprite.Path = state.SelectSingleNode("path").InnerText
sprite.Stroke = "#FF0000"
sprite.StrokeWidth = 1
sprite.StrokeLinejoin = StrokeLinejoin.Round
sprite.Cursor = "pointer"
sprite.ZIndex = 210
Dim dOpacity As Double = 0.59999999999999998
sprite.FillOpacity = dOpacity
sprite.Fill = "#00FF00"
draw.Items.Add(sprite)
sprite.Show(True)
i += 1
Next
End Sub
Public Class GeoLocs
Property state As String
Property selected As Integer
Property desc As String
End Class
End Class
Last edited by Daniil; Apr 04, 2013 at 1:08 PM.
Reason: [CLOSED]