.net-2.0

Displaying thumbnail icons 128x128 pixels or larger in a grid in ListView

时间秒杀一切 提交于 2019-12-28 08:09:21
问题 Original Question (see Update below) I have a WinForms program that needs a decent scrollable icon control with large icons (128x128 or larger thumbnails, really) that can be clicked to hilight or double clicked to perform some action. Preferably there would be minimal wasted space (short filename captions might be needed below each icon; if the filename is too long I can add an ellipsis). (source: updike.org) I tried using a ListView with LargeIcon (default .View) and the results are

what's the use of string.Clone()?

折月煮酒 提交于 2019-12-28 04:22:08
问题 there are 2 examples of code: # 1 string str1 = "hello"; string str2 = str1; //reference to the same string str1 = "bye"; //new string created and # 2 string str3 = "hello"; string str4 = (string)str3.Clone();//reference to the same string str3 = "bye";//new string created looks like they are identical aren't they? so what is the benefit to use Clone()? can you give me an example when I cannot use code#1 but code#2 ? 回答1: This is useful since string implements ICloneable , so you can create a

Why are 2 separate string references equal? In other words why are s and t both the same reference?

佐手、 提交于 2019-12-25 18:44:27
问题 Why are the 2 string references the same? I am trying to write a copy constructor and want to avoid string references that point to the same string. using System; namespace StringRefTest { class Program { public static void Main(string[] args) { Console.WriteLine("String Test!"); string s = "f"; // This should be one reference string t = "f"; // This should be another if (ReferenceEquals(s, t)) Console.WriteLine("Ref Same"); else Console.WriteLine("Ref Not Same"); // Should be true // The

ASP.Net ViewState doesn't work when Control become Enable=False

China☆狼群 提交于 2019-12-25 02:53:53
问题 Why when a control does contain value but it's set to .Enable=False that all controls become disable (that's ok) but why that the ViewState doesn't retain the data on the next post back? If I get the UserControl without modifing its Enable state, the ViewState work between post back. How can we disable a UserControl that all its control become disable (this part work) but all of them KEEP use the ViewState (this doesn't work)? Clarification: 1)In the aspx.cs click button EDIT: myControl

Replace tokens in an aspx page on load

瘦欲@ 提交于 2019-12-25 02:38:49
问题 I have an aspx page that contains regular html, some uicomponents, and multiple tokens of the form {tokenname} . When the page loads, I want to parse the page content and replace these tokens with the correct content. The idea is that there will be multiple template pages using the same codebehind. I've no trouble parsing the string data itself, (see named string formatting, replace tokens in template) my trouble lies in when to read, and how to write the data back to the page... What's the

C# - Can a List<MyClass> be seamlessly cast to a List<Interface> or similar?

天大地大妈咪最大 提交于 2019-12-25 01:46:03
问题 I have a DataSource in my control which is always a List<T> where T has to inherit from IEntity . public class MyClass<T> where T : IEntity { public List<T> DataSource { get; set; } } Now, obviously you can't cast a List<T> to a List<IEntity> doing the following: List<IEntity> wontWork = (List<IEntity>)this.DataSource; How can I get the DataSource as a List of IEntity , whilst still being able to add and remove items from the DataSource ? I.e. I could do the following, but removing from the

Linking to a static lib that links to a static lib

情到浓时终转凉″ 提交于 2019-12-25 00:54:08
问题 I have a (managed/unmanaged C++) winforms app that links to a static library. That library links to another static library. When I do a Rebuild on the Winforms project, Visual Studio 2005 attempts to rebuild the references static library, but does not rebuild deeper than one level. This causes me to have to manually rebuild the leaf project and then rebuild up the chain to the Winforms project. Is there a way to force a deeper rebuild? 回答1: Should I just add all static libs as dependancies to

How to set max byte length of datagridview when paste

蹲街弑〆低调 提交于 2019-12-24 17:57:05
问题 I have a datagridview where DataNames can be entered in a textbox column.I restrict the input length of this column to 6 characters by using the MaxInputLength property of the DataGridViewTextBoxColumn . Here, I want to explain my problem step by step. 1 . I wrote Double Byte Characters(eg.1234567890) on a notepad and copy it.Then I went to this DataGridViewTextBox ,Right Click and then choosed Paste .The DataGridViewTextBox showed 123456. 2 .I wrote Double Byte Characters(eg.123456) on a

AutoComplete Stopping When User Presses “Enter”

筅森魡賤 提交于 2019-12-24 16:35:31
问题 I am using the AutoCompleteExtender on a commercial site. My problem is the users are quickly typing in part of a word and immediately pressing "Enter" which causes the AutoComplete control to NOT come back with a list of suggestions. For example, if my database has the phrase "Texas, United States" in it but the users just type "Texas" quickly followed by Enter then the dropdown list does not appear. What I would like is for the AutoComplete control to ignore the fact the user has pressed

Using XML datasets for a Crystal Report

点点圈 提交于 2019-12-24 12:34:07
问题 We have this XML schema: <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="Log"> <xs:complexType> <xs:sequence minOccurs="0" maxOccurs="unbounded"> <xs:element name="LogEntry" minOccurs="1" maxOccurs="1"> <xs:complexType> <xs:sequence> <xs:element name="Time" type="xs:dateTime" /> <xs:element name="StringRef" type="xs:string" /> <xs:element name="Parameters" minOccurs="0" maxOccurs="1"> <xs:complexType>