我用C#创建一个Windows窗体应用程序.
我有一个普通表格和一个小组.
我将subForm显示在此面板中,代码如下:
SubForm objForm= SubForm.InstanceForm();
this.IsMdiContainer = true;
objForm.TopLevel = false;
pnlSubSystem.Controls.Add(objForm);
objForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
objForm.Dock = DockStyle.Fill;
objForm.Show();
Run Code Online (Sandbox Code Playgroud)
现在我想在这个面板的subForm上显示其他形式,但我不知道该怎么做.
我有一个令人沮丧的问题,我非常感谢一些帮助.我在ViewBox中有一个ListView,我无法让ListView中的项目水平拉伸.
这是XAML:
<Window x:Class="WpfApplication3.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfApplication3"
Title="Window1">
<Window.Resources>
<local:Inning x:Key="inning">
<local:Inning.Skins>
<local:Skin SkinNumber="1"></local:Skin>
<local:Skin SkinNumber="2"></local:Skin>
<local:Skin SkinNumber="3"></local:Skin>
</local:Inning.Skins>
</local:Inning>
</Window.Resources>
<Grid DataContext="{StaticResource inning}">
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Background="Black"
Text="SKINS"
Foreground="White"
FontSize="80"
FontWeight="Bold"
HorizontalAlignment="Center"></TextBlock>
<Grid Margin="2"
Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Viewbox>
<ListView Name="lvSkinNumbers"
ItemsSource="{Binding Skins}"
HorizontalAlignment="Stretch"
Background="Black"
VerticalAlignment="Stretch"
VerticalContentAlignment="Stretch">
<ListView.ItemTemplate>
<DataTemplate>
<TextBlock FontSize="250"
VerticalAlignment="Stretch"
LineStackingStrategy="BlockLineHeight"
Margin="2"
TextAlignment="Center"
HorizontalAlignment="Stretch"
Background="Black"
Foreground="White"
Text="{Binding SkinNumber}"></TextBlock>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Viewbox>
<Viewbox Grid.Column="1">
<ListView Name="lvFirstInningSkins" …
Run Code Online (Sandbox Code Playgroud) 我有一个带有方法Run的Dog类,它应该在屏幕上移动图片:
public bool Run()
{
Point p = PictureBoxDog.Location;
while(p.X < 530)
{
int movement = Randomizer.Next(0, 3);
p.X += movement;
PictureBoxDog.Location = p;
}
if (Location == 4) //Incomplete section.
return true;
else
return false;
}
Run Code Online (Sandbox Code Playgroud)
从按钮单击事件调用此方法,其中创建了4个dog对象,并且每个对象都调用Run方法:
private void button1_Click(object sender, EventArgs e)
{
Dog dog1 = new Dog(pictureDog1);
Dog dog2 = new Dog(pictureDog2);
Dog dog3 = new Dog(pictureDog3);
Dog dog4 = new Dog(pictureDog4);
dog1.Run();
dog2.Run();
dog3.Run();
dog4.Run();
}
Run Code Online (Sandbox Code Playgroud)
问题是每个方法一个接一个地执行,而不是同时执行.我希望每个方法同时运行.如果我删除了while语句,那么所有方法都会同时执行,但是使用while循环,它们会一个接一个地执行.任何关于如何解决这个问题的建议都非常感谢.没有while循环的run方法:
public bool Run() //Dog1.Run()
{
Point p = PictureBoxDog.Location; …
Run Code Online (Sandbox Code Playgroud) 我正在尝试构建一个API(使用ASP.NET WebApi),该API将由学校项目的本机移动应用程序使用.(我不关心/开发移动应用程序,这个责任属于不同的成员)我正处于需要实现基于令牌的Facebook登录的地步.有很多教程可用于如何为基于浏览器的应用程序实现此功能(这是非常直接的,大部分都是内置的),但我不认为我会遵循如何使用本机应用程序.我不明白重定向是如何工作的?
根据此链接,我的服务器无需专门处理任何内容.我不认为我明白这是如何工作的?如何处理来自Facebook的令牌?
此外,我应该实现令牌处理的哪个部分,我无法找到WebApi外部登录身份验证的良好文档.
无论如何,如果有人能指出我发生的令牌交换的确切流程以及ASP.NET默认实现的内容,那将是非常有用的.
此外,对我来说最大的困惑是我不明白如何处理Facebook返回的令牌.
对不起,如果这是我应该弄明白的话.我做了很多研究,发现自己陷入了(相关和无关)的信息.我不认为我甚至不知道如何搜索我需要的信息.
我读过一些链接:
我已经使用预准备语句将订单插入到订单表中,但现在我想根据订单表中插入的最后一个ID将订单商品插入到订单商品表中:
if (isset($_POST['process'])) {
$order_name = $_POST['order_name'];
//create initial order
$stmt = $conn2->prepare("INSERT INTO orders (order_name) VALUES (?)");
$stmt->bind_param('s', $order_name);
$stmt->execute();
//this gets the most recent auto incremented ID from the database - this is the order_id we have just created
$order_id = mysql_insert_id();
//loop over all of our order items and add to the database
foreach ($_SESSION['order'] as $item) {
Run Code Online (Sandbox Code Playgroud)
什么相当于mysql_insert_id();
使用准备好的声明?
我收到错误:
类型''的值不能用作默认参数,因为没有标准转换来键入'T'
在尝试编写这段代码时
protected T GetValue<T>(Expression<Func<T>> property, T defaultValueIfNull = null);
Run Code Online (Sandbox Code Playgroud)
有没有人知道如何制作空值类型.反正有没有这样做?
以下两种定义命名空间的方法有什么区别?
namespace A.B.C {
public class AA{
}
}
namespace A {
namespace B{
namesapce C{
public class AA{
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
在某些我可能拥有的地方
namespace A{
//some classes
}
namespace A.B {
//some classes
}
namespace A {
namespace B {
//some classes
}
}
Run Code Online (Sandbox Code Playgroud)
两者都需要做同样的事情来使用AA类using A.B.C;
我可以使用它C.AA a;
来指定C命名空间中的AA类,或者我必须使用fall命名空间约定:A.B.C.AA a;
避免可能的冲突?
我有以下网格
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
Run Code Online (Sandbox Code Playgroud)
我的GridSplitter在第3行(第4行),定义如下:
<GridSplitter Grid.Row="3"
ResizeDirection="Rows"
Style="{StaticResource HorizontalGridSplitter}"
IsTabStop="False" />
<Style x:Key="HorizontalGridSplitter"
TargetType="{x:Type GridSplitter}">
<Setter Property="Height"
Value="4" />
<Setter Property="HorizontalAlignment"
Value="Stretch" />
<Setter Property="VerticalAlignment"
Value="Stretch" />
<Setter Property="Margin"
Value="0" />
</Style>
Run Code Online (Sandbox Code Playgroud)
当我拖动分割以分割第2/4行时,它并没有真正分割行,看起来网格高度变大了.
嗯,我想我的场景很容易有2个元素: ListBox和Button:
<ListBox Name="BannedItemsListBox"
Margin="5"
MinWidth="100"
MaxWidth="100" " Height="
204" ItemsSource="{Binding Path=BannedItems, Mode=TwoWay}"></ListBox>
<Button Name="RemoveBannedItemsButton"
Margin="5"
MinWidth="65"
Height="22"
Click="RemoveBannedItemButton_Click">Remove</Button>
Run Code Online (Sandbox Code Playgroud)
我想IsEnabled
只有在XAML中选择(聚焦)ListBox中的Item时才将属性按钮绑定为true
我试过了
IsEnabled="{Binding ElementName=BannedSourcesListBox, Path=TouchesDirectlyOver.Count}"
Run Code Online (Sandbox Code Playgroud)
但没有去.
我有一个数据库,其中包含一个投诉表和提交日期.我要做的是,考虑到两个时期的开始和结束日期,我必须计算它们之间的增长百分比.
例如:
Q1(1月至3月)索赔= 200
Q2(4月 - 6月)索赔= 400
计算增长:
(现在 - 过去)/过去*100
增长百分比=(400-200)/ 200*100 = 100%增长
我必须从该报告中提取的信息在第一季度和第二季度之间增长了100%
这就是我想出的:
SELECT
(SELECT COUNT(id) FROM complaints WHERE submit_date >= start_date_period_1 AND submit_date <= end_date_period_1) AS q1_claims,
(SELECT COUNT(id) FROM complaints WHERE submit_date >= start_date_period_2 AND submit_date <= end_date_period_2) AS q2_claims,
(SELECT ((q2_claims - q1_claims)/q2_claims * 100) AS 'Percentage Growth')
FROM complaints;
Run Code Online (Sandbox Code Playgroud)
但不以正确的形式显示输出.它显示给定时期内每个日期的记录.我该如何修复查询?