c#-4.0

How to Fix the X Axis values length in Microsoft chart controls

Deadly 提交于 2020-01-25 08:25:06
问题 In My sample, I make the X axis to rotate to -90. Now the label values are vertical. Some of the values are huge like "Sample Quotes". Due to this huge values, My label area is increased and chart area is decreased. Is it possible to fix the X axis label length in Microsoft chart controls? 回答1: I got the answer for this question. This is possible by MSChart.ChartAreas[0].AxisX.LabelAutoFitStyle = LabelAutoFitStyles.WordWrap; MSChart.ChartAreas[0].AxisX.IsLabelAutoFit = true; Regards, Karthik

Access C# anonymous type object returned from a method [closed]

大憨熊 提交于 2020-01-25 03:50:54
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 5 years ago . Someone wrote a method that returns an object type. public object GetProvider(double personId) { // Some other code here return new { FirstName = Convert.ToString(reader["FirstName"]), LastName = Convert.ToString(reader["LastName"]) }; } In different part of code, we use this

What are the other possible names of project files in C# other than .cproj?

喜欢而已 提交于 2020-01-25 03:49:07
问题 .cproj is not the only name of the project file. My solution says there are 5 projects but only three .cproj files are seen. What is the file extinsion of other project files/? THe icon that represents the other two look different as well: 回答1: It looks like an ASP.NET web app, but I'm not seeing the code symbol in the lower right corner (normally you'd have a C# or VB symbol) 来源: https://stackoverflow.com/questions/2968102/what-are-the-other-possible-names-of-project-files-in-c-sharp-other

How to use Thread to release the application from freezing in c#

淺唱寂寞╮ 提交于 2020-01-24 22:12:12
问题 I have the code below for scanning but When i press the button to start scanning, the windows form freezes and i can not move the form or minimizie/colse it until the process will be finished! i'm new in working with Thread but i tried to add Thread andi couldn't solve the problem. Does anyone know to where (how) can i write a Thread to release my form from freezing? Thanks. public Bitmap GetBitmapFromRawData(int w, int h, byte[] data) { //Do sth } //button to start the scan proccess private

How to use Thread to release the application from freezing in c#

社会主义新天地 提交于 2020-01-24 22:11:48
问题 I have the code below for scanning but When i press the button to start scanning, the windows form freezes and i can not move the form or minimizie/colse it until the process will be finished! i'm new in working with Thread but i tried to add Thread andi couldn't solve the problem. Does anyone know to where (how) can i write a Thread to release my form from freezing? Thanks. public Bitmap GetBitmapFromRawData(int w, int h, byte[] data) { //Do sth } //button to start the scan proccess private

Is it possible to create variable in parent class, that would initialized once per derrived type?

心已入冬 提交于 2020-01-24 19:53:10
问题 I'm using IDataErrorInfo interface to validate my entities. As long as validation logic is reading metadata from attributes, it is the same for all entities, so I've created class public class DataErrorInfo : IDataErrorInfo And all entities are derriving from it. Thing is, that I wish to cache reflection info for derived classes to speed up validation, so every entity type should initialize this cache once per running application. I was thinking to use static readonly field, but found out,

Why don't trace listeners log custom handler traffic?

£可爱£侵袭症+ 提交于 2020-01-24 05:43:31
问题 I have a custom handler like this, public class Handler : IHttpHandler { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Write("Hello World"); } public bool IsReusable { get { return false; } } } Why does this not work? <system.diagnostics> <sources> <source name="System.Web" switchValue="All" propagateActivity="true"> <listeners> <add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="c:\logs

How do I create another instance of a .NET program within one instance by code?

岁酱吖の 提交于 2020-01-24 05:22:07
问题 I need to be able to create another brand new instance of a program on a button click while keeping the existing instance. this.ShowDialog(new Form1()); The above statement causes the current form to be the owner of the new form and I need the second instance to be independent of the existing instance. Can anyone help me with this? 回答1: To expound on Desolator's answer here is a simplistic example you can try a Form and a Button: public partial class Form1 : Form { public Form1() {

ModalPopupExtender from Server Side Code in c#

末鹿安然 提交于 2020-01-24 03:22:25
问题 I had a nightmare getting this going. Adding the ModalPopupExtender to a form is easy, you drop it on and tell it the two required controls parameters PopupControlID="MyModalPanel" TargetControlID="ButtonToLoadIt" And it just works fine, but is triggered by a client side click of the Target Control. If you want to do some server side code behind??? how to do it ? 回答1: The example code is shown below: HTML CODE: <!-- Hidden Field --> <asp:HiddenField ID="hidForModel" runat="server" /> <asp

ModalPopupExtender from Server Side Code in c#

£可爱£侵袭症+ 提交于 2020-01-24 03:22:05
问题 I had a nightmare getting this going. Adding the ModalPopupExtender to a form is easy, you drop it on and tell it the two required controls parameters PopupControlID="MyModalPanel" TargetControlID="ButtonToLoadIt" And it just works fine, but is triggered by a client side click of the Target Control. If you want to do some server side code behind??? how to do it ? 回答1: The example code is shown below: HTML CODE: <!-- Hidden Field --> <asp:HiddenField ID="hidForModel" runat="server" /> <asp