问题描述
WPF设置成无边框窗体后,点击任务栏无法最小化.在Winform中可以用以下方式解决这个问题.[DllImport("user32.dll",EntryPoint="GetWindowLong",CharSet=CharSet.Auto)]publicstaticexternintGetWindowLong(HandleRefhWnd,intnIndex);[DllImport("user32.dll",EntryPoint="SetWindowLong",CharSet=CharSet.Auto)]publicstaticexternIntPtrSetWindowLong(HandleRefhWnd,intnIndex,intdwNewLong);protectedoverrideCreateParamsCreateParams{get{constintWS_MINIMIZEBOX=0x00020000;//Winuser.h中定义CreateParamscp=base.CreateParams;cp.Style=cp.Style|WS_MINIMIZEBOX;//允许最小化操作returncp;}}
但是在WPF中应该怎么改才能点击任务栏,窗体就最小化,
解决方案
解决方案二:
UseResizeMode="CanMinimize".Thiswillallowyoutominimizetothetaskbar.
解决方案三:
引用楼主HACKWSN的回复:
WPF设置成无边框窗体后,点击任务栏无法最小化.在Winform中可以用以下方式解决这个问题.[DllImport("user32.dll",EntryPoint="GetWindowLong",CharSet=CharSet.Auto)]publicstaticexternintGetWindowLong(HandleRefhWnd,intnIndex);[DllImport("user32.dll",EntryPoint="SetWindowLong",CharSet=CharSet.Auto)]publicstaticexternIntPtrSetWindowLong(HandleRefhWnd,intnIndex,intdwNewLong);protectedoverrideCreateParamsCreateParams{get{constintWS_MINIMIZEBOX=0x00020000;//Winuser.h中定义CreateParamscp=base.CreateParams;cp.Style=cp.Style|WS_MINIMIZEBOX;//允许最小化操作returncp;}}但是在WPF中应该怎么改才能点击任务栏,窗体就最小化,
可以了,非常感谢您.要是早遇到您,就不用腾到半夜了.
解决方案四:
引用楼主HACKWSN的回复:
WPF设置成无边框窗体后,点击任务栏无法最小化.在Winform中可以用以下方式解决这个问题.[DllImport("user32.dll",EntryPoint="GetWindowLong",CharSet=CharSet.Auto)]publicstaticexternintGetWindowLong(HandleRefhWnd,intnIndex);[DllImport("user32.dll",EntryPoint="SetWindowLong",CharSet=CharSet.Auto)]publicstaticexternIntPtrSetWindowLong(HandleRefhWnd,intnIndex,intdwNewLong);protectedoverrideCreateParamsCreateParams{get{constintWS_MINIMIZEBOX=0x00020000;//Winuser.h中定义CreateParamscp=base.CreateParams;cp.Style=cp.Style|WS_MINIMIZEBOX;//允许最小化操作returncp;}}但是在WPF中应该怎么改才能点击任务栏,窗体就最小化,
还想再请教你一个问题,ComboBox怎么做到水印功能呢?XML如何写?
解决方案五:
引用3楼HACKWSN的回复:
Quote: 引用楼主HACKWSN的回复:
WPF设置成无边框窗体后,点击任务栏无法最小化.在Winform中可以用以下方式解决这个问题.[DllImport("user32.dll",EntryPoint="GetWindowLong",CharSet=CharSet.Auto)]publicstaticexternintGetWindowLong(HandleRefhWnd,intnIndex);[DllImport("user32.dll",EntryPoint="SetWindowLong",CharSet=CharSet.Auto)]publicstaticexternIntPtrSetWindowLong(HandleRefhWnd,intnIndex,intdwNewLong);protectedoverrideCreateParamsCreateParams{get{constintWS_MINIMIZEBOX=0x00020000;//Winuser.h中定义CreateParamscp=base.CreateParams;cp.Style=cp.Style|WS_MINIMIZEBOX;//允许最小化操作returncp;}}但是在WPF中应该怎么改才能点击任务栏,窗体就最小化,
还想再请教你一个问题,ComboBox怎么做到水印功能呢?XML如何写?
这个从头讲有点复杂了,你要是能找本书看看如何定制ControlTemplate,事情就变得很简单了。可以参考我的博客,讲如何给textbox加水印:http://blog.csdn.net/gentle_wolf/article/details/7944959
解决方案六:
ControlTemplate是可以解决一切问题的,试试看,其实一点也不麻烦
解决方案七:
引用楼主HACKWSN的回复:
WPF设置成无边框窗体后,点击任务栏无法最小化.在Winform中可以用以下方式解决这个问题.[DllImport("user32.dll",EntryPoint="GetWindowLong",CharSet=CharSet.Auto)]publicstaticexternintGetWindowLong(HandleRefhWnd,intnIndex);[DllImport("user32.dll",EntryPoint="SetWindowLong",CharSet=CharSet.Auto)]publicstaticexternIntPtrSetWindowLong(HandleRefhWnd,intnIndex,intdwNewLong);protectedoverrideCreateParamsCreateParams{get{constintWS_MINIMIZEBOX=0x00020000;//Winuser.h中定义CreateParamscp=base.CreateParams;cp.Style=cp.Style|WS_MINIMIZEBOX;//允许最小化操作returncp;}}但是在WPF中应该怎么改才能点击任务栏,窗体就最小化,
引用1楼gentle_wolf的回复:
UseResizeMode="CanMinimize".Thiswillallowyoutominimizetothetaskbar.
[code=csharp]<!--鼠标移入移出--><TriggerProperty="IsMouseOver"Value="True"><Trigger.EnterActions><BeginStoryboard><Storyboard><DoubleAnimationTo="30"Duration="0:0:0.2"Storyboard.TargetName="back"Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.BlurRadius)"/><ColorAnimationTo="#AFFF"BeginTime="0:0:0.2"Duration="0:0:0.2"Storyboard.TargetName="fore"Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)"/><ColorAnimationTo="#3FFF"BeginTime="0:0:0.2"Duration="0:0:0.2"Storyboard.TargetName="fore"Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)"/></Storyboard></BeginStoryboard></Trigger.EnterActions><Trigger.ExitActions><BeginStoryboard><Storyboard><DoubleAnimationDuration="0:0:0.2"Storyboard.TargetName="back"Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.BlurRadius)"/><ColorAnimationDuration="0:0:0.2"Storyboard.TargetName="fore"Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)"/><ColorAnimationDuration="0:0:0.2"Storyboard.TargetName="fore"Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)"/></Storyboard></BeginStoryboard></Trigger.ExitActions></Trigger>
[/code]这是鼠标移入移出的触发器,我想加个属性触发器,当按钮Background的值为Red时,循环这移入移出达到闪烁效果,这XAML怎么写呢?有空的话再帮个忙.