473,545 Members | 2,776 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TreeView and FullRowSelect question

rh
I created a user control that is made up of a TreeView and a VScrollBar. I
set the TreeView.FullRo wSelect = 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 17 '05 #1
5 3905
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.co m

"rh" <rh******@smci. com> wrote in message
news:uq******** ******@tk2msftn gp13.phx.gbl...
I created a user control that is made up of a TreeView and a VScrollBar. I
set the TreeView.FullRo wSelect = 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 17 '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.co m

"rh" <rh******@smci. com> wrote in message
news:eh******** ******@TK2MSFTN GP12.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.c om> wrote
in message news:%2******** ********@TK2MSF TNGP09.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.co m

"rh" <rh******@smci. com> wrote in message
news:uq******** ******@tk2msftn gp13.phx.gbl...
I created a user control that is made up of a TreeView and a VScrollBar.
I
set the TreeView.FullRo wSelect = 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 17 '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******** ******@TK2MSFTN GP12.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.c om> wrote
in message news:%2******** ********@TK2MSF TNGP09.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.co m

"rh" <rh******@smci. com> wrote in message
news:uq******** ******@tk2msftn gp13.phx.gbl...
I created a user control that is made up of a TreeView and a VScrollBar.
I
set the TreeView.FullRo wSelect = 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 17 '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_DISABLENOSC ROLL 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_THUMBPOSITIO N 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 IsVScrollVisibl e As Boolean

Public IsHScrollVisibl e As Boolean

'Public IsInitComplete As Boolean

' Events

Public Event ScrollChanged()

Public Event VScrollVisibleC hanged(ByVal tlVisible As Boolean)

Public Event HScrollVisibleC hanged(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(By Val 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_THUMBPOSITIO N + &H10000 * lnPosition,
Nothing)

End Sub

Private Sub MyTreeView_Resi ze(ByVal sender As Object, ByVal e As
System.EventArg s) 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.RefreshScro llBarData()

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.RefreshScrol lBarData()

End Sub

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

Public Function RefreshScrollBa rData() 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(M e.Handle, Me.SBS_HORZ, loHSI) = 0 Then ' Non-zero
indicates success

If Me.IsHScrollVis ible = True Then

RaiseEvent HScrollVisibleC hanged(False)

Me.IsHScrollVis ible = 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.IsHScrollVis ible = False Then

RaiseEvent HScrollVisibleC hanged(True)

Me.IsHScrollVis ible = True

End If

Else

If Me.IsHScrollVis ible = True Then

RaiseEvent HScrollVisibleC hanged(False)

Me.IsHScrollVis ible = False

End If

End If

End If

' Vertical Scroll

Dim loVSI As New SCROLLINFO

loVSI.fMask = SIF_ALL

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

If Me.IsVScrollVis ible Then

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

Me.IsVScrollVis ible = False

End If

Else

Dim llRaiseScrollCh anged As Boolean = False

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

llRaiseScrollCh anged = 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.IsVScrollVis ible Then

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

Me.IsVScrollVis ible = False

End If

Else

If Me.IsVScrollVis ible = False Then

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

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

Me.IsVScrollVis ible = True

End If

End If

If llRaiseScrollCh anged 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.c om> wrote in
message news:uk******** *****@TK2MSFTNG P15.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.co m

"rh" <rh******@smci. com> wrote in message
news:eh******** ******@TK2MSFTN GP12.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.c om> wrote
in message news:%2******** ********@TK2MSF TNGP09.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.co m

"rh" <rh******@smci. com> wrote in message
news:uq******** ******@tk2msftn gp13.phx.gbl...
I created a user control that is made up of a TreeView and a VScrollBar.
I
set the TreeView.FullRo wSelect = 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
character s of that row.

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



Nov 17 '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.c om> wrote in message
news:OB******** ******@TK2MSFTN GP12.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******** ******@TK2MSFTN GP12.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.c om> wrote
in message news:%2******** ********@TK2MSF TNGP09.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.co m

"rh" <rh******@smci. com> wrote in message
news:uq******** ******@tk2msftn gp13.phx.gbl...
I created a user control that is made up of a TreeView and a VScrollBar.
I
set the TreeView.FullRo wSelect = 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
character s of that row.

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



Nov 17 '05 #6

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

Similar topics

3
2151
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
5
1667
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) 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...
0
1529
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 checked the IE settings, IE version, comctl32.ocx version,... everything seems to be the same on the machines that do not have the problem and on...
3
11212
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" DataSourceID="SiteMapDataSource1" CssClass="nav" BorderStyle="None" CollapseImageToolTip="" ExpandImageToolTip="" ShowExpandCollapse="False"> <LevelStyles>...
3
3455
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
6915
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 |__ cover type
0
2309
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 double-clicking a row, or pressing F2, or selecting a menu item (Row/Edit). When that happens, I turn SelectionMode into "CellSelect" (or...
8
12738
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 form. I only want to allow single selection, so using checkboxes is out of the question. It works as is, but it makes the form very cumbersome if...
3
5448
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. The main Problem is wen I drag an item..the Itemdrag event is not fired.?? Please try to resolve it. private void...
0
7943
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7456
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7786
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5359
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3490
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3470
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1919
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1044
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
743
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.