.net-2.0

Rendering form to bitmap

廉价感情. 提交于 2020-01-28 02:46:51
问题 I would like to render Form to bitmap... Is it possible in .net 2.0? 回答1: Sure, you can call Control.DrawToBitmap() to render a control to a bitmap. For more general drawing, you can create a Bitmap and then use Graphics.FromImage() to create a Graphics instance. You can then draw to this graphics instance as normal. Here's a simple form that can draw itself (just add a button and double click it to add the Click event handler: public partial class Form1 : Form { public Form1() {

Page won't change language

依然范特西╮ 提交于 2020-01-25 07:36:28
问题 My page won't change the language could someone have a look at my code and tell me what im doing wrong it always goes to the default language public partial class ChangeLanguage : BasePage { protected void Page_Load(object sender, EventArgs e) { SortedDictionary<string, string> objDic = new SortedDictionary<string, string>(); foreach (CultureInfo ObjectCultureInfo in CultureInfo.GetCultures(CultureTypes.SpecificCultures)) { RegionInfo objRegionInfo = new RegionInfo(ObjectCultureInfo.Name); if

How do I call a function in a threadsafe manner

纵然是瞬间 提交于 2020-01-24 19:39:08
问题 I have been playing around with methods of calling of calling a method safely in threadsafe manner in .net 2.0. My treeview is populated from a call to a database on a separate thread; Below is my attempt to use my InvokeFunction method ( shown below) ...it works, but I was hoping that there was a nicer way to write this...any thoughts on this? InvokeFunction(delegate() { TreeView1.Nodes.Clear(); }); delegate void FunctionDelegate(); private delegate void ThreadSafeProcess(FunctionDelegate

How do I prevent a popup form from taking focus from the parent

╄→尐↘猪︶ㄣ 提交于 2020-01-24 13:11:42
问题 I have a small windows.form that I use to present information when the mouse is over a regions on a windows.Form, however it takes the focus from the parent window when it is set to visible. Is there w way of preventing this - it causes the main form to flicker as it toggles between in focus and out. c#, .net 2.0, system.windows.forms 回答1: Paste this into your popup form class, it prevents it from being activated when shown: protected override bool ShowWithoutActivation { get { return true; }

Force Windows to show a system tray icon

房东的猫 提交于 2020-01-24 03:49:08
问题 This is a pretty stupid question, but here goes: Is there a way (in .net) to force Windows to show your system tray icon instead of hiding it? I don't want to do this all the time, but at least for the first time my application is run I would like it to be visible in the system tray. 回答1: Are you taking about Windows 7? If so, then no. 回答2: As Raymond Chen would say, "Imagine if this were possible." Now tell me how many apps would choose not to force their tray icon to be always visible!

Security Exception When Deploying Asp.net web application in Shared Hosting and Things to Consider

元气小坏坏 提交于 2020-01-23 17:27:27
问题 I'm looking to deploy a ASP.net web application in Shared Hosting. I'm getting Security Exception, System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. Any help to fix and any other common issues that can be taken care when planing to deploy in Shared Hosting will be greatly appreciated. 回答1: Many hosting providers will provide a control panel

Converting Unicode string to unicode chars in c# for indian languages

送分小仙女□ 提交于 2020-01-23 05:27:33
问题 I need to convert unicode string to unicode characters. for eg:Language Tamil "கமலி"=>'க','ம','லி' i'm able to strip unicode bytes but producing unicode characters is became problem. byte[] stringBytes = Encoding.Unicode.GetBytes("கமலி"); char[] stringChars = Encoding.Unicode.GetChars(stringBytes); foreach (var crt in stringChars) { Trace.WriteLine(crt); } it gives result as : 'க'=>0x0b95 'ம'=>0x0bae 'ல'=>0x0bb2 'ி'=>0x0bbf so here the problem is how to strip character 'லி' as it as 'லி'

Output to command-line if started from command line

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-22 12:43:53
问题 I'm writing an application that can be started either as a standard WinForms app or in unattended mode from the command-line. The application was built using the VS 2k5 standard WinForms template. When the application is executed from the command-line, I want it to output information that can be captured by the script executing the application. When I do this directly from Console.WriteLine(), the output does not appear, although it can be captured by piping to a file. On the other hand, I

Output to command-line if started from command line

你。 提交于 2020-01-22 12:42:45
问题 I'm writing an application that can be started either as a standard WinForms app or in unattended mode from the command-line. The application was built using the VS 2k5 standard WinForms template. When the application is executed from the command-line, I want it to output information that can be captured by the script executing the application. When I do this directly from Console.WriteLine(), the output does not appear, although it can be captured by piping to a file. On the other hand, I

Run C# windows application in windows XP without installing .NET Framework [duplicate]

限于喜欢 提交于 2020-01-16 06:32:28
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Running .net based application without .NET Framework Hello. Please let me know how I can run C# windows application in Windows XP without installing .NET Framework? 回答1: C# apllication not handled by operating System. Its CLR(inside framework) who take care to run the C# apps and all memory management, resource allocation, de-allocation etc. It create a virtual layer over OS while runnign its application. So