Click here to Skip to main content
15,895,656 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Securing Local Files [Solved] Pin
Eddy Vluggen4-Sep-12 5:15
professionalEddy Vluggen4-Sep-12 5:15 
AnswerRe: Securing Local Files [Solved] Pin
BrainiacV4-Sep-12 8:30
BrainiacV4-Sep-12 8:30 
GeneralRe: Securing Local Files [Solved] Pin
Saul Johnson5-Sep-12 4:05
Saul Johnson5-Sep-12 4:05 
AnswerRe: Securing Local Files [Solved] Pin
ObiWan_MCC5-Sep-12 3:51
ObiWan_MCC5-Sep-12 3:51 
GeneralRe: Securing Local Files [Solved] Pin
ObiWan_MCC5-Sep-12 4:02
ObiWan_MCC5-Sep-12 4:02 
GeneralRe: Securing Local Files [Solved] Pin
Saul Johnson5-Sep-12 4:03
Saul Johnson5-Sep-12 4:03 
GeneralRe: Securing Local Files [Solved] Pin
ObiWan_MCC5-Sep-12 4:36
ObiWan_MCC5-Sep-12 4:36 
QuestionArrow keys to move an object Pin
Steven St. John1-Sep-12 11:30
Steven St. John1-Sep-12 11:30 
Having trouble getting exactly the answer I need in google, MSDN.

Desired: A user can select a PictureBox on the form which becomes the activeBrick. Whenever there is an activeBrick selected, arrow keys should move this one pixel at a time around the form within a Panel control called pnlTableau.

I have done this:

Me.KeyPreview = true


My attempted solution was this:

Private Sub BrickMove(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp

    If activeBrick IsNot Nothing Then
        Select Case e.KeyCode
            Case Keys.Up
                If activeBrick.Top > 0 Then activeBrick.Top -= 1
            Case Keys.Down
                If activeBrick.Bottom < pnlTableau.Height Then activeBrick.Top += 1
                e.Handled = True
            Case Keys.Left
                If activeBrick.Left > 0 Then activeBrick.Left -= 1
                e.Handled = True
            Case Keys.Right
                If activeBrick.Right < pnlTableau.Width Then activeBrick.Left += 1
                e.Handled = True
        End Select
    End If
    Me.Refresh()
End Sub


The Me.Refresh line at the end is because my active PictureBox has a dotted red rectangle around it, which will "drag" if the form is not repainted.

The problem: I have a few radio buttons on the form also. The arrow keys DO move the PictureBox, but the arrow keys also shift the selected radio button, which is not behavior I want. I thought e.Handled = True would suppress this, but it doesn't.

If I move this code to the KeyDown event, the PictureBox does not move at all but the radio buttons are still selected.

Thanks in advance.
AnswerRe: Arrow keys to move an object Pin
ChandraRam2-Sep-12 23:57
ChandraRam2-Sep-12 23:57 
GeneralRe: Arrow keys to move an object Pin
Steven St. John3-Sep-12 3:35
Steven St. John3-Sep-12 3:35 
GeneralRe: Arrow keys to move an object Pin
ChandraRam3-Sep-12 4:00
ChandraRam3-Sep-12 4:00 
GeneralRe: Arrow keys to move an object Pin
Steven St. John3-Sep-12 7:25
Steven St. John3-Sep-12 7:25 
AnswerRe: Arrow keys to move an object Pin
Alan N3-Sep-12 6:00
Alan N3-Sep-12 6:00 
GeneralRe: Arrow keys to move an object Pin
Steven St. John3-Sep-12 7:32
Steven St. John3-Sep-12 7:32 
AnswerRe: Arrow keys to move an object Pin
Sonhospa3-Sep-12 7:14
Sonhospa3-Sep-12 7:14 
GeneralRe: Arrow keys to move an object Pin
Steven St. John3-Sep-12 7:35
Steven St. John3-Sep-12 7:35 
GeneralRe: Arrow keys to move an object Pin
Sonhospa3-Sep-12 21:30
Sonhospa3-Sep-12 21:30 
QuestionDataContext Not Updating Its Database Pin
Sonhospa31-Aug-12 23:16
Sonhospa31-Aug-12 23:16 
AnswerRe: DataContext Not Updating Its Database Pin
Sonhospa3-Sep-12 7:21
Sonhospa3-Sep-12 7:21 
QuestionToggling ON/OFF VB6 reference library in Visual Studio Pin
juno10131-Aug-12 6:27
juno10131-Aug-12 6:27 
AnswerRe: Toggling ON/OFF VB6 reference library in Visual Studio Pin
Dave Kreskowiak31-Aug-12 7:26
mveDave Kreskowiak31-Aug-12 7:26 
GeneralRe: Toggling ON/OFF VB6 reference library in Visual Studio Pin
juno10131-Aug-12 9:06
juno10131-Aug-12 9:06 
GeneralRe: Toggling ON/OFF VB6 reference library in Visual Studio Pin
Dave Kreskowiak31-Aug-12 9:26
mveDave Kreskowiak31-Aug-12 9:26 
GeneralRe: Toggling ON/OFF VB6 reference library in Visual Studio Pin
juno1011-Sep-12 17:49
juno1011-Sep-12 17:49 
GeneralRe: Toggling ON/OFF VB6 reference library in Visual Studio Pin
Dave Kreskowiak1-Sep-12 18:42
mveDave Kreskowiak1-Sep-12 18:42 

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.