2013-03-16 161 views

回答

1

應該禁用鼠標右鍵單擊事件:

public partial class Form1 : Form ,IMessageFilter // after the name space 
{  

    private const int WM_LBUTTONDOWN = 0x0201; 



    public Form1() 
    { 
     InitializeComponent(); 
     Application.AddMessageFilter(this); 
     this.FormClosed += new FormClosedEventHandler(this.Form1_FormClosed); 
    } 
    private void Form1_FormClosed(object sender, FormClosedEventArgs e) 
    { 
     Application.RemoveMessageFilter(this); 
    } 
    public bool PreFilterMessage(ref Message m) 
    { 
     //Filter out WM_NCRBUTTONDOWN/UP/DBLCLK 
     if (m.Msg == 0xA4 || m.Msg == 0xA5 || m.Msg == 0xA6) return true; 
     // Filter out WM_RBUTTONDOWN/UP/DBLCLK 
     if (m.Msg == 0x204 || m.Msg == 0x205 || m.Msg == 0x206) return true; 
     return false; 
    } 
0

這可以給你一個右擊殘疾人ShockWaveObject「只有4個簡單的步驟」

在您的「形」添加的Shockwave Flash控制。

1.創建一個名爲 「NoRightClickFlashControl.vb」

波紋代碼粘貼到NoRightClickFlashControl.vb

Public Class NoRightClickFlashControl 

Inherits AxShockwaveFlashObjects.AxShockwaveFlash 
Private Const WM_RBUTTONDOWN As Integer = &H204 

Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message) 
    Select Case m.Msg 
     Case WM_RBUTTONDOWN 
      ' Do nothing on right-click 
      m.Result = New IntPtr(1) 
      Return 
    End Select 
    MyBase.WndProc(m) 
End Sub 

End Class 

2.更改的名稱一個新的類文件的ShockwaveObject「AxShockwaveFlash1」到您的表單上的「NoRightClickFlashControl1」。然後,在最後

Private Sub InitializeComponent() 

'// Old is : Me.NoRightClickFlashControl1 = New AxShockwaveFlashObjects.AxShockwaveFlash() 

    '// Change like this 
    Me.NoRightClickFlashControl1 = New Your_Project_NameSpace.NoRightClickFlashControl 

    Me.SuspendLayout() 

,在: '和初始化SuspendLayout' 之間像波紋管在

打開Form.Designer.vb文件

3.更改代碼 「End Class」文件附近的Form.Designer.vb - 更改以下內容

'// Old is : Friend WithEvents NoRightClickFlashControl1 As AxShockwaveFlashObjects.AxShockwaveFlash 

    '// Change Like this : 
    Friend WithEvents NoRightClickFlashControl1 As NoRightClickFlashControl 

End Class '// the End Class is just o understand. 

所有其他的編碼是相同的,以ShockwaveFlashObject - 加載電影,玩

完成

按F5鍵運行!請享用!!!