WPF 怎么将应用程序图标锁定到开始菜单旁边
WPF 如何将应用程序图标锁定到开始菜单旁边
类似于360手机小助手和系统开始菜单,把图标锁定在屏幕左下角,不是任务栏,如何实现?
分不多了,只有50,求助!
------解决方案--------------------
http://bbs.****.net/topics/390352810
可以解决你的问题
------解决方案--------------------
具体位置你可以自己调一下,有点事要出门
------解决方案--------------------
引用winform中的picturebox控件效果图:
类似于360手机小助手和系统开始菜单,把图标锁定在屏幕左下角,不是任务栏,如何实现?
分不多了,只有50,求助!
------解决方案--------------------
http://bbs.****.net/topics/390352810
可以解决你的问题
------解决方案--------------------
具体位置你可以自己调一下,有点事要出门
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetWindowRect(IntPtr hwnd, out RECT lpRect);
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int Left, Top, Right, Bottom;
}
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, int uFlags);
[DllImport("user32.dll", SetLastError = true)]
internal static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
private void Form1_Load(object sender, EventArgs e)
{
IntPtr hwnd = FindWindow("Shell_TrayWnd", null);
SetParent(button1.Handle, hwnd);
IntPtr toolBarhWnd = FindWindow("ReBarWindow32", null);
IntPtr btnStarthWnd = FindWindow("Start", null);
SetWindowPos(button1.Handle, btnStarthWnd, 0, 0,button1.Height, button1.Width, 1);
RECT r;
GetWindowRect(toolBarhWnd, out r);
MoveWindow(toolBarhWnd,r.Left+button1.Width,r.Bottom,r.Right-button1.Width,r.Bottom, true);
}
------解决方案--------------------
引用winform中的picturebox控件效果图:
IntPtr hwnd = FindWindow("Shell_TrayWnd", null);
System.Windows.Forms.PictureBox p = new System.Windows.Forms.PictureBox()
{ Width = 50, Height = 40, SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage ,
Image = System.Drawing.Image.FromFile(@"..\..\Resources\AppIcon.ico")
};
p.Click += (s, ee) => this.Show();
IntPtr toolBarhWnd = IntPtr.Zero;
IntPtr btnStarthWnd = IntPtr.Zero;
toolBarhWnd = FindWindowEx(hwnd, toolBarhWnd, "ReBarWindow32", null);
btnStarthWnd = FindWindowEx(hwnd, btnStarthWnd, "Start", null);
RECT r;
GetWindowRect(btnStarthWnd, out r);
int btnStartWidth = r.Right;
SetParent(p.Handle, hwnd);
SetWindowPos(p.Handle, btnStarthWnd, r.Bottom - r.Top, 0, p.Height, p.Width, 1);
GetWindowRect(toolBarhWnd, out r);