topmost设为true;
windowstate设为maximized;
然后formborderstyle设为none
这些我都做了 任务栏还是在 怎么办啊 ~~~~
windowstate设为maximized;
然后formborderstyle设为none
这些我都做了 任务栏还是在 怎么办啊 ~~~~
解决方案 »
- 已知图片A,由“G:\A.gif”如何显示图片于picturebox内?
- 基本的javascript
- 关于转汉字为char的问题
- 晕死,VirtualDriver的.VCD文件实际上就是.ISO文件,只不过换了个后缀而已;今天才发现,特散分,
- 200分求:交换机数据包的数据结构。
- 请问Delegate类而不是关键字delegate的使用方法!
- 用过《经典.NET XP/2003风格控件》((Component .NET) DevExpress 9 Components)1.5.0.1-2.1.4里的控件的朋友进来下.
- vs打包winform程序如何附带sql数据库访问程序呢?
- 帮忙解决问题
- 怎么在一个窗体中改变另外一个窗体中控件的TEXT
- winform的简单功能讨论,顶者有分
- 子窗口控制父窗口的菜单控件的可用性
ShowIcon = false;
ShowInTaskbar = false;
this.Location = new Point(0, 0);
this.Size = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
this.WindowState = FormWindowState.Maximized;要注意代码的顺序
using System.Runtime.InteropServices; public class TaskBar
{
[DllImport("user32.dll", EntryPoint = "FindWindowA")]
private static extern IntPtr FindWindowA(string lp1, string lp2);
[DllImport("user32.dll", EntryPoint = "ShowWindow")]
private static extern IntPtr ShowWindow(IntPtr hWnd, int _value);
[DllImport("shell32.dll")]
private static extern int SHAppBarMessage(int dwMessage, ref APPBARDATA pData); const int ABS_AUTOHIDE = 1;
const int ABS_ONTOP = 2;
const int ABM_SETSTATE = 10; static TaskBar()
{
} //显示任务栏
public static void Show()
{
IntPtr hTray = FindWindowA("Shell_TrayWnd", string.Empty);
ShowWindow(hTray, 5);
} //隐藏任务栏
public static void Hide()
{
IntPtr hTray = FindWindowA("Shell_TrayWnd", string.Empty);
ShowWindow(hTray, 0);
} //设置自动隐藏
public static bool AutoHide
{
set
{
APPBARDATA abd = new APPBARDATA();
abd.hwnd = FindWindowA("Shell_TrayWnd", string.Empty);
if (value)
{
abd.lParam = ABS_AUTOHIDE | ABS_ONTOP;
SHAppBarMessage(ABM_SETSTATE, ref abd);
}
else
{
abd.lParam = ABS_ONTOP;
SHAppBarMessage(ABM_SETSTATE, ref abd);
}
}
} struct APPBARDATA
{
public int cbSize;
public IntPtr hwnd;
public int uCallbackMessage;
public int uEdge;
public RECT rc;
public int lParam;
}
struct RECT
{
public int Left;
public int Top;
public int Right;
public int Bottom;
}
}上面是我写的一个控制任务栏的类。如果你想强行隐藏任务栏,可以调用TaskBar.Hide()方法强行隐藏,需要时再调用TaskBar.Show()显示。
{
InitializeComponent(); this.FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;
}
今天回帖带祝福,七夕情人节快乐~^_^
****************************************************************[/align]
今天回帖带祝福,七夕情人节快乐~^_^
****************************************************************[/align]
this.Location = new Point(0, 0);
this.Size = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
放到Load事件里不行吗?
public class TaskBar
{
[DllImport("user32.dll", EntryPoint = "FindWindowA")]
private static extern IntPtr FindWindowA(string lp1, string lp2);
[DllImport("user32.dll", EntryPoint = "ShowWindow")]
private static extern IntPtr ShowWindow(IntPtr hWnd, int _value);
[DllImport("shell32.dll")]
private static extern int SHAppBarMessage(int dwMessage, ref APPBARDATA pData); const int ABS_NOTONTOP = 0;
const int ABS_AUTOHIDE = 1;
const int ABS_ONTOP = 2;
const int ABM_SETSTATE = 10; static TaskBar()
{
} //显示任务栏
public static void Show()
{
IntPtr hTray = FindWindowA("Shell_TrayWnd", string.Empty);
ShowWindow(hTray, 5);
} //隐藏任务栏
public static void Hide()
{
IntPtr hTray = FindWindowA("Shell_TrayWnd", string.Empty);
ShowWindow(hTray, 0);
} //设置自动隐藏
public static bool AutoHide
{
set
{
APPBARDATA abd = new APPBARDATA();
abd.hwnd = FindWindowA("Shell_TrayWnd", string.Empty);
if (value)
{
abd.lParam = ABS_AUTOHIDE | ABS_ONTOP;
SHAppBarMessage(ABM_SETSTATE, ref abd);
}
else
{
abd.lParam = ABS_ONTOP;
SHAppBarMessage(ABM_SETSTATE, ref abd);
}
}
} //设置任务栏置顶
public static bool TopMost
{
set
{
APPBARDATA abd = new APPBARDATA();
abd.hwnd = FindWindowA("Shell_TrayWnd", string.Empty);
if (value)
{
abd.lParam = ABS_ONTOP;
SHAppBarMessage(ABM_SETSTATE, ref abd);
}
else
{
abd.lParam = ABS_NOTONTOP;
SHAppBarMessage(ABM_SETSTATE, ref abd);
}
}
} struct APPBARDATA
{
public int cbSize;
public IntPtr hwnd;
public int uCallbackMessage;
public int uEdge;
public RECT rc;
public int lParam;
}
struct RECT
{
public int Left;
public int Top;
public int Right;
public int Bottom;
}
}
给刚刚的任务栏控制类加了个TopMost属性。只要设置任务栏的TopMost为false,任何窗口都不用设置this.FormBorderStyle = FormBorderStyle.None;就可以覆盖任务栏了。需要时,再设置回来。
TaskBar.TopMost = false;
这位兄台,我是试过的。
this.FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;
这两句在我本机测试没有任何问题。
/// 设置全屏或取消全屏
/// </summary>
/// <param name="fullscreen">true:全屏 false:恢复 </param>
/// <param name="rectOld">设置的时候,此参数返回原始尺寸,恢复时用此参数设置恢复 </param>
/// <returns>设置结果 </returns>
public static bool SetFullScreen(bool fullscreen, ref Rectangle rectOld)
{
int Hwnd = 0;
Hwnd = Win32API.FindWindow("HHTaskBar", null);
if (Hwnd == 0) return false;
if (fullscreen)
{
Win32API.ShowWindow(Hwnd, Win32API.SW_HIDE);
Rectangle rectFull = Screen.PrimaryScreen.Bounds;
Win32API.SystemParametersInfo(Win32API.SPI_GETWORKAREA, 0, ref rectOld, Win32API.SPIF_UPDATEINIFILE);//get
Win32API.SystemParametersInfo(Win32API.SPI_SETWORKAREA, 0, ref rectFull, Win32API.SPIF_UPDATEINIFILE);//set
}
else
{
Win32API.ShowWindow(Hwnd, Win32API.SW_SHOW);
Win32API.SystemParametersInfo(Win32API.SPI_SETWORKAREA, 0, ref rectOld, Win32API.SPIF_UPDATEINIFILE);
}
return true;
} //所用到的API声明
[DllImport("coredll.dll", EntryPoint = "FindWindow")]
private static extern int FindWindow(string lpWindowName, string lpClassName);
[DllImport("coredll.dll", EntryPoint = "SystemParametersInfo")]
private static extern int SystemParametersInfo(
int uAction,
int uParam,
ref Rectangle lpvParam,
int fuWinIni
);
public const int SPI_SETWORKAREA = 47;
public const int SPI_GETWORKAREA = 48;
/// <summary>
/// 设置全屏或取消全屏
/// </summary>
/// <param name="fullscreen">true:全屏 false:恢复 </param>
/// <param name="rectOld">设置的时候,此参数返回原始尺寸,恢复时用此参数设置恢复 </param>
/// <returns>设置结果 </returns>
public static bool SetFullScreen(bool fullscreen, ref Rectangle rectOld)
{
int Hwnd = 0;
Hwnd = Win32API.FindWindow("HHTaskBar", null);
if (Hwnd == 0) return false;
if (fullscreen)
{
Win32API.ShowWindow(Hwnd, Win32API.SW_HIDE);
Rectangle rectFull = Screen.PrimaryScreen.Bounds;
Win32API.SystemParametersInfo(Win32API.SPI_GETWORKAREA, 0, ref rectOld, Win32API.SPIF_UPDATEINIFILE);//get
Win32API.SystemParametersInfo(Win32API.SPI_SETWORKAREA, 0, ref rectFull, Win32API.SPIF_UPDATEINIFILE);//set
}
else
{
Win32API.ShowWindow(Hwnd, Win32API.SW_SHOW);
Win32API.SystemParametersInfo(Win32API.SPI_SETWORKAREA, 0, ref rectOld, Win32API.SPIF_UPDATEINIFILE);
}
return true;
} //所用到的API声明
[DllImport("coredll.dll", EntryPoint = "FindWindow")]
private static extern int FindWindow(string lpWindowName, string lpClassName);
[DllImport("coredll.dll", EntryPoint = "SystemParametersInfo")]
private static extern int SystemParametersInfo(
int uAction,
int uParam,
ref Rectangle lpvParam,
int fuWinIni
);
public const int SPI_SETWORKAREA = 47;
public const int SPI_GETWORKAREA = 48;
this.FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;经测试OK
this.WindowState = FormWindowState.Maximized; 这个方法可行的,我也试过
this.Height = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height;
this.Left = 0;
this.Top = 0;
this.TopMost = true;//以上代码写在Load里
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMdiPaneDoc)));
return (CMdiPaneDoc*)m_pDocument;
}
#endif //_DEBUG
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMdiPaneDoc)));
return (CMdiPaneDoc*)m_pDocument;
}
#endif //_DEBUG