我正在制作一个像应用程序这样的浏览器来浏览存储在我计算机上的文件.我的应用程序将处于"图标"视图中.问题是:如何显示exe文件的图标?
我有一个.sql脚本,我想从中构建一个数据库.如何在sqlcmd中执行此操作?我知道它是这样的:
CREATE DATABASE dbName
GO
Run Code Online (Sandbox Code Playgroud)
但是如何指定.sql脚本和位置来构建数据库?
我正在尝试定位我的工具提示,以便它位于我的目标对象的底部和中心.我可以将它定位在底部ToolTipService.Postion="Bottom"
,但是如何将它定位在中心?
我想运行这样的东西:
For a = 0 To 4
For b = a To 4
For c = b To 4
Console.WriteLine(a & b & c)
Next
Next
Next
Run Code Online (Sandbox Code Playgroud)
但我需要互相创建n个循环.所以我创建了这个方法:
'iFrom = 0; iTo = 4; Depth = 3(loop count);
Private Sub Iterate(ByVal iFrom As Integer, ByVal iTo As Integer, ByVal Depth As Integer)
For i = iFrom To iTo
If Depth - 1 > 0 Then Iterate(iFrom, iTo, Depth - 1)
'Do stuff here
Next
End Sub
Run Code Online (Sandbox Code Playgroud)
从更高级别检索"i"值的最佳方法是什么?我应该将它们存储在阵列中吗?或者有一种完全不同的方法来解决这个问题?
Grid
调整大小时我需要保持单元格高度=宽度.
<Viewbox>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="0" Background="Black" Width="{Binding RelativeSource={RelativeSource Self}, Path=ActualHeight}"></Label>
<Label Grid.Row="1" Grid.Column="0" Background="Gray" Width="{Binding RelativeSource={RelativeSource Self}, Path=ActualHeight}"></Label>
<Label Grid.Row="0" Grid.Column="1" Background="Gray" Width="{Binding RelativeSource={RelativeSource Self}, Path=ActualHeight}"></Label>
<Label Grid.Row="1" Grid.Column="1" Background="Black" Width="{Binding RelativeSource={RelativeSource Self}, Path=ActualHeight}"></Label>
</Grid>
</Viewbox>
Run Code Online (Sandbox Code Playgroud)
感谢HB对于使用viewBox的想法!:)
是否有一个函数可以搜索某个子字符串的最后一次出现并返回它的索引?
例如,如果我想\
在文件路径中搜索char' ' 的最后一次出现' C:\Program Files\Microsoft
'.
我有这个带有边框的网格:
<Border Padding="0" BorderBrush="Orange" BorderThickness="2" CornerRadius="5">
<Grid >
<Label Grid.Row="0" Grid.Column="0" BorderBrush="Black"/>
<Label Grid.Row="1" Grid.Column="0" BorderBrush="Black"/>
<Label Grid.Row="0" Grid.Column="1" BorderBrush="Black"/>
<Label Grid.Row="1" Grid.Column="1" BorderBrush="Black"/>
</Grid>
</Border>
Run Code Online (Sandbox Code Playgroud)
问题是,标签边框与网格角落中的橙色边框重叠.这可能是因为z-index.如何解决这个问题呢?
如何创建一个控制台应用程序,它将读取用户的输入并将输入分配给变量?问题是,我需要在一行上输入几个单词,用" ab cd efg "等空格分隔,然后将ab分配给一个变量,将cd分配给另一个变量,然后将efg分配给另一个变量.输入的单词也可以是任何长度.
我有一个字符串列表.当用户输入字符时,程序将在文本框中显示列表中的所有可能字符串.
Dim fruit as new List(Of String) 'contains apple,orange,pear,banana
Dim rx as New Regex(fruit)
Run Code Online (Sandbox Code Playgroud)
例如,如果用户输入a,p,l,e,r,则程序将显示apple和pear.它应匹配输入所有字母的任何条目,无论顺序如何,无论其他字母如何. 我应该添加什么到rx?如果使用正则表达式无法实现,请指定其他任何方法.
如何为ListBox的滚动设置动画?我知道我可以使用scrollIntoView,但我该如何设置它的动画?我想按箭头键从一个listBoxItem移动到另一个.