473,386 Members | 1,821 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,386 software developers and data experts.

TreeView and FullRowSelect question

rh
I created a user control that is made up of a TreeView and a VScrollBar. I
set the TreeView.FullRowSelect = True and it works as expected (full row is
visible, appears on top of everything else) but only sometimes. Other times
it appears behind the parent form and all that is visible is the last few
characters of that row.

Anyone know what might be causing this and how I can fix it? Thanks.
Nov 21 '05 #1
5 1656
rh,

What do you mean by it appears behind the parent form? That says to me
that you can't see the tree view at all.

Can you post a picture of what you mean, or some code that shows the
error (or an example we can run)?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"rh" <rh******@smci.com> wrote in message
news:uq**************@tk2msftngp13.phx.gbl...
I created a user control that is made up of a TreeView and a VScrollBar. I
set the TreeView.FullRowSelect = True and it works as expected (full row is
visible, appears on top of everything else) but only sometimes. Other times
it appears behind the parent form and all that is visible is the last few
characters of that row.

Anyone know what might be causing this and how I can fix it? Thanks.

Nov 21 '05 #2
rh,

I see the image, but I am not sure what you want. The selection crosses
the full length of the control. How much longer do you want it to extend?

Or do you mean the tool tip is showing up behind the form? I think that
is what you are referring to.

Is your app stand-alone (meaning no special database stuff, supporting
files, etc, etc). If so, can you post it?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"rh" <rh******@smci.com> wrote in message
news:eh**************@TK2MSFTNGP12.phx.gbl...
Please refer to the attached JPG image. Let me know if you also need the
see the code.

Thanks for any help.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in message news:%2****************@TK2MSFTNGP09.phx.gbl...
rh,

What do you mean by it appears behind the parent form? That says to
me
that you can't see the tree view at all.

Can you post a picture of what you mean, or some code that shows the
error (or an example we can run)?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"rh" <rh******@smci.com> wrote in message
news:uq**************@tk2msftngp13.phx.gbl...
I created a user control that is made up of a TreeView and a VScrollBar.
I
set the TreeView.FullRowSelect = True and it works as expected (full row
is
visible, appears on top of everything else) but only sometimes. Other
times
it appears behind the parent form and all that is visible is the last few
characters of that row.

Anyone know what might be causing this and how I can fix it? Thanks.



Nov 21 '05 #3
Just for grins, try calling the forms Refresh and/or Invalidate methods when
you select a node. I believe it's the treeview's AfterSelect event.

Yosh


"rh" <rh******@smci.com> wrote in message
news:eh**************@TK2MSFTNGP12.phx.gbl...
Please refer to the attached JPG image. Let me know if you also need the
see the code.

Thanks for any help.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in message news:%2****************@TK2MSFTNGP09.phx.gbl...
rh,

What do you mean by it appears behind the parent form? That says to
me
that you can't see the tree view at all.

Can you post a picture of what you mean, or some code that shows the
error (or an example we can run)?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"rh" <rh******@smci.com> wrote in message
news:uq**************@tk2msftngp13.phx.gbl...
I created a user control that is made up of a TreeView and a VScrollBar.
I
set the TreeView.FullRowSelect = True and it works as expected (full row
is
visible, appears on top of everything else) but only sometimes. Other
times
it appears behind the parent form and all that is visible is the last few
characters of that row.

Anyone know what might be causing this and how I can fix it? Thanks.



Nov 21 '05 #4
rh
Yes, I am referring to the Tool Tip showing up behind the form instead of in
front of the form.

I tried recreating the code in order to make it stand alone so I can post
it, but the problem doesn't occur with my recreated code. I'll post the full
code as soon as I can.

For now, here's the code for the TreeView that I use:

Option Strict On

Option Explicit On

Imports System.Windows.Forms

Namespace SMCI.Common.UI

Public Class SMCITreeView

Inherits TreeView

Private Const SIF_DISABLENOSCROLL As Long = &H8& '8

Private Const SIF_PAGE As Long = &H2&

Private Const SIF_POS As Long = &H4&

Private Const SIF_RANGE As Long = &H1&

Private Const SIF_TRACKPOS As Long = &H10& '10

Private Const SIF_ALL As Long = SIF_RANGE Or SIF_PAGE Or SIF_POS Or
SIF_TRACKPOS

Private Const SBS_HORZ As Long = 0

Private Const SBS_VERT As Long = 1

Private Const WM_VSCROLL As Int32 = &H115

Private Const SB_THUMBPOSITION As Long = 4 ' &H4 'after mouse up

Private pnScrollPage As Integer ' Same as LargeChange

Private pnScrollPos As Integer

Private pnScrollMin As Integer

Private pnScrollMax As Integer

Public IsVScrollVisible As Boolean

Public IsHScrollVisible As Boolean

'Public IsInitComplete As Boolean

' Events

Public Event ScrollChanged()

Public Event VScrollVisibleChanged(ByVal tlVisible As Boolean)

Public Event HScrollVisibleChanged(ByVal tlVisible As Boolean)

Public Structure SCROLLINFO

Public cbSize As Integer

Public fMask As Integer

Public nMin As Integer

Public nMax As Integer

Public nPage As Integer

Public nPos As Integer

Public nTrackPos As Integer

End Structure

Declare Function GetScrollInfo Lib "user32" (ByVal hWnd As IntPtr, ByVal
nBar As Integer, _

ByRef lpScrollInfo As SCROLLINFO) As Integer

Declare Auto Function SendMessage Lib "User32" (ByVal hwnd As System.IntPtr,
ByVal msg As Int32, _

ByVal wParams As Int64, ByVal lParams As Int32) As Long

Public ReadOnly Property ScrollPage() As Integer

Get

Return Me.pnScrollPage

End Get

End Property

Public ReadOnly Property ScrollPos() As Integer

Get

Return Me.pnScrollPos

End Get

End Property

Public ReadOnly Property ScrollMin() As Integer

Get

Return Me.pnScrollMin

End Get

End Property

Public ReadOnly Property ScrollMax() As Integer

Get

Return Me.pnScrollMax

End Get

End Property

Public Sub ScrollWindow(ByVal tnChange As Integer)

Dim lnPosition As Integer = Me.ScrollPos + tnChange

If lnPosition < 0 Then

lnPosition = 0

ElseIf lnPosition > Me.ScrollMax - Me.ScrollPage + 1 Then

lnPosition = Me.ScrollMax - Me.ScrollPage + 1

End If

' Call SendMessage() to simulate movement of the ScrollBar (Reference:
http://www.vbcity.com/forums/topic.asp?tid=55822)

SendMessage(Me.Handle, WM_VSCROLL, SB_THUMBPOSITION + &H10000 * lnPosition,
Nothing)

End Sub

Private Sub MyTreeView_Resize(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Resize

' NOTE: Don't do anything with this event

' The below code causes the FullRowSelect property to not work properly

' So comment it out

'Me.RefreshScrollBarData()

End Sub

' Overriding WndProc() will allow you to intercept all of the messages

' that pass through the control. Use it to catch the scrolling events.

Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)

MyBase.WndProc(m)

' This raises the ScrollChanged() event if any scroll action occurs,

' which keeps the custom ScrollBar with the TreeView's ScrollBar in sync

Me.RefreshScrollBarData()

End Sub

' Call this function to keep the custom ScrollBar with the TreeView's
ScrollBar in sync

Public Function RefreshScrollBarData() As SCROLLINFO
' Horizontal Scroll

Dim loHSI As New SCROLLINFO

loHSI.fMask = Me.SIF_ALL ' Set the fMask member to specify the scroll bar
parameters to retrieve

If GetScrollInfo(Me.Handle, Me.SBS_HORZ, loHSI) = 0 Then ' Non-zero
indicates success

If Me.IsHScrollVisible = True Then

RaiseEvent HScrollVisibleChanged(False)

Me.IsHScrollVisible = False

End If

Else

If loHSI.nPage > 0 And loHSI.nMax > 0 Then ' nPage must be > 0 for the
ScrollBar to be visible

If Me.IsHScrollVisible = False Then

RaiseEvent HScrollVisibleChanged(True)

Me.IsHScrollVisible = True

End If

Else

If Me.IsHScrollVisible = True Then

RaiseEvent HScrollVisibleChanged(False)

Me.IsHScrollVisible = False

End If

End If

End If

' Vertical Scroll

Dim loVSI As New SCROLLINFO

loVSI.fMask = SIF_ALL

If GetScrollInfo(Me.Handle, SBS_VERT, loVSI) = 0 Then

If Me.IsVScrollVisible Then

RaiseEvent VScrollVisibleChanged(False) ' Visibility has changed: True ->
False, raise event

Me.IsVScrollVisible = False

End If

Else

Dim llRaiseScrollChanged As Boolean = False

If loVSI.nPos <> Me.ScrollPos OrElse loVSI.nMax <> Me.ScrollMax OrElse
loVSI.nPage <> Me.ScrollPage Then

llRaiseScrollChanged = True ' Raise the ScrollChanged event if one of the
values have changed

End If

' Set the ScrollBar properties ---

Me.pnScrollPos = loVSI.nPos

Me.pnScrollPage = loVSI.nPage

Me.pnScrollMin = loVSI.nMin

Me.pnScrollMax = loVSI.nMax

'---------------------------------

If Me.ScrollMin = 0 AndAlso Me.ScrollMax = 0 Then

If Me.IsVScrollVisible Then

RaiseEvent VScrollVisibleChanged(False) ' Visibility has changed: True ->
False, raise event

Me.IsVScrollVisible = False

End If

Else

If Me.IsVScrollVisible = False Then

If loVSI.nPage > 0 And loVSI.nMax > 0 Then ' nPage must be > 0 for the
ScrollBar to be visible

RaiseEvent VScrollVisibleChanged(True) ' Visibility has changed: False ->
True, raise event

Me.IsVScrollVisible = True

End If

End If

If llRaiseScrollChanged Then

RaiseEvent ScrollChanged() ' Scroll values have changed, raise this event

End If

End If

End If

End Function

End Class

End Namespace

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:uk*************@TK2MSFTNGP15.phx.gbl...
rh,

I see the image, but I am not sure what you want. The selection
crosses the full length of the control. How much longer do you want it to
extend?

Or do you mean the tool tip is showing up behind the form? I think
that is what you are referring to.

Is your app stand-alone (meaning no special database stuff, supporting
files, etc, etc). If so, can you post it?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"rh" <rh******@smci.com> wrote in message
news:eh**************@TK2MSFTNGP12.phx.gbl...
Please refer to the attached JPG image. Let me know if you also need the
see the code.

Thanks for any help.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in message news:%2****************@TK2MSFTNGP09.phx.gbl...
rh,

What do you mean by it appears behind the parent form? That says to
me
that you can't see the tree view at all.

Can you post a picture of what you mean, or some code that shows the
error (or an example we can run)?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"rh" <rh******@smci.com> wrote in message
news:uq**************@tk2msftngp13.phx.gbl...
I created a user control that is made up of a TreeView and a VScrollBar.
I
set the TreeView.FullRowSelect = True and it works as expected (full row
is
visible, appears on top of everything else) but only sometimes. Other
times
it appears behind the parent form and all that is visible is the last
few
characters of that row.

Anyone know what might be causing this and how I can fix it? Thanks.



Nov 21 '05 #5
rh
Ok, so calling the Refresh and/or Invalidate had no effect. But, it gave me
the idea of trying other methods and I found that calling the forms Hide and
Show methods at the end of my code solves the problem (for whatever reason).
Thanks!
"Yosh" <yo***@nospam.com> wrote in message
news:OB**************@TK2MSFTNGP12.phx.gbl...
Just for grins, try calling the forms Refresh and/or Invalidate methods
when you select a node. I believe it's the treeview's AfterSelect event.

Yosh


"rh" <rh******@smci.com> wrote in message
news:eh**************@TK2MSFTNGP12.phx.gbl...
Please refer to the attached JPG image. Let me know if you also need the
see the code.

Thanks for any help.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in message news:%2****************@TK2MSFTNGP09.phx.gbl...
rh,

What do you mean by it appears behind the parent form? That says to
me
that you can't see the tree view at all.

Can you post a picture of what you mean, or some code that shows the
error (or an example we can run)?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"rh" <rh******@smci.com> wrote in message
news:uq**************@tk2msftngp13.phx.gbl...
I created a user control that is made up of a TreeView and a VScrollBar.
I
set the TreeView.FullRowSelect = True and it works as expected (full row
is
visible, appears on top of everything else) but only sometimes. Other
times
it appears behind the parent form and all that is visible is the last
few
characters of that row.

Anyone know what might be causing this and how I can fix it? Thanks.



Nov 21 '05 #6

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

Similar topics

3
by: Peter | last post by:
Hello Thanks for reviewing my question. I would like to know how can I programmatically select a node Thanks in Advanc Peter
3
by: Michael C | last post by:
Hi all, Quick question about the TreeView control. I'm using code like this to determine the currently clicked TreeNode in the TreeView. private void MyTreeView_MouseDown(object sender,...
5
by: rh | last post by:
I created a user control that is made up of a TreeView and a VScrollBar. I set the TreeView.FullRowSelect = True and it works as expected (full row is visible, appears on top of everything else)...
0
by: Athan | last post by:
I use MS activex treeview control in my asp pages. The problem I have is that some computers display the treeview with no problems while others display the control without the text on the nodes. I...
3
by: Gerhard | last post by:
I have the following code in an .net 2.0 project: <asp:Panel Runat="server" id="pnlNavigation" CssClass="pnlNavigation" Width="165px"> <asp:TreeView ID="TreeView1" runat="server"...
3
by: pamelafluente | last post by:
Hi I have some instances of a class: Class Myobject Public Color As Color Public Label As String End Class I need to show these instances on a treeview (which has checked boxes)
4
by: praveen | last post by:
I have a form with treeview control loaded from xml document,text box, two buttons named "Find" and "FindNext" and my treeview which looks like below. Details |__ policy status |__ created by...
0
by: bob | last post by:
I'm using the DataGridView control, with EditMode set to "edit programatically" and SelectionMode set to "FullRowSelect" (or something like that). My program allows the User to go into edit mode by...
8
by: Matt MacDonald | last post by:
Hi All, I have a form that displays hierarchical categories in a treeview. Ok so far so good. What I was to do is have users be able to select a node in the treeview as part of filling out the...
3
by: uday1302 | last post by:
Hi All, I have tried by seeing an example. See the below code. Here I have a Problem. Treeview has already one root node and twochild nodes with it. They have to be dragged and dropped in listview....
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: 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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.