问题列表 - 第7700页

是否可以将boost.any用作std :: map中的键(或类似的东西)?

std::map<any, string> 没有工作所以我想知道是否有另一种方法来获得arbritary键?

c++ boost

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

ViewModel模式最大的痛点是什么?

Glenn Block和我一直在合作开发ViewModel模式.我们一直在努力确定与模式相关的最大痛点,目标是增加框架支持以减轻疼痛.

今晚,格伦发布了"观看模特" - 电影,投了你的选票.我们希望收到你的来信.请在此处发布(并投票)了解实现ViewModel模式(也称为Model-View-ViewModel或MVVM)的最大痛点.告诉我们框架如何让您的生活更轻松!

我们正在寻找WPF和Silverlight.

那么请告诉我们,您希望框架做些什么来使ViewModel更容易?

presentation-model mvvm viewmodel

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

C# - 阻止代码在设计器中执行

我正在执行一行无法在设计器中执行的代码,导致我的所有控件的公共属性不再显示在设计器中.因此,我无法再在Visual Studios Design View中看到任何使用该控件的表单.

有问题的代码行调用一个不安全的代码项目,它执行一些图像处理; 评论它使设计视图重现生机.但是,代码执行完美,所以我无法理解设计器中代码失败的原因.这是被调用的代码:

        /// <summary>
        /// Performs a color adjustment on the source bitmap. 
        /// </summary>
        /// <param name="source">The bitmap to be processed. This is changed by the
        /// process action.</param>
        /// <param name="redChange">change to the red value. Can be negative.</param>
        /// <param name="greenChange">change to the green value. Can be negative.</param>
        /// <param name="blueChange">change to the blue value. Can be negative.</param>
        /// <returns></returns>
        public static Bitmap ProcessColor(Bitmap source, int redChange, int greenChange, int blueChange)
        {
            sourceBitmap = …
Run Code Online (Sandbox Code Playgroud)

compact-framework image-manipulation image-processing c#-2.0

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

JavaScript TextNode更新

如果我有

var t = document.createTextNode(text)
parent.appendChild(t);
Run Code Online (Sandbox Code Playgroud)

是否可以简单地更新内容t

我想改变里面的文字parent而不使用removeChild,createTextNodeappendChild.为什么我需要这个而不仅仅是使用innerHTML?因为我不想用HTML代码更新元素的内容,并且text可能包含特殊字符,例如<或&,它应该由TextNodeDOM方法解析.

谢谢,
汤姆

javascript dom innerhtml createtextnode

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

在C#中同步接口和实现注释的方法

是否有自动方式在界面与其实现之间同步注释?我目前正在记录它们,并且不想手动保持它们同步.

更新:

考虑以下代码:

interface IFoo{
    /// <summary>
    /// Commenting DoThis method
    /// </summary>
    void DoThis();
}
class Foo : IFoo {
    public void DoThis();
}
Run Code Online (Sandbox Code Playgroud)

当我创建这样的类:

IFoo foo=new Foo();
foo.DoThis();//comments are shown in intellisense
Run Code Online (Sandbox Code Playgroud)

这里的评论没有显示:

Foo foo=new Foo();
foo.DoThis();//comments are not shown in intellisense
Run Code Online (Sandbox Code Playgroud)

<inheritDoc/>标签将完全产生沙堡的文件,但它并没有在智能感知提示工作.

请分享您的想法.

谢谢.

c# documentation xml-documentation

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

在现有代码中为常量创建静态导入的简单方法?

如果我在Foo中有一个恒定的BAR,我将在C类中使用它,我将不得不写

Object o = Foo.BAR + "...";
Run Code Online (Sandbox Code Playgroud)

我可以在Eclipse中使用Ctrl-Shift-M(光标在BAR上)来创建静态导入,如下所示:

import static Foo.BAR;

Object o = BAR + "....";
Run Code Online (Sandbox Code Playgroud)

我目前正在更新遗留代码,其中有数以千计的这些代码我想转换为静态导入.Ctrl-Shift-O/Organize导入不会这样做.有没有我错过的技巧?


编辑:实际上,我更喜欢的是告诉Eclipse我想让Ctrl-Shift-M在这个特定类中的所有实例上做它的魔力,而不仅仅是我放置光标的单个实例.(这是遗留代码所以这实际上提高了可读性:))


编辑:我发现IntelliJ建议这样做.

java eclipse

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

如何将TableLayoutPanel中的所有列自动调整为完全相同的宽度?

我正在尝试创建一个相当广泛的UserControl,将方形控件合并到设计中,并允许调整大小.因为设计需要正方形,所以我需要TableLayoutPanels中的所有列都具有相同的宽度,因此包含的停靠控件也是方形的.

不幸的是,TableLayoutPanel的行为并没有给我这个结果.
使用TableLayoutPanel,将所有列设置为使用相同百分比的Control,(在一组7列中)给出6个宽度相等的列,以及第7个宽度可变的列.
我知道出现这种情况是因为每7个大小中有6个,在7列周围没有相同数量的列像素,第7列是这个不等式的溢出.

我想我想要的是类似于第8列的其他7列的溢出,允许所有7个"真实"列具有实际相等的宽度,但是对于第8列允许为0宽度.
到目前为止,我找不到允许此行为的设置.

任何人都可以告诉我如何让TableLayoutPanel做我想要的,或者我将不得不开始编写大量的解决方法代码?

编辑:

为了回应Yacoder的回答,我添加了一些代码来演示这个问题,另一个代码显示了使用TableLayoutPanel和Dock属性的标准功能来解决它​​的不成功,天真的尝试

问题演示:

Public Class Form1
Inherits System.Windows.Forms.Form
Public Sub New()
    Me.InitializeComponent()
End Sub
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
    Try
        If disposing AndAlso components IsNot Nothing Then
            components.Dispose()
        End If
    Finally
        MyBase.Dispose(disposing)
    End Try
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be …
Run Code Online (Sandbox Code Playgroud)

.net tablelayoutpanel winforms

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

Maven 2.1.0没有将系统属性传递给Java虚拟机

在Linux 机器上运行Hudson构建时,我们使用命令行将系统属性传递给Java虚拟机.它曾经在2.0.9中很好地工作,因为我们升级到2.1.0它已经完全停止工作.系统属性永远不会进入Java虚拟机.

我创建了一个小型测试项目,实际上根本不起作用.

这应该适用于Maven 2.0.9:

mvn2.0.9 -Dsystem.test.property=test test 
Run Code Online (Sandbox Code Playgroud)

但这会失败:

mvn2.1 -Dsystem.test.property=test test 
Run Code Online (Sandbox Code Playgroud)

Java代码就是这么做的

assertTrue( System.getProperty("system.test.property") != null); 
Run Code Online (Sandbox Code Playgroud)

maven-2 jvm system-properties maven-plugin surefire

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

如何将xsl样式表节点添加到XmlSerializer生成的XML中?

我有一个WCF REST服务,它返回使用XmlSerializer序列化的对象.如何将WSL样式表信息(如下所示)添加到WCF服务返回的输出中?

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="transforms/Customer.xsl"?>
<Customer>
    <Name>Foo</Name>
</Customer>
Run Code Online (Sandbox Code Playgroud)

我目前的业务合同:

[OperationContract, XmlSerializerFormat]
[WebGet( UriTemplate = "{id}" )]
Customer GetById( string id );

我希望能够做什么,以便控制样式表参考:

[OperationContract, XmlSerializerFormat]
[XslStylesheet( Href = "transforms/Customer.xsl" )]
[WebGet( UriTemplate = "{id}" )]
Customer GetById( string id );

.net xslt rest wcf web-services

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

如何在WPF应用程序中绘制色轮?

我开始玩WPF并希望在表格上绘制色轮.

起初我尝试在ArcSegment上使用LinearGradientBrush,如下所示:

<Path StrokeThickness="35" Height="150" Width="150">
    <Path.Stroke>
        <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
            <GradientStop Color="Red" Offset="0.15" />
            <GradientStop Color="Orange" Offset="0.2" />
            <GradientStop Color="Yellow" Offset="0.35" />
            <GradientStop Color="Green" Offset="0.5" />
            <GradientStop Color="Blue" Offset="0.65" />
            <GradientStop Color="Indigo" Offset="0.75" />
            <GradientStop Color="Violet" Offset="0.9" />
        </LinearGradientBrush>
    </Path.Stroke>
    <Path.Data>
        <PathGeometry >
            <PathFigure IsClosed="True" StartPoint="25,70">
                <ArcSegment Point="25,71" IsLargeArc="True"
                    Size="50,50" SweepDirection="Clockwise" />
            </PathFigure>
        </PathGeometry>
    </Path.Data>
</Path>
Run Code Online (Sandbox Code Playgroud)

不成功,因为渐变仍然是水平的.

另一个想法是我应用渐变后以某种方式弯曲线条.但我找不到适当的变换.

如果没有标准变换,是否可以进行自定义变换?或者我应该按像素绘制色轮?

请问任何想法.

wpf gradient transform color-wheel

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