473,378 Members | 1,106 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

image in treeview control not aligned to top

Hello everyone,

I have downloaded and installed the IE Web controls for Microsoft and I am
using the Treeview control to display a simply hierarchy

However, I cannot seem to get the Image associated with the node to align
vertically (top) to the actual contents of the node.

Example
topnode
(I want the Graphic here) line1 of middle node
line2 of middle node
(Graphic appears here) line3 of middle node
line4 of middle node
line5 of middle node
(I want the graphic here) Line1 of end node
(Graphic appears here) line2 of end node
line3 of end node

I am dynamically creating the nodes, and the code is as follows:
Public Sub PopulateDataTree(ByVal ds As DataSet)
Dim pma_keyrow As DataRow
Dim newpmanode As TreeNode
Dim spacebr11 As String = "<br>"
Dim prevlevel1, prevlevel2, prevlevel3, prevlevel4 As String
For Each pma_keyrow In ds.Tables("AllViewPMA").Rows
' Create the header row using the Level1, level2, level3, level4
names
If prevlevel1 = pma_keyrow("Level1Name") And prevlevel2 =
pma_keyrow("Level2Name") And prevlevel3 = pma_keyrow("Level3Name") And
prevlevel4 = pma_keyrow("Level4Name") Then
' do not add a new pma level node
Else
Dim LevelNameCombo As New StringBuilder
With LevelNameCombo
.Append(pma_keyrow("Level1Name").ToString)
.Append("/")
.Append(pma_keyrow("Level2Name").ToString)
.Append("/")
.Append(pma_keyrow("Level3Name").ToString)
.Append("/")
.Append(pma_keyrow("Level4Name").ToString)
End With
newpmanode = New TreeNode
newpmanode.Text = LevelNameCombo.ToString
newpmanode.SelectedImageUrl = "/GISWEB_DEV/GUI/IMAGES/pma.gif"
newpmanode.ImageUrl = "/GISWEB_DEV/GUI/IMAGES/pma.gif"
newpmanode.ExpandedImageUrl = "/GISWEB_DEV/GUI/IMAGES/pma.gif"
treePMAView.Nodes.Add(newpmanode)
End If
Dim KeyNode As New TreeNode
Dim KeyNameCombo As New StringBuilder
With KeyNameCombo
.Append("Location: ")
.Append(pma_keyrow("LocCode"))
.Append(spacebr11)
.Append("Centre: ")
.Append(pma_keyrow("PCCode"))
.Append(spacebr11)
.Append("Product: ")
.Append(pma_keyrow("ProdCode"))
.Append(spacebr11)
.Append("Breakdown: ")
.Append(pma_keyrow("BreCode"))
.Append(spacebr11)
.Append("Metric: ")
.Append(pma_keyrow("MetCode"))
.Append("<br>")
End With
KeyNode.Text = KeyNameCombo.ToString
KeyNode.SelectedImageUrl = "/GISWEB_DEV/GUI/IMAGES/key.gif"
KeyNode.ImageUrl = "/GISWEB_DEV/GUI/IMAGES/key.gif"
KeyNode.DefaultStyle = New
CssCollection("font-family:verdana;vertical-align:top;")
KeyNode.ExpandedImageUrl = "/GISWEB_DEV/GUI/IMAGES/key.gif"
newpmanode.Nodes.Add(KeyNode)
Dim dv As DataView
dv = New DataView(ds.Tables("AllDatakeyAttributes"),
"PMA_DatakeyId = '" & pma_keyrow("PMA_DatakeyId").ToString & "'", "",
DataViewRowState.CurrentRows)
Dim attrrow As DataRowView
Dim attrtext As String = ""
For Each attrrow In dv
Dim AttrNameCombo As New StringBuilder
With AttrNameCombo
.Append(attrrow("AttributeCodeValue"))
.Append("<br>")
End With
attrtext = attrtext & AttrNameCombo.ToString
Next
If dv.Count > 0 Then
Dim attrnode As New TreeNode
attrnode.SelectedImageUrl =
"/GISWEB_DEV/GUI/IMAGES/attributes.gif"
attrnode.ImageUrl = "/GISWEB_DEV/GUI/IMAGES/attributes.gif"
attrnode.ExpandedImageUrl =
"/GISWEB_DEV/GUI/IMAGES/attributes.gif"
attrnode.DefaultStyle = New
CssCollection("font-family:verdana;vertical-align:top;")
attrnode.Text = attrtext.Substring(0,
attrtext.ToString.Length - 4)
KeyNode.Nodes.Add(attrnode)
End If
prevlevel1 = pma_keyrow("Level1Name")
prevlevel2 = pma_keyrow("Level2Name")
prevlevel3 = pma_keyrow("Level3Name")
prevlevel4 = pma_keyrow("Level4Name")
Next
End Sub

How can I programatically set the alignment of the <tr> for the node to
valign = top?

Basically if i knew how to get to the <tr> or <td> tags that is being
autogenerated by the control I could modify it with Valign = top which should
solve my problem. However How do i do this?

Thanks for all your help

Corey
Jul 21 '05 #1
0 1376

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Anthony Boudouvas | last post by:
Hi to all, i have a treeview that i put some nodes in it with their repsective images. If i try to change the image and set it to some other ImageList index, nothing happens. The code i use...
2
by: Adie | last post by:
Hi, does anyone know how to set up a form with a treeview aligned left with a monthcalendar control beneath it and have it resize corrctly, so that the month sticks to the bottom of the form and...
0
by: kiran | last post by:
How to set background image for treeview control or transparent color as a background for treeview control in Windows forms..? Regards kiran
4
by: Samuel R. Neff | last post by:
I have a set of radio buttons in a win form that each have an image and text, like so: O O O O How can I set it up so that the image is left aligned, next to the radio button...
0
by: Sarika | last post by:
Hi, I am a little confused about associating an image w/ the VB.NET TreeView Control. My specific requirement is that I want to associate an image w/ some specific nodes in the TreeView only. ...
0
by: CoreyMas | last post by:
Hello everyone, I have downloaded and installed the IE Web controls for Microsoft and I am using the Treeview control to display a simply hierarchy However, I cannot seem to get the Image...
8
by: Cardman | last post by:
I am hopeful that someone can quickly solve my image alignment issue when things are just not going right and where my attempts to solve this alignment issue have all failed. First of all take a...
10
by: Adam Honek | last post by:
Hi all, Controls such as the tree view or list view use image lists hence I can set the quality of icons to 32bit. This way they look their best. Unfortunately both the menu and tool bar strip...
4
by: =?Utf-8?B?UGF0cmlja1M=?= | last post by:
I'd like to be able to give a treeview in my application a nice smooth gradient as a background image, but I'm having trouble doing this. Webpages that I've seen so far seem to suggest using the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.