小编Ben*_*der的帖子

如何将array_push与关联数组和索引键一起使用?

我有点'生锈与PHP,因为它发生有时我使用它几个星期有时它会发生你几个月没用.无论哪种方式,我试图传递另一个数组的值是"数组",在另一个数组上有序地...我想要做的主要是创建一个键,允许我每行组织增量值,特别是;

数组内容

Array 
(
    [key] => value
    [2] => 1 
    [3] => Inter 
    [4] => 4 
    [5] => 4 
    [6] => 0 
    [7] => 0 
    [8] => 5 
    [9] => 1
    [10] => +4
    [11] => 12
    [12] => Chievo Verona - Inter 0 - 1
    [13] => Inter - Milan 1 - 0
    [14] => Carpi - Inter 1 - 2
    [15] => Inter - Atalanta 1 - 0
    [16] => ;
    [17] => 2
    [18] => Torino
    [19] …
Run Code Online (Sandbox Code Playgroud)

php simple-html-dom

6
推荐指数
1
解决办法
1923
查看次数

如何使用ToolTip for DataGrid?

我正在尝试创建一个弹出窗口,当用户在单元格中重叠鼠标时出现该弹出窗口.我已经看过一些在线教程,我创建了一个ToolTip:

<DataGrid>
   <DataGrid.CellStyle>
       <Style>
         <Setter Property="DataGridCell.ToolTip">
               <Setter.Value>bb</Setter.Value>
         </Setter>
       </Style>
    </DataGrid.CellStyle>
    <DataGrid.Columns>
      <DataGridTextColumn Binding="{Binding Path = 'position'}" ClipboardContentBinding="{x:Null}" Header="Pos." Width="*"/>
      <DataGridTextColumn Binding="{Binding Path = 'teamName'}" ClipboardContentBinding="{x:Null}" Header="Squadra" Width="*" />
      <DataGridTextColumn Binding="{Binding Path = 'points'}" ClipboardContentBinding="{x:Null}" Header="Punti"  Width="*"/>
      <DataGridTextColumn Binding="{Binding Path = 'playedGames'}" ClipboardContentBinding="{x:Null}" Header="Giocate"  Width="*"/>
      <DataGridTextColumn Binding="{Binding Path = 'goals'}" ClipboardContentBinding="{x:Null}" Header="Goal fatti" Width="*"/>
      <DataGridTextColumn Binding="{Binding Path = 'goalsAgainst'}" ClipboardContentBinding="{x:Null}" Header="Goal subiti" Width="*"/>
      <DataGridTextColumn Binding="{Binding Path = 'goalDifference'}" ClipboardContentBinding="{x:Null}" Header="Differenza reti" Width="*"/>
     </DataGrid.Columns>
</DataGrid>
Run Code Online (Sandbox Code Playgroud)

唯一的问题是当用户与鼠标重叠时,我不明白如何显示单个单元格的全文.特别是当DataGrid是最小分辨率时,标题单元格没有完全显示,这是一个问题,为了避免这种情况,我会确保如果是用户将鼠标重叠在"pos"上,那么就显示完整标题为工具提示是"位置".我怎样才能做到这一点?

wpf xaml

4
推荐指数
1
解决办法
2652
查看次数

如何隐藏MahApps.Metro窗口中的关闭按钮?

我试图隐藏/删除我的MahApps MetroWindow上的关闭按钮但没有成功.

我试过这段代码:

private const int GWL_STYLE = -16;
private const int WS_SYSMENU = 0x80000;
[DllImport("user32.dll", SetLastError = true)]
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]

private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);

private void Window_Loaded(object sender, RoutedEventArgs e)
{
        var hwnd = new WindowInteropHelper(this).Handle;
        SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU);
}
Run Code Online (Sandbox Code Playgroud)

我还设置了一些属性:

...ShowTitleBar="False" WindowStyle="None" ResizeMode="NoResize" 
    Loaded="Window_Loaded" ...
Run Code Online (Sandbox Code Playgroud)

所以Window_Loaded是正确触发的,但这个问题的代码似乎不起作用.

这是实际结果:

在此输入图像描述

为什么按钮不会消失?我做错了什么?

c# windows wpf xaml mahapps.metro

3
推荐指数
1
解决办法
3604
查看次数

如何为一个控件定义多种样式?

我正在尝试在一个按钮中设置多种样式,特别是我:

风格 (1) =>Style="{StaticResource VisibleAnimation}"
风格 (2) =>Style="{DynamicResource AccentedSquareButtonStyle}"

一个伪代码:

<Button Content="Invia" Style="{DynamicResource AccentedSquareButtonStyle, VisibleAnimation}" ></Button>
Run Code Online (Sandbox Code Playgroud)

编辑:合并的可能解决方案

<Style TargetType="FrameworkElement" x:Key="VisibleAnimation" BasedOn="{DynamicResource AccentedSquareButtonStyle}">
Run Code Online (Sandbox Code Playgroud)

编译器在 BaseOn 行下划线并显示我:

无法根据类型样式设置 DynamicResourceExtension 的属性。您只能为 DependencyObject 的依赖属性设置 DynamicResourceExtension。

我怎么能做到这一点?

wpf xaml

3
推荐指数
1
解决办法
3689
查看次数

无法在文件夹中创建类的实例

我想为具有此内容的类Sounds创建一个实例:

class Sounds
{
    public static void getInformationSound() 
    {
        System.Media.SoundPlayer player = new System.Media.SoundPlayer(
            @"pack://application:,,,/Mah/Resources/Sounds/psl.wav");
        player.Play();
    }

    public void getErrorSound() 
    {
        ...
    }
}
Run Code Online (Sandbox Code Playgroud)

该类Sounds位于文件夹内,Tools您可以在图像中看到:

在此输入图像描述

我试图创建一个类的实例,Sounds并阅读如下方法:

Sounds sd = new Sounds();
sd.getInformationSound();
Run Code Online (Sandbox Code Playgroud)

sd用红色加下划线,编译器也显示这条消息:

它是一个字段但用作类型

我做错了什么?

c# wpf

0
推荐指数
1
解决办法
181
查看次数

标签 统计

wpf ×4

xaml ×3

c# ×2

mahapps.metro ×1

php ×1

simple-html-dom ×1

windows ×1