首页 > 编程知识 正文

英语作文,做c

时间:2023-05-03 19:44:07 阅读:174879 作者:1404

问题描述使用Popup控件作为弹出框,使用相对位置弹出菜单(即Placement=“Relative”),不同设备的弹出窗口位置不匹配。 例如下面的例子。

使用以下代码:

windowx : class=' wpf app1. main window ' xmlns=' http://schemas.Microsoft.com/winfx/2006/xaml/presentation ' xmas xaml ' xmlns 3360 d=' http://schemas.Microsoft.com/expression/blend/2008 ' xmlns 3360 MC=' http://schemas.opend 2006 ' xmlns 3360 local=' clr-namespace : wpf app1' MC 3: ignorable=' d ' tignorable ' 70'height='35'content='弹出窗口'/popupx : name=' popup1' placement=' relative ' allows transparency=' trupx ' IsOpen='{Binding IsChecked, ElementName=Btn_Popup} ' stays open=' false ' width=' 120 ' height=' 120 ' horizontal offset=' 80 ' vertical offset='-125 '网格边界宽度330 nd='white'textblocktext='弹出框' fontsize='16'horizonent

原因分析出现这种情况的主要原因是由于Windows系统设置的差异引起的问题。 弹出框的注册点取决于系统菜单位置的设置。

如何显示设置:

使用组合键Win R调用“运行”对话框,并在文本框中键入shell :3360: { 80 F3 f1 D5-feca-45f3- bc32-752 c 152 e 456 e }

打开后选择其他。 我发现大多数系统默认为左手打开。 但是,如果部分系统被人为设置为用右手打开,则Popup的弹出位置会异常。

解决方法要减肥的水杯、 修改系统配置

(1)手动修改

见上文

)2) Win32 Api修复

[dllimport(user32.dll ),entrypoint=) systemparametersinfo, setlasterror=true ] publicstaticexternboolsystemport voidsetmenualign (如果(/ui param为false,则设置弹出菜单的左对齐)。 如果为true,则右对齐systemparametersinfoset (0x 001c/* SPI _ setmenudropalignment ) /,} 贪玩的毛衣、调整代码

用Placement='Absolute '弹Popup就可以了。

windowx : class=' wpf app1. main window ' xmlns=' http://schemas.Microsoft.com/winfx/2006/xaml/presentation ' xmas xaml ' xmlns 3360 d=' http://schemas.Microsoft.com/expression/blend/2008 ' xmlns 3360 MC=' http://schemas.opend 2006 ' xmlns 3360 local=' clr-namespace : wpf app1' MC 3: ignorable=' d ' tignorable ' 70'height='35'content='单击以显示弹出菜单'/popupx : name=' popup1' placement=' absolute ' allows transparency=' IsOpen='{Binding IsChecked, element name=BTN _ popup } ' stays open=' false ' width=' 120 ' height=' 120 ' horizontal offset=' 80 ' vertical offset 333333 ' border thickness='1' corner radius=' 10 ' background=' white ' text block text='弹出框' fontsize=' 16 ' Horner

privatevoidpopup1_ opened (object sender,EventArgs e ) { Popup pop=sender as Popup; if(pop==null )返回; pop.placement target==null (if )返回; pop.placement==placement mode.absolute ) var relative=pop.placement target.pointtoscreen (new point ((0,0,0 ) ) pop.horizontal offset=relative.X80; pop.vertical offset=relative.y-100; }

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。