1.先打開工具箱,選擇ToolTip。
2.將ToolTip拖拉至Form上。
3.設定Form上ToolTip元件的名稱(panelToolTip)。
4.在程式中加入,panelToolTip.SetToolTip(btnClose, "關閉");-->元件.方法(要顯示的元件,Tip說明)
範例
private void setFormLanguage()
{
panelToolTip.SetToolTip(btnClose,"關閉");
panelToolTip.SetToolTip(btnSetting, "設定");
panelToolTip.SetToolTip(btnForum,"討論區");
panelToolTip.SetToolTip(btnHelp, "幫助");
}
2010年9月27日 星期一
C#包Swf時,隱藏右鍵選單
1.先匯入API
using System.Runtime.InteropServices;
2.設定屬性
#region Disable Flash's Context Menu
private const int GWL_WNDPROC = -4;
public delegate IntPtr FlaWndProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
private IntPtr OldWndProc = IntPtr.Zero;
private FlaWndProc Wpr = null;
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr SetWindowLong(IntPtr hWnd, int nIndex, FlaWndProc wndProc);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr CallWindowProc(IntPtr wndProc, IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
3.隱藏右鍵選單FUNCTION
private IntPtr FlashWndProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam)
{
if (msg == 516)
return (IntPtr)0;
return CallWindowProc(OldWndProc, hWnd, msg, wParam, lParam);
}
#endregion
4.當Form載入完成後,呼叫的Function
private void AsusWebStorage_Load(object sender, EventArgs e)
{
try
{
//Console.WriteLine("AsusWebStorage_load");
this.Wpr = new FlaWndProc(this.FlashWndProc);
this.OldWndProc = SetWindowLong(swfPanel.Handle, GWL_WNDPROC, Wpr);
}
catch (Exception ex)
{
MessageBox.Show("Load exception:" + ex.Message);
}
}
using System.Runtime.InteropServices;
2.設定屬性
#region Disable Flash's Context Menu
private const int GWL_WNDPROC = -4;
public delegate IntPtr FlaWndProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
private IntPtr OldWndProc = IntPtr.Zero;
private FlaWndProc Wpr = null;
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr SetWindowLong(IntPtr hWnd, int nIndex, FlaWndProc wndProc);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr CallWindowProc(IntPtr wndProc, IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
3.隱藏右鍵選單FUNCTION
private IntPtr FlashWndProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam)
{
if (msg == 516)
return (IntPtr)0;
return CallWindowProc(OldWndProc, hWnd, msg, wParam, lParam);
}
#endregion
4.當Form載入完成後,呼叫的Function
private void AsusWebStorage_Load(object sender, EventArgs e)
{
try
{
//Console.WriteLine("AsusWebStorage_load");
this.Wpr = new FlaWndProc(this.FlashWndProc);
this.OldWndProc = SetWindowLong(swfPanel.Handle, GWL_WNDPROC, Wpr);
}
catch (Exception ex)
{
MessageBox.Show("Load exception:" + ex.Message);
}
}
2010年9月3日 星期五
Flex Builder Local History 回復刪除檔案
當在Flex誤刪檔案時,可以用Local History 回復刪除檔案
- 在專案上按右鍵
- 點選Restore from Local History
- 選擇要回復檔案
- 可選擇回復的時間
訂閱:
文章 (Atom)