我刚刚开始研究c#,并且正在摆弄一些我从某个论坛获得的代码示例.
此代码使用的命名空间using system.windows.forms我收到错误:senddown.我也是收到有关未定义功能的一些错误sendup与Forms我认为是在using system.windows.forms名字空间.
我正在使用visual studio 10(使用.net框架工作4.0).知道如何修复此错误吗?
谢谢.
我在WPF中的自定义窗口(AllowTransparency,WindowStyle = None)有问题.DragMove()方法效果很好,但是当我最大化窗口,或者它通过Windows 7 Aero Snap自动最大化时,此方法根本不起作用.所以我无法用鼠标拖动来取消窗口并将其状态返回到WindowState.Normal.左右Aero Snap运行良好,我可以快速捕捉和取消窗口.但是当它最大化时,除了Win + Down组合之外没有任何作用.也许有人知道如何解决这个问题,或者我在哪里可以通过工作的Aero Snap功能找到其他方法来实现自定义窗口的正确DragMove?
我正在WPF中设计自己的自定义窗口,我一直在尝试实现我以前在WinForms中使用的调整大小功能.由于某种原因,我的WndProc的返回值没有给我正确的结果.
我有一个NativeMethods类用于我所有的WndProc消息和结果:
public class NativeMethods
{
public const int WM_NCHITTEST = 0x84;
public const int HTCAPTION = 2;
public const int HTLEFT = 10;
public const int HTRIGHT = 11;
public const int HTTOP = 12;
public const int HTTOPLEFT = 13;
public const int HTTOPRIGHT = 14;
public const int HTBOTTOM = 15;
public const int HTBOTTOMLEFT = 16;
public const int HTBOTTOMRIGHT = 17;
}
Run Code Online (Sandbox Code Playgroud)
这是我的窗口背后的代码:
public partial class MainWindow : Window
{
const int GripSize = 16; …Run Code Online (Sandbox Code Playgroud) 我有一个无边框设计的WPF Mdi窗口,我希望它可以移动.我尝试了我在Google上找到的所有内容,但没有什么能适合我的情况.这是否可以在WPF无边框窗口中进行?谢谢=)
这就是我如何使我的窗口无边框.
<pbwpf:Window x:Class="w_main" x:ClassModifier="internal" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:pbwpf="clr-namespace:Sybase.PowerBuilder.WPF.Controls;assembly=Sybase.PowerBuilder.WPF.Controls" Uid="30" WindowStyle="None" AllowsTransparency="True" Background="Transparent" MenuName="m_menu" WindowType="Mdi" xmlns:my="http://schemas.microsoft.com/winfx/2006/xaml/presentation/ribbon" VirtualizingStackPanel.VirtualizationMode="Recycling" xmlns:sys="clr-namespace:System;assembly=mscorlib" Center="True" ResizeMode="CanResize" Height="740" Width="1024" WindowState="Maximized" Resizable="True" ControlMenu="True">
<Grid SnapsToDevicePixels="True" Height="700" Width="1009">
<Grid.Effect>
<DropShadowEffect Color="Black" BlurRadius="15" Direction="721" ShadowDepth="1" RenderingBias="Quality" />
</Grid.Effect>
<Border Background="White" />
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="90" />
<ColumnDefinition Width="680" />
<ColumnDefinition Width="69" />
<ColumnDefinition Width="170" />
</Grid.ColumnDefinitions>
<Border Grid.Column="0" Grid.Row="0">
<Image Source="Images/sample_bms.png" VerticalAlignment="Center" HorizontalAlignment="Center"></Image>
</Border>
<Border UseLayoutRounding="True" Grid.Row="0" Grid.Column="2" Background="#2cb6d9" BorderBrush="#25a6c7" BorderThickness="1,0,1,1">
<Grid> …Run Code Online (Sandbox Code Playgroud) wpf ×4
c# ×2
wpf-controls ×2
.net ×1
cursor ×1
drag ×1
maximize ×1
move ×1
powerbuilder ×1
styles ×1
winforms ×1
wpftoolkit ×1