小编Uwe*_*eim的帖子

如何在选中时更改System.Windows.Forms.ToolStripButton高亮/背景颜色?

我有一个ToolStripButton用作单选按钮.选中时,按钮周围会出现蓝色轮廓,但没有背景颜色.对于用户来说,检查按钮是不够清楚的,因此我想更改背景颜色以使检查状态更加明显.

当Checked属性设置为true时,如何更改高亮颜色?

这是一段代码:

this.hideInactiveVehiclesToolstripButton.CheckOnClick = true;
this.hideInactiveVehiclesToolstripButton.ForeColor = System.Drawing.Color.Blue;
this.hideInactiveVehiclesToolstripButton.AutoSize = false;
this.hideInactiveVehiclesToolstripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.hideInactiveVehiclesToolstripButton.Image = global::ClientUI.Properties.Resources.toggleInactive;
this.hideInactiveVehiclesToolstripButton.ImageTransparentColor = System.Drawing.Color.Black;
this.hideInactiveVehiclesToolstripButton.Name = "hideInactiveVehiclesToolstripButton";
this.hideInactiveVehiclesToolstripButton.Size = new System.Drawing.Size(48, 48);
this.hideInactiveVehiclesToolstripButton.Text = "Hide Inactive Vehicles";
this.hideInactiveVehiclesToolstripButton.Click +=new System.EventHandler(this.hideInactiveVehiclesToolstripButton_Click);
Run Code Online (Sandbox Code Playgroud)

.net c# toolstripbutton c#-2.0

21
推荐指数
1
解决办法
2万
查看次数

文本和边框之间的富文本框填充

是否可以在文本和边框之间的Rich Text Box控件中添加填充?

我尝试将一个富文本框对接到一个面板内,其四边的填充设置为10,并完成了我想要的.除非需要填充富文本框的垂直滚动条,否则也会填充.

c# winforms

21
推荐指数
4
解决办法
2万
查看次数

html5的文件api与jquery的例子?

我想使用html5的文件api,结合外部拖放功能(将外部文件拖到指定的位置并捕获其内容)和jquery.我找到了一个有效的非jquery示例:(html5 demo:file api)

 var drop = document.getElementById('drop');  
 drop.ondragover = function () {this.className = 'focus'; return false;};  
 drop.ondragend = function () { this.className = ''; return false; };  
 drop.ondrop=function(e) {  
          this.className = '';  
          e.preventDefault();  
          var file = e.dataTransfer.files[0];  
          var reader = new FileReader();  
          reader.onload = function (evt) {  
                console.log(evt.target.result);  
          }  
          reader.readAsText(file);  
      }; 
Run Code Online (Sandbox Code Playgroud)

这很好用.现在我想让这更像是一个jquery-ish,我试过:

 $("#drop").bind('ondragover',function() {this.addClass('focus'); return false;})
.bind("ondragend",function () { this.removeClass('focus'); return false;})  
.bind("ondrop",function(e) {  
         this.removeClass("focus");  
         e.preventDefault();  
         var file = e.dataTransfer.files[0];  
         var reader = new FileReader();  
         reader.onload = function …
Run Code Online (Sandbox Code Playgroud)

api jquery html5 file

21
推荐指数
2
解决办法
2万
查看次数

HDF5示例代码

使用HDF5DotNet,任何人都可以指向我的示例代码,它将打开一个hdf5文件,提取数据集的内容,并将内容打印到标准输出?

到目前为止,我有以下内容:

        H5.Open();
        var h5 = H5F.open("example.h5", H5F.OpenMode.ACC_RDONLY);
        var dataset = H5D.open(h5, "/Timings/aaPCBTimes");
        var space = H5D.getSpace(dataset);
        var size = H5S.getSimpleExtentDims(space);
Run Code Online (Sandbox Code Playgroud)

然后它有点混乱.

我实际上想对数据集的内容进行一些处理,但我认为一旦我转储到标准输出,我就可以从那里开始工作.

更新:我已经破解了这个足以解决我自己的问题.我没有意识到数据集是一个多数组 - 我认为它更像是一个数据库表.万一有人对此感兴趣,

double[,] dataArray = new double[size[0], 6];
var wrapArray = new H5Array<double>(dataArray);
var dataType = H5D.getType(d);
H5D.read(dataset, dataType, wrapArray);
Console.WriteLine(dataArray[0, 0]);
Run Code Online (Sandbox Code Playgroud)

c# hdf5

21
推荐指数
2
解决办法
2万
查看次数

LINQ Max扩展方法在空集合上给出错误

我有以下查询:

var maxNumber = dbContext.Where(a => a.Id == 9).Max(a => a.Sample_Num);
Run Code Online (Sandbox Code Playgroud)

如果没有9的Id,我会收到错误.如果没有ID为9,我喜欢将结果默认为0.

我试过了:

var maxNumber = dbContext.Where(a => a.Id == 9).Max(a => a.Sample_Num) ?? 0; 
Run Code Online (Sandbox Code Playgroud)

以及其他变化,但无法使其工作

c# linq

21
推荐指数
2
解决办法
1万
查看次数

如何集成NLog以将日志写入Azure Streaming日志

目前我正在使用NLog将我的应用程序错误写入文本文件.除了写入Azure Blob存储之外,如何配置NLog将错误消息写入Azure Streaming Log?

c# nlog azure-storage-blobs

21
推荐指数
1
解决办法
9059
查看次数

WPF 设计器问题:XDG0008 命名空间“clr-namespace:PulserTester.Convertors”中不存在名称“NumericTextBoxConvertor”

我有一个错误,无法让我看到我的设计师..但我在构建时没有错误,我的程序运行良好,没有问题

我试图:

  • 清理和重建
  • 更新 Visual Studio
  • 修复 Visual Studio
  • 重启我的电脑

没有任何帮助。我不知道我还能做些什么来解决它。

我必须尝试在这里查看并且即使在重新启动 Visual Studio 后也不为我工作,重新构建解决方案

名称 <...> 在命名空间 clr-namespace <...> 中不存在

这是我的错误:

在此处输入图片说明

这是 Xaml 文件:

<Window x:Class="PulserTester.windows.ConfigPage"
             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:local="clr-namespace:PulserTester.windows"
        xmlns:Convertors="clr-namespace:PulserTester.Convertors"
        mc:Ignorable="d" 
             d:DesignHeight="575.068" Width="500">
    <Window.Resources>
        <Convertors:NumericTextBoxConvertor x:Key="NumericTextBoxConvertor" />
    </Window.Resources>
    <Grid Background="White">
        <StackPanel>
            <StackPanel Margin="5">
                <TextBlock HorizontalAlignment="Right">?? ??????</TextBlock>
                <TextBox HorizontalAlignment="Right" MinWidth="100" Text="{Binding PulserName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox>
            </StackPanel>

            <StackPanel Margin="5">
                <TextBlock HorizontalAlignment="Right">??? ????? ????? ???? ?? ??????</TextBlock>
                <CheckBox  HorizontalAlignment="Right" IsChecked="{Binding FailQuestion,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></CheckBox>
            </StackPanel>

            <StackPanel Margin="5">
                <TextBlock HorizontalAlignment="Right">??? ????? ????? ????</TextBlock>
                <CheckBox  HorizontalAlignment="Right" IsChecked="{Binding CalibrationOption,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></CheckBox> …
Run Code Online (Sandbox Code Playgroud)

c# wpf xaml mvvm

21
推荐指数
3
解决办法
4万
查看次数

如何在WIX中为所有用户创建桌面快捷方式

我正在使用WIX开发MSI安装程序,我可以在桌面上为一个用户创建快捷方式.现在我该怎么做才能为机器上的所有用户创建快捷方式?请指教.谢谢.

<Shortcut Id="desktopshortcut" Directory="DesktopFolder" Name="test" 
          WorkingDirectory='INSTALLDIR' Advertise="yes" />
Run Code Online (Sandbox Code Playgroud)

installer wix shortcut

20
推荐指数
1
解决办法
1万
查看次数

如何反序列化JSON数组并忽略根节点?

我有来自服务器的下一个响应 -

{"response":[{"uid":174952xxxx,"first_name":"xxxx","last_name":"xxx"}]}
Run Code Online (Sandbox Code Playgroud)

我试图以下一种方式反序化 -

JsonConvert.DeserializeObject<T>(json);  
Run Code Online (Sandbox Code Playgroud)

其中T = VkUser的列表,但是我收到了错误.

[JsonObject]
public class VkUser
{
    [JsonProperty("uid")]
    public string UserId { get; set; }

    [JsonProperty("first_name")]
    public string FirstName { get; set; }

    [JsonProperty("last_name")]
    public string LastName { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

我一直在尝试

public class SomeDto // maybe Response as class name will fix it but I don't want such name
{
    public List<VkUser> Users {get;set;}
}
Run Code Online (Sandbox Code Playgroud)

什么反序列化选项可以帮助我?

c# json json.net deserialization

20
推荐指数
1
解决办法
2万
查看次数

计算.NET核心项目的代码度量标准?

我正在玩ASP.NET核心和.NET核心项目.对于经典的C#项目,Visual Studio 2015具有计算代码度量的功能.对于.NET Core,预览2工具中缺少支持.

在工具更完整之前,有没有人知道解决方法?

c# visual-studio visual-studio-2015 .net-core

20
推荐指数
1
解决办法
6589
查看次数