I have a ContextMenuStip that contains a dynamically generated list of ToolStripMenuItem objects. The problem is that when there are too many of them to fit onto the screen, tiny scroll buttons appear at the top and at the bottom of the list, and scrolling through the list is a bit tedious. How can I make the menu to automatically break into 2 or more columns so the user does not have to scrol
我有一个ContextMenuStip ,它包含一个动态生成的ToolStripMenuItem对象列表。 问题在于,当它们太多以适应屏幕时,在列表的顶部和底部出现微小的滚动按钮,并且滚动列表有点繁琐。 如何让菜单自动分成2列或更多列,以便用户不必滚动? 早些时候,这种行为从Windows中丢失 - 注意Windows Vista / 7使用树来显示开始菜单中的程序。 我怀疑这是因为它给用户提供了太多的数据和决策。 你确定这是向用户展示选择的最佳方式
I need to split a string into newlines in .NET and the only way I know of to split strings is with the Split method. However that will not allow me to (easily) split on a newline, so what is the best way to do it? To split on a string you need to use the overload that takes an array of strings: string[] lines = theText.Split( new[] { Environment.NewLine }, StringSplitOptions.None );
我需要在.NET中将字符串拆分为换行符,并且我知道拆分字符串的唯一方法是使用Split方法。 但是,这不会让我(很容易)在换行符上分裂,那么最好的方法是什么? 要在一个字符串上分割,你需要使用带有一串字符串的重载: string[] lines = theText.Split( new[] { Environment.NewLine }, StringSplitOptions.None ); 编辑: 如果要在文本中处理不同类型的换行符,则可以使用匹配多个字符串的功能。 这将在任何一
Using .NET 2.0 with WinForms, I'd like to create a custom, multi-columned menu (similiar to the word 2007 look&feel, but without the ribbon). My approach was creating a control, and using a left/right docked toolstrip, I have constructed a similar look&feel of a menu. However, there are a few shortcomings of this solution, such as the control can only be placed, and displayed wit
使用.NET 2.0与WinForms,我想创建一个自定义的多列菜单(类似于2007年的外观和感觉,但没有功能区)。 我的方法是创建一个控件,并使用左/右对接的工具条,我构建了一个类似的菜单外观和感觉。 但是,这个解决方案有一些缺点,例如 该控件只能放置并显示在表单中; 如果表格太小,控件的某些区域将不会显示; 该控件也必须手动显示/隐藏。 因此,我正在寻找一种在应用程序边界之外显示此控件的方法。 创建一个新表单
I have a C++ library, header of which looks like: void NotMyFun(double * a, int * b); The function reads from a , and writes to b . To call the library I have created a C++/CLI wrapper, where below function is defined: static void MyWrapperFun(double * a, int * b) { NotMyFun(a,b); } and works OK. From C# code, say, I have two managed arrays, ie double[] ma and double[] mb , where ma alr
我有一个C ++库,其头部如下所示: void NotMyFun(double * a, int * b); 该函数从a读取,并写入b 。 为了调用库,我创建了一个C ++ / CLI包装器,其中定义了以下函数: static void MyWrapperFun(double * a, int * b) { NotMyFun(a,b); } 并可以正常工作。 例如,从C#代码中,我有两个托管数组,即double[] ma和double[] mb ,其中ma已经包含一些有意义的数据,并且在调用wrapper时, mb被意外填充。 低于一个好方
I'm working through the Head First C# (3rd ed) text with instructions specific to VS 2012 and I'm having trouble finding the equivalent in VS Community 2015. The text says to begin a new project with Windows Store -> Blank App (XAML) but I don't see that as an option in my version of VS. The closest I could find was Windows Forms Application but that doesn't seem to be right
我正在通过头文件C#(第3版)文本,详细介绍VS 2012的相关说明,并且我在找到VS社区2015中的相应内容时遇到了困难。 文字说,开始一个新的项目与Windows应用商店 - >空白应用程序(XAML),但我没有看到作为我的VS版本的选项。 我能找到的最接近的是Windows窗体应用程序,但似乎并不正确,因为它并没有生成MainPage.xaml。 如果你不在Windows 8上,WPF是最接近你可以得到的,这本书也说明了它,它链接到了你可以获得WPF版
As you all know, in C# we could not do something like this: var voidObject = new void(); or var voidObject = new System.Void(); or var voidObject = Activator.CreateInstance(typeof(void)); But this code compiles successfully and in debug mode I can see that type of the voidObject is System.Void : var voidObject = FormatterServices.GetUninitializedObject(typeof(void)); What is this? Is thi
大家都知道,在C#中,我们不能这样做: var voidObject = new void(); 要么 var voidObject = new System.Void(); 要么 var voidObject = Activator.CreateInstance(typeof(void)); 但是,这段代码编译成功,并在调试模式下,我可以看到该类型的voidObject是System.Void : var voidObject = FormatterServices.GetUninitializedObject(typeof(void)); 这是什么? 这是真实的void实例吗? 从我可以看到它是一个完美
I am using OpenXML to manipulate Excel files. I am sending the Excel files as memory stream from SharePoint, and editing them: ie inserting a new worksheet and adding some data from SharePoint to that newly inserted workssheeet. The memorystream is then sent to the browser so it opens in the client office program. I can insert a new sheet and add data to the cells from other resources, but I
我正在使用OpenXML来操作Excel文件。 我将Excel文件作为SharePoint中的内存流发送,并对其进行编辑:即插入新的工作表并将一些数据从SharePoint添加到新插入的workssheeet中。 然后将内存流发送到浏览器,以便在客户端办公室程序中打开。 我可以插入新工作表并将数据添加到其他资源的单元格中,但是我在格式化单元格时遇到问题。 就像使它们变粗,改变字体和颜色等一样。我尝试了这里所描述的方法,但是它会弄乱我的工作簿
I have a large array in C (not C++ if that makes a difference). I want to initialize all members to the same value. I could swear I once knew a simple way to do this. I could use memset() in my case, but isn't there a way to do this that is built right into the C syntax? Unless that value is 0 (in which case you can omit some part of the initializer and the corresponding elements will be
我有一个C中的大数组(不是C ++,如果这有所作为)。 我想将所有成员初始化为相同的值。 我可以发誓我曾经知道一个简单的方法来做到这一点。 我可以在我的情况下使用memset() ,但没有办法做到这一点,内置到C语法? 除非该值为0(在这种情况下,您可以省略初始化程序的某个部分,并且相应的元素将初始化为0),但没有简单的方法。 不过,不要忽略这个明显的解决方案: int myArray[10] = { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
For an internal tool, I need to create something akin to Blender's node editor (see image below) or UE4's blueprint editor with WPF. The backend and individual blocks aren't a problem, but I'm not sure how to go about an arbitrary sized and expanding canvas. I thought about using a Canvas inside a ScrollViewer , but I think that would be difficult to scroll left (ie if the user
对于内部工具,我需要创建类似于Blender的节点编辑器(请参阅下图)或UE4的WPF蓝图编辑器。 后端和单个块不是问题,但我不确定如何去处理任意大小和扩大的画布。 我想过在ScrollViewer使用Canvas ,但我认为这很难向左滚动(即如果用户必须在ScrollViewer认为是边缘的左侧添加节点)。 我对WPF比较陌生,所以有人能指出我正确的方向吗? 您将不得不使用IScrollInfo接口编写自己的自定义Panel实现。 通过此接口,您可以随
My question is not about floating precision. It is about why Equals() is different from == . I understand why .1f + .2f == .3f is false (while .1m + .2m == .3m is true ). I get that == is reference and .Equals() is value comparison. (Edit: I know there is more to this.) But why is (.1f + .2f).Equals(.3f) true , while (.1d+.2d).Equals(.3d) is still false ? .1f + .2f == .3f;
我的问题不是浮动精度。 这是关于Equals()与==不同的原因。 我明白为什么.1f + .2f == .3f是false (而.1m + .2m == .3m是true )。 我得到的==是引用和.Equals()是价值比较。 (编辑:我知道还有更多。) 但为什么(.1f + .2f).Equals(.3f) true ,而(.1d+.2d).Equals(.3d)仍然是false ? .1f + .2f == .3f; // false (.1f + .2f).Equals(.3f); // true (.1d + .2d).Equals(.3d); // false