Visual Basic .NET Forums  
Click here to advertise with us

Go Back   Visual Basic .NET Forums > Components & Controls > Reporting / Printing

Reporting / Printing Discussion on output-creation components such as reporting, pdf, etc.

VB.NET Forums Newsletter Signup:
Email address:


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-09-2010, 9:18 AM
VB.NET Forum Newbie
.NET Framework: .NET 2.0
 
Join Date: Jan 2010
Age: 21
Posts: 7
Reputation: 0
bennettfan is on a distinguished programming path ahead
Default printing treeview!!!

Printing the .NET TreeView Control - CodeProject

In this link, once I type it into VB 2008,

"this._controlImage = GetImage(tree.Handle, tree.Width, tree.Height)"
//reset the tree to its original settings

this statement just has error and I think that "this._controlImage" , the treeview may not have "_controlImage" member. So, what is the case?

Also, I search that the method "GetImage()"....

It shoubld be
"ToolboxBitmapAttribute.GetImage Method (Type, String, Boolean)"....

So, tree.Handle is the Type?
tree.Width is String?
tree.Height is Boolean?

or GetImage Method should have other parameter??

or does anyone can give me other link or teach me help to print a treeview?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-09-2010, 9:36 AM
VB.NET Forum Newbie
.NET Framework: .NET 2.0
 
Join Date: Jan 2010
Age: 21
Posts: 7
Reputation: 0
bennettfan is on a distinguished programming path ahead
Default

Private Sub PrepareTreeImage()
Dim _scrollBarWidth As Integer
Dim _scrollBarHeight As Integer
Dim height1 As Integer
Dim node1 As New TreeNode
Dim width1 As Integer

_scrollBarWidth = tvwLanguages.Width - tvwLanguages.ClientSize.Width
_scrollBarHeight = tvwLanguages.Height - tvwLanguages.ClientSize.Height
tvwLanguages.Nodes(0).EnsureVisible()
height1 = tvwLanguages.Nodes(0).Bounds.Height
tvwLanguages.Height = height1
width1 = tvwLanguages.Nodes(0).Bounds.Right
node1 = tvwLanguages.Nodes(0).NextVisibleNode


While (node1 IsNot Nothing)
Height += node1.Bounds.Height
End While


If (node1.Bounds.Right > width1) Then
width1 = node1.Bounds.Right
End If

node1 = node1.NextVisibleNode




'keep track of the original tree settings

Dim tempHeight As Integer
Dim tempWidth As Integer
Dim tempBorder As BorderStyle
Dim tempScrollable As Boolean
Dim selectedNode As New TreeNode

tempHeight = tvwLanguages.Height
tempWidth = tvwLanguages.Width
tempBorder = tvwLanguages.BorderStyle
tempScrollable = tvwLanguages.Scrollable
selectedNode = tvwLanguages.SelectedNode
'setup the tree to take the snapshot

Dim tempDock As DockStyle
tvwLanguages.SelectedNode = Nothing
tempDock = tvwLanguages.Dock
tvwLanguages.Height = Height + _scrollBarHeight
tvwLanguages.Width = Width + _scrollBarWidth
tvwLanguages.BorderStyle = BorderStyle.None
tvwLanguages.Dock = DockStyle.None
'get the image of the tree


Dim controlImage As Image = Nothing
Dim imageAttr As ToolboxBitmapAttribute = CType(attrCol(GetType(ToolboxBitmapAttribute)), true)

tvwLanguages.controlImage = imageAttr.GetImage(tvwLanguages.Handle, tvwLanguages.Width, tvwLanguages.Height)
' ''reset the tree to its original settings

tvwLanguages.BorderStyle = tempBorder
tvwLanguages.Width = tempWidth
tvwLanguages.Height = tempHeight
tvwLanguages.Dock = tempDock
tvwLanguages.Scrollable = tempScrollable
tvwLanguages.SelectedNode = selectedNode
''give the window time to update

Application.DoEvents()
End Sub


------------------------------------
this is the code I edit to vb2008....and
Dim controlImage As Image = Nothing
Dim imageAttr As ToolboxBitmapAttribute = CType(attrCol(GetType(ToolboxBitmapAttribute)), true)

tvwLanguages.controlImage = imageAttr.GetImage(tvwLanguages.Handle, tvwLanguages.Width, tvwLanguages.Height)
' ''reset the tree to its original settings

this part is getting wrong....
can someone help?

Also, what is the meaning oF Application.DoEvents() ??
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





All times are GMT -4. The time now is 6:17 AM.

Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2


For advertising opportunities click here.