我有一个带有ItemsPanel的ListBox
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<StackPanel x:Name="ThumbListStack" Orientation="Horizontal" />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
Run Code Online (Sandbox Code Playgroud)
我想在后面的代码中使用TranslateTransform沿X轴移动堆栈面板.
问题是,我找不到Stack Panel.
ThumbListBox.FindName("ThumbListStack")
Run Code Online (Sandbox Code Playgroud)
什么都不返回 我想用它:
Storyboard.SetTarget(x, ThumbListBox.FindName("ThumbListStack"))
Run Code Online (Sandbox Code Playgroud)
如何获取堆栈面板,以便我可以将其与TranslateTransform一起使用
谢谢
我正在尝试将一些C#代码转换为VB.NET.
我在C#中有以下内容(有效)
m_switchImageTimer = new DispatcherTimer();
m_switchImageTimer.Interval = Interval;
m_switchImageTimer.Tick += (s, e) => LoadNextImage();
Run Code Online (Sandbox Code Playgroud)
我努力转换成功的关键是:
m_switchImageTimer.Tick += (s, e) => LoadNextImage();
Run Code Online (Sandbox Code Playgroud)
我试过的是:
m_switchImageTimer.Tick += Function(s, e) LoadNextImage()
m_switchImageTimer.Tick += New EventHandler(AddressOf LoadNextImage)
Run Code Online (Sandbox Code Playgroud)
这些都不起作用.
第一次尝试产生两个错误,第一个VS2010突出显示在m_switchImageTimer.Tick下:
错误1'Public Event Tick(sender As Object,e As System.EventArgs)'是一个事件,不能直接调用.使用'RaiseEvent'语句来引发事件
并在LoadNextImage()下突出显示会产生以下错误:
错误3表达式不生成值.
第二次尝试产生相同的错误:
错误1'Public Event Tick(sender As Object,e As System.EventArgs)'是一个事件,不能直接调用.使用'RaiseEvent'语句来引发事件.
如何将C#代码转换为VB.NET?
谢谢Ben
我正在开发一个在Windows XP(嵌入式)上运行的旧版vb6应用程序,它使用ChangeDisplaySettingsEx来控制连接的监视器的分辨率.
我的任务是在安装多个监视器时找到一种方法让ChangeDisplaySettingsEx在克隆和扩展模式之间切换.
当连接第二台显示器时,它会自动在克隆模式下工作.
当我使用EnumDisplayDevices枚举可用的显示设备时,DISPLAY_DEVICE.DeviceString显示如下:
\\.\DISPLAY1\Monitor0
\\.\DISPLAY1\Monitor1
Run Code Online (Sandbox Code Playgroud)
当监视器处于扩展模式时,它们显示如下:
\\.\DISPLAY1\Monitor0
\\.\DISPLAY2\Monitor0
Run Code Online (Sandbox Code Playgroud)
我已经反复阅读过MSDN,并且对于如何调用API将模式从Clone更改为Extended,似乎没有一个可靠的答案.
我的猜测是分离第二台显示器,然后尝试找出重新连接的方法,所以我开始尝试按照http://msdn.microsoft.com/en-us/library/dd162617(v=vs.85)进行分离.).aspx但是我不能让任何这个工作.
每当我尝试解析\.\ DISPLAY1\Monitor1到ChangeDisplaySettingsEx我得到DISP_CHANGE_BADPARAM - 例如
ChangeDisplaySettingsEx(\\.\DISPLAY1\Monitor1, DevM, 0, CDS_GLOBAL Or CDS_UPDATEREGISTRY, 0)
Run Code Online (Sandbox Code Playgroud)
我真的把头发拉出来了.
有谁知道如何禁用克隆模式并使用API启用扩展模式?
我正在研究一个旧的vb6应用程序(长篇故事,.NET Framework不可用).
我想知道,我可以将vb6 Class Property项声明为Enum吗?
例如
Public Enum WinInetPort
INTERNET_INVALID_PORT_NUMBER = 0
INTERNET_DEFAULT_FTP_PORT = 21
INTERNET_DEFAULT_GOPHER_PORT = 70
INTERNET_DEFAULT_HTTP_PORT = 80
INTERNET_DEFAULT_HTTPS_PORT = 443
INTERNET_DEFAULT_SOCKS_PORT = 1080
End Enum
Run Code Online (Sandbox Code Playgroud)
课程模块:
Private m_Port As WinInetPort
Public Property Get Port() As WinInetPort
Port = m_Port
End Property
Public Property Let Port(val As WinInetPort)
m_Port = val
End Property
Run Code Online (Sandbox Code Playgroud)
但是,我在编译时遇到错误
End Sub,End Function或End Property之后只能显示注释
该错误在类中的下一个Private语句中突出显示.
我在网上的某个地方读过vb6类不能公开公共常量 - 是否有解决方法?
谢谢
我正在尝试比较vb.NET中的Office版本号
如何确定:12.0.64是大于还是小于12.0.62或14.0.4762
似乎有2个小数的事实,vb不喜欢它.
我正在尝试更改WPF ListBox中所选项目的背景.
我试图为它实现一种风格,但由于某种原因它没有被应用.我仍然得到一个蓝色的背景.谁能明白为什么?
<UserControl x:Class="Thumbnails"
xmlns:local="clr-namespace:ContentPresenter"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="350" d:DesignWidth="800">
<UserControl.Resources>
<local:ThumbImageHeightConverter x:Key="HeightConv" />
<local:ThumbImageWidthConverter x:Key="WidthConv" />
<local:InnerGridHeightConverter x:Key="InnerGridHeightConv" />
<local:ReflectWidthConverter x:Key="ReflectWidthConv" />
<local:ReflectCenterYConv x:Key="ReflectCenterYConv" />
<Style x:Name="ListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
<Style.Triggers>
<Trigger Property="Selector.IsSelected" Value="True">
<Setter Property="Background" Value="White" />
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="{x:Type ListBox}">
<!-- Set the ItemTemplate of the ListBox to a DataTemplate which explains how to display an object of type BitmapImage. -->
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<Grid x:Name="ThumbGrid" VerticalAlignment="Top" Height="{Binding ElementName=ThumbListBox, Path=ActualHeight}" >
<Grid.RowDefinitions> …Run Code Online (Sandbox Code Playgroud) 我有这个用户控件,它在ListBox周围生成1px边框.
我发现它是默认的Bd边框.我似乎无法弄清楚如何设计它,因此1px间隙不再出现.
<UserControl x:Class="Thumbnails"
xmlns:local="clr-namespace:ContentPresenter"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d"
d:DesignHeight="350" d:DesignWidth="800">
<UserControl.Resources>
<local:ThumbImageHeightConverter x:Key="HeightConv" />
<local:ThumbImageWidthConverter x:Key="WidthConv" />
<local:InnerGridHeightConverter x:Key="InnerGridHeightConv" />
<local:ReflectWidthConverter x:Key="ReflectWidthConv" />
<local:ReflectCenterYConv x:Key="ReflectCenterYConv" />
<local:BorderThicknessScale x:Key="BorderThicknessScale" />
<local:BorderCornerRadiusScale x:Key="BorderCornerRadiusScale" />
<Storyboard x:Key="FadeUpAndFlash">
<!--<DoubleAnimation From="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Duration="0:0:10" FillBehavior="Stop" />-->
<DoubleAnimation From="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Duration="0:0:1" FillBehavior="Stop" />
</Storyboard>
<Storyboard x:Key="ReflectFadeUpAndFlash">
<!--<DoubleAnimation From="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Duration="0:0:10" FillBehavior="Stop" />-->
<DoubleAnimation From="0" To="0.75" Storyboard.TargetProperty="(UIElement.Opacity)" Duration="0:0:1" FillBehavior="Stop" />
</Storyboard>
<Style TargetType="{x:Type ListBox}">
<!-- Set the ItemTemplate of the ListBox to …Run Code Online (Sandbox Code Playgroud)