Click here to Skip to main content
15,892,480 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Questionhelp on sending and receiving sms via VB.NET Pin
geok lin5-Apr-09 17:59
geok lin5-Apr-09 17:59 
AnswerRe: help on sending and receiving sms via VB.NET Pin
Christian Graus5-Apr-09 19:46
protectorChristian Graus5-Apr-09 19:46 
QuestionDiasble form titlebar move Pin
JonnieR5-Apr-09 10:30
JonnieR5-Apr-09 10:30 
AnswerRe: Diasble form titlebar move Pin
0x3c05-Apr-09 10:41
0x3c05-Apr-09 10:41 
AnswerSQL Server Management Pin
dlo_morea4-Apr-09 15:20
dlo_morea4-Apr-09 15:20 
GeneralRe: SQL Server Management Pin
Christian Graus4-Apr-09 16:09
protectorChristian Graus4-Apr-09 16:09 
GeneralRe: SQL Server Management Pin
Jon_Boy6-Apr-09 9:46
Jon_Boy6-Apr-09 9:46 
QuestionHDN_TRACK (SysHeader32 ) notification doesn't send by 1 pixel step Pin
VBAdvisor4-Apr-09 14:45
VBAdvisor4-Apr-09 14:45 
When I am dragging a column divider,sysheader32 will issue HDN_TRACK Notification.But the interval of this notification (column width changing) is not by 1 pixel step. How to get notification by every 1 pixel changing?
I want to implement ColMaxWidth and ColMinWidth property into vbaccelerator’s sGrid2.When I am dragging the divider of a column, the column will stop resizing when column width is reaching the colmaxwidth or colminwidth boundary.
I am checking the mouse position or lWidth in sub m_cHeader_ColumnWidthChanging,if Column Width is reaching the colmaxwidth or colminwidth boundary,then I use ClipCursor API to restrict mouse movement. But the problem is that Header's HDN_TRACK notification is not being sent by 1 pixel change . When I got the notification,the column width has been changed by more than 1 pixel.That is why I can't control the column width accurately. e.g. the Max. Column width is set to 100,The min. Column Width is 50,But somehow,the Column width is going to 48 or 102,not the exact 50 or 100 while resizing.

The notification sequence is :
WM_MouseMove, WM_LBUTTONDOWN, HDN_BEGINTRACK, WM_MOUSEMOVE, HDN_TRACK, WM_MOUSEMOVE, HDN_TRACK, WM_MOUSEMOVE, HDN_TRACK ... WM_MOUSEMOVE, HDN_TRACK, HDN_ENDTRACK

[Note]The problem is that the notification is not being sent by per pixel by per pixel. If I am moving mouse very fast, Mouse will over the boundary of ColMaxWidth and ColMinWidth by few pixels.

in Header Class,I am Subclassing those related notifications:

Case HDN_TRACKA, HDN_TRACKW
                CopyMemory tHDN, ByVal lParam, LenB(tHDN)
                '/* Get HD_ITEM from tHDN.lPtrHDItem.  Don't use a HD_ITEM
                '/* structure - you will crash...
                '/* Here we only need up to the second long (HD_ITEM.cxy)
                ReDim lHDI(0 To 1) As Long
                CopyMemory lHDI(0), ByVal tHDN.lPtrHDItem, 8
                RaiseEvent ColumnWidthChanging(tHDN.iItem, lHDI(1), bCancel)
                If bCancel Then
                    lReturn = 1
                    bHandled = True
                End If



Private Sub m_cHeader_ColumnWidthChanging(ByVal lColumn As Long, _
                                          lWidth As Long, _
                                          bCancel As Boolean)

Dim iCol    As Long
Dim iIntCol As Long
Dim tR      As RECT
Dim tClipRect     As RECT
Dim iCurrentCol As Long

    For iCol = 1 To m_iCols
        If (m_tCols(iCol).lHeaderColIndex = lColumn + 1) Then
            iCurrentCol = iCol
        End If
    Next

    If Not m_tCols(iCurrentCol).lMaxWidth = -1 Then
         If lWidth > m_tCols(iCurrentCol).lMaxWidth Then
             ClipCursorRect tClipRect
         End If
    End If
    If Not m_tCols(iCurrentCol).lMinWidth = -1 Then
         If lWidth < m_tCols(iCurrentCol).lMinWidth Then
             ClipCursorRect tClipRect
         End If
    End If
   
    pGetDragImageRect lColumn, lWidth, tR, False
    DrawDragImage tR, False, False
    RaiseEvent ColumnWidthChanging(lColumn, lWidth, bCancel)
    If bCancel Then
        DrawDragImage tR, False, True
    End If
  
End Sub

Private Sub pGerClipColRect(ByVal lCol As Long, _
                                   ByVal lMaxWidth As Long, _
                                   ByVal lMinWidth As Long, _
                                   ByRef tR As RECT)

Dim iCol  As Long
Dim iGCol As Long
Dim tP    As POINTAPI

'/* Find RECT for header column with Max and Min Width to stop sizing when out of boundary:

    If lCol > 0 Then
        '/* Add the width:

        If Not m_tCols(lCol).lMinWidth = -1 Then
            tR.left = m_tCols(lCol).lStartX + m_tCols(lCol).lMinWidth
        Else
            tR.left = m_tCols(lCol).lStartX
        End If
       
        If Not m_tCols(lCol).lMaxWidth = -1 Then
            tR.right = m_tCols(lCol).lStartX + m_tCols(lCol).lMaxWidth
        Else
            tR.right = m_tCols(lCol).lStartX
        End If
       
        With tR
            .left = .left - m_lStartX
            .top = 0   'start from top of usercontrol 'm_cHeader.Height + m_cHeader.top
            .bottom = UserControl.ScaleHeight \ Screen.TwipsPerPixelY
            '/* Return the rectangle relative to the screen:
            tP.x = .left
            tP.y = .top
        End With

        '//Return the rectangle left and top relative to the screen:
        ClientToScreen UserControl.hwnd, tP
        With tR
            .left = tP.x
            .top = tP.y
            tP.x = .right
            tP.y = .bottom
        End With

        '//Return the rectangle right and bottom relative to the screen:
        ClientToScreen UserControl.hwnd, tP
        tR.right = tP.x
        tR.bottom = tP.y
    End If

End Sub


[Chinese]当拖动Header的分界线时候,会发出HDN_TRACK消息(Notification)。问题是HDN_TRACK消息的发出间隔不是1 pixels by 1 pixels,可能多过一个Pixels.请问要用什么办法可以获得sysheader32的Column每改变1 pixels消息?
AnswerRe: HDN_TRACK (SysHeader32 ) notification doesn't send by 1 pixel step Pin
VBAdvisor5-Apr-09 16:05
VBAdvisor5-Apr-09 16:05 
QuestionIs there anny way to turn off webbrowser navigation sound??? Pin
FeRtoll4-Apr-09 9:23
FeRtoll4-Apr-09 9:23 
AnswerRe: Is there anny way to turn off webbrowser navigation sound??? Pin
FeRtoll4-Apr-09 9:41
FeRtoll4-Apr-09 9:41 
AnswerRe: Is there anny way to turn off webbrowser navigation sound??? Pin
FeRtoll4-Apr-09 9:56
FeRtoll4-Apr-09 9:56 
AnswerRe: Is there anny way to turn off webbrowser navigation sound??? Pin
FeRtoll8-Apr-09 10:39
FeRtoll8-Apr-09 10:39 
QuestionWindows Explorer menus Pin
JR2124-Apr-09 4:46
JR2124-Apr-09 4:46 
AnswerRe: Windows Explorer menus Pin
LloydA1114-Apr-09 12:43
LloydA1114-Apr-09 12:43 
GeneralRe: Windows Explorer menus Pin
JR2124-Apr-09 20:47
JR2124-Apr-09 20:47 
QuestionVBA Modeless form that modifies code module is lost after call completion? Pin
DonQuiyote4-Apr-09 4:13
DonQuiyote4-Apr-09 4:13 
QuestionHow to show the changes Updated by other user on network Pin
ejaz_pk3-Apr-09 22:17
ejaz_pk3-Apr-09 22:17 
AnswerRe: How to show the changes Updated by other user on network Pin
Eddy Vluggen4-Apr-09 0:13
professionalEddy Vluggen4-Apr-09 0:13 
QuestionMicrosoft Access Database Backup by vb 6.0 Pin
ejaz_pk3-Apr-09 22:11
ejaz_pk3-Apr-09 22:11 
AnswerRe: Microsoft Access Database Backup by vb 6.0 Pin
Eddy Vluggen4-Apr-09 0:02
professionalEddy Vluggen4-Apr-09 0:02 
AnswerRe: Microsoft Access Database Backup by vb 6.0 Pin
Anubhava Dimri6-Apr-09 20:41
Anubhava Dimri6-Apr-09 20:41 
Questionhow to connect mysql DB ? Pin
JC.KaNNaN3-Apr-09 20:50
JC.KaNNaN3-Apr-09 20:50 
AnswerRe: how to connect mysql DB ? Pin
Christian Graus3-Apr-09 23:17
protectorChristian Graus3-Apr-09 23:17 
GeneralRe: how to connect mysql DB ? Pin
akhilonly0075-Apr-09 22:36
akhilonly0075-Apr-09 22:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.