Navigation

Thursday, June 09, 2011

Build Windows AKA PDC 2011 Official

PDC2011 (PDC11) seems to have been rebranded as Build Windows and has a new website http://www.buildwindows.com/

BUILD is a new event that shows modern hardware and software developers how to take advantage of the future of Windows. Learn how to work with the all new touch-centric user experience to create fast, fluid, and dynamic applications that leverage the power and flexibility of the core of Windows, used by more than a billion people around the world.

Hear how the UI was designed to work seamlessly with a diversity of devices and form factors. Go behind the scenes and learn all about the new app model that allows you to create powerful new apps. All while retaining the ability to use your existing apps. Web-connected and web-powered apps built using HTML5 and JavaScript have access to the power of the PC. Touch-optimized browsing, with the full power of hardware-accelerated Internet Explorer 10 transforms your experiences with the web. BUILD is the first place to dive deep into the future of Windows.

Agenda

Last Update: June 1, 2011
Subject to change without notice

Monday, Sept 12

7:00am - 9:00am

Registration

9:00am - 5:00pm

Pre-Conference Sessions

Tuesday, Sept 13

7:00am - 9:00am

Registration

9:00am - 11:00am

Keynote

11:30am - 6:00pm

Sessions

Wednesday, Sept 14

7:30am - 9:00am

Registration

9:00am - 6:00pm

Sessions

Thursday, Sept 15

7:30am - 9:00am

Registration

9:00am - 5:00pm

Sessions

Friday, Sept 16

7:30am - 9:00am

Registration

9:00am - 3:00pm

Sessions

3:00pm

Conference Ends

Wednesday, June 08, 2011

How to control the scrollbar position in a Tree View Control

Loading nodes into a tree view control that expand past the viewable area of the tree view can cause the scroll bars to move and display the content of the control incorrectly as in figure 1.

image

Figure 1

To control the position of the scrollbars you can use the following code which will result in the tree view displaying properly as in figure 2.

Imports System.Runtime.InteropServices

Public Class Form1
    <DllImport("user32.dll", CharSet:=System.Runtime.InteropServices.CharSet.Auto)> _
    Public Shared Function GetScrollPos(ByVal hWnd As Integer, ByVal nBar As Integer) As Integer
    End Function
    <DllImport("user32.dll")> _
    Private Shared Function SetScrollPos(ByVal hWnd As IntPtr, ByVal nBar As Integer, ByVal nPos As Integer, ByVal bRedraw As Boolean) As Integer
    End Function
    Private Const SB_HORZ As Integer = &H0
    Private Const SB_VERT As Integer = &H1

    Dim t As Boolean = False

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try
            If t = False Then
                t = True
                Me.TreeView1.ExpandAll()
            Else
                t = False
                Me.TreeView1.CollapseAll()
            End If


            'Dim ScrollPos As Point = GetTreeViewScrollPos(Me.TreeView1)
            '   Function sets the position of the treeview you pass

        Catch ex As Exception

        End Try
    End Sub
    ''' <summary>
    ''' Gets the current position of the scroll
    ''' </summary>
    ''' <param name="treeView"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Private Function GetTreeViewScrollPos(ByVal treeView As TreeView) As Point
        GetTreeViewScrollPos = New Point(0, 0)
        Try
            GetTreeViewScrollPos = New Point(GetScrollPos(CInt(treeView.Handle), SB_HORZ), GetScrollPos(CInt(treeView.Handle), SB_VERT))
        Catch ex As Exception

        End Try
        Return GetTreeViewScrollPos
    End Function
    ''' <summary>
    ''' Sets the position of the scroll of passed treeview control
    ''' </summary>
    ''' <param name="treeView"></param>
    ''' <param name="scrollPosition"></param>
    ''' <remarks></remarks>
    Private Sub SetTreeViewScrollPos(ByRef treeView As TreeView, ByRef scrollPosition As Point)
        Try
            SetScrollPos(DirectCast(treeView.Handle, IntPtr), SB_HORZ, scrollPosition.X, True)
            SetScrollPos(DirectCast(treeView.Handle, IntPtr), SB_VERT, scrollPosition.Y, True)
            If treeView.Nodes.Count > 0 Then
                Dim currentNode As TreeNode = treeView.Nodes(0) 'treeView.GetNodeAt(0, 0)
                currentNode.EnsureVisible()
            End If

        Catch ex As Exception

        End Try
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        SetTreeViewScrollPos(Me.TreeView1, New Point(0, 0))
    End Sub
End Class