Click here to Skip to main content
15,903,203 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: How to refresh design area Pin
Ralf Meier16-Dec-17 22:19
mveRalf Meier16-Dec-17 22:19 
AnswerRe: How to refresh design area Pin
Ralf Meier16-Dec-17 23:45
mveRalf Meier16-Dec-17 23:45 
GeneralRe: How to refresh design area Pin
mo149217-Dec-17 4:51
mo149217-Dec-17 4:51 
PraiseRe: How to refresh design area Pin
mo149217-Dec-17 11:59
mo149217-Dec-17 11:59 
GeneralRe: How to refresh design area Pin
Ralf Meier17-Dec-17 20:44
mveRalf Meier17-Dec-17 20:44 
AnswerRe: How to refresh design area Pin
Ralf Meier14-Dec-17 1:46
mveRalf Meier14-Dec-17 1:46 
QuestionParentControlDesigner: How to receive message from child in design mode Pin
mo14925-Dec-17 2:38
mo14925-Dec-17 2:38 
AnswerRe: ParentControlDesigner: How to receive message from child in design mode Pin
Ralf Meier8-Dec-17 1:02
mveRalf Meier8-Dec-17 1:02 
Each ControlDesigner has several methods to pass the Mouse-Functionality to the Control in DesignTime the same way like in RunTime-mode.
For your requirement I would suggest you use/override the Methods OnMouseDragBegin, OnMouseDragMove and OnMouseDragEnd from the Designer.
With this methods you could modify properties from the HostControl.

VB
Public Class myControlDesigner
     Inherits System.Windows.Forms.Design.ControlDesigner

     Private HostControl As RMWertAnzeigeValue2 = Nothing

     Public Overrides Sub Initialize(ByVal component As System.ComponentModel.IComponent)
         MyBase.Initialize(component)

         HostControl = DirectCast(component, RMWertAnzeigeValue2)
     End Sub


     ' schaltet im Design-Modus die Maus-Cursor-Darstellung um
     Protected Overrides Sub OnSetCursor()
         Dim myPoint As Point = HostControl.PointToClient(Cursor.Position)

         If inShiftPosition(myPoint) > 0 Then
             If Dragging_Aktiv Then
                 Cursor.Current = Cursors.Arrow
             Else
                 Cursor.Current = Cursors.SizeWE
             End If
         Else
             MyBase.OnSetCursor()
         End If
     End Sub

     ''' <summary>
     ''' gibt den Übergang an dem sich die Maus aktuell befindet zurück
     ''' 0 = kein Übergang
     ''' 1 = Übergang zwischen Beschreibung und Wert
     ''' 2 = Übergang zwischen Wert und Einheit
     ''' </summary>
     ''' <param name="p"></param>
     ''' <returns></returns>
     ''' <remarks></remarks>
     Private Function inShiftPosition(ByVal p As Point) As Integer

         If HostControl IsNot Nothing AndAlso HostControl.Activated Then
             If (p.X >= HostControl.SpaltenTrenner.Pos1 - Dragging_ShiftHysterese) AndAlso (p.X <= HostControl.SpaltenTrenner.Pos1 + Dragging_ShiftHysterese) Then
                 Return 1
             ElseIf (p.X >= HostControl.SpaltenTrenner.Pos2 - Dragging_ShiftHysterese) AndAlso (p.X <= HostControl.SpaltenTrenner.Pos2 + Dragging_ShiftHysterese) Then
                 Return 2
             Else
                 Return 0
             End If
         Else
             Return 0
         End If

     End Function

     Private Dragging_ShiftHysterese As Integer = 3
     Private Dragging_Aktiv As Boolean = False
     Private Dragging_ShiftPoint As Integer = 0
     Private Dragging_Offset As Integer = 0


     ' ggf. Start der Verschiebung der Elemente im Control
     Protected Overrides Sub OnMouseDragBegin(ByVal x As Integer, ByVal y As Integer)
         If HostControl Is Nothing Then Exit Sub
         Dim myPoint As Point = HostControl.PointToClient(New Point(x, y))
         Dragging_ShiftPoint = inShiftPosition(myPoint)

         If Dragging_ShiftPoint = 1 Then
             Dragging_Offset = HostControl.SpaltenTrenner.Pos1 - myPoint.X
             Dragging_Aktiv = True
         ElseIf Dragging_ShiftPoint = 2 Then
             Dragging_Offset = HostControl.SpaltenTrenner.Pos2 - myPoint.X
             Dragging_Aktiv = True
         Else
             MyBase.OnMouseDragBegin(x, y)
         End If
     End Sub

     ' wenn Dragging aktiv ist dann können die Übergänge verschoben werden
     Protected Overrides Sub OnMouseDragMove(ByVal x As Integer, ByVal y As Integer)
         If HostControl Is Nothing Then Exit Sub
         Dim myPoint As Point = HostControl.PointToClient(New Point(x, y))

         If Dragging_Aktiv Then
             If Dragging_ShiftPoint = 1 Then
                 HostControl.SpaltenTrenner.Pos1 = myPoint.X + Dragging_Offset
             ElseIf Dragging_ShiftPoint = 2 Then
                 HostControl.SpaltenTrenner.Pos2 = myPoint.X + Dragging_Offset
             End If
         Else
             MyBase.OnMouseDragMove(x, y)
         End If
     End Sub

     ' Dragging beendet
     Protected Overrides Sub OnMouseDragEnd(ByVal cancel As Boolean)
         Dragging_Aktiv = False

         MyBase.OnMouseDragEnd(cancel)
     End Sub

 End Class


In this code SpaltenTrenner is a class-property which is equal to your requirement - sorry that some comments are in german.
I think, it could help you to see what should be done.
RMWertAnzeigeValue2 is the type a my Control which consists of 3 sections.
GeneralRe: ParentControlDesigner: How to receive message from child in design mode Pin
mo14929-Dec-17 11:25
mo14929-Dec-17 11:25 
GeneralRe: ParentControlDesigner: How to receive message from child in design mode Pin
Ralf Meier10-Dec-17 3:09
mveRalf Meier10-Dec-17 3:09 
QuestionDATA CAPTURE - WEB PAGE VB.NET Pin
Member 1352492016-Nov-17 3:05
Member 1352492016-Nov-17 3:05 
AnswerRe: DATA CAPTURE - WEB PAGE VB.NET Pin
Richard MacCutchan16-Nov-17 3:16
mveRichard MacCutchan16-Nov-17 3:16 
QuestionMIDI and USB Keyboard! Pin
User 989707412-Nov-17 4:25
User 989707412-Nov-17 4:25 
AnswerRe: MIDI and USB Keyboard! Pin
Richard MacCutchan12-Nov-17 6:29
mveRichard MacCutchan12-Nov-17 6:29 
GeneralRe: MIDI and USB Keyboard! Pin
User 989707412-Nov-17 7:45
User 989707412-Nov-17 7:45 
GeneralRe: MIDI and USB Keyboard! Pin
Sascha Lefèvre12-Nov-17 8:32
professionalSascha Lefèvre12-Nov-17 8:32 
GeneralRe: MIDI and USB Keyboard! Pin
User 989707412-Nov-17 8:34
User 989707412-Nov-17 8:34 
GeneralRe: MIDI and USB Keyboard! Pin
Sascha Lefèvre12-Nov-17 8:50
professionalSascha Lefèvre12-Nov-17 8:50 
GeneralRe: MIDI and USB Keyboard! Pin
User 989707412-Nov-17 8:56
User 989707412-Nov-17 8:56 
GeneralRe: MIDI and USB Keyboard! Pin
Sascha Lefèvre12-Nov-17 9:16
professionalSascha Lefèvre12-Nov-17 9:16 
GeneralRe: MIDI and USB Keyboard! Pin
User 989707412-Nov-17 23:36
User 989707412-Nov-17 23:36 
GeneralRe: MIDI and USB Keyboard! Pin
User 989707413-Nov-17 9:00
User 989707413-Nov-17 9:00 
GeneralRe: MIDI and USB Keyboard! Pin
User 989707429-Nov-17 4:16
User 989707429-Nov-17 4:16 
GeneralRe: MIDI and USB Keyboard! Pin
Sascha Lefèvre29-Nov-17 23:34
professionalSascha Lefèvre29-Nov-17 23:34 
GeneralRe: MIDI and USB Keyboard! Pin
User 989707430-Nov-17 0:10
User 989707430-Nov-17 0:10 

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.