winforms

How do I serialize a .NET control to CODE?

I want to create a .NET Form at runtime, add buttons and other controls to that (also at runtime), and then be able to generate a something.designer.cs file from that form (which can then be added to a C# solution and compiled). What I want to do is very similar to what the WinForm designer does. But instead of having a drag/drop inter...

WPF control hosted in Windows Forms: Is it possible to access resource files?

I have a WPF control hosted in Windows Forms and I would like to access it's resources, specifically images. What is the best way to do that? I was thinking of using a ResourceDictionary, but I'm not sure how I can access it from within a Windows Form. ...

c# find same range of "named days" from 1 year ago

using c# visual studio 2008. Can anyone help with an algorithm to do this please if i have a range of days selected for this week (eg monday to friday) i can find the dates for these using the datetime functions available. What i want to do is compared to stored data for the same DAY range 1 year ago. So basicly i need to go back 1 y...

Problem in generating label controls in Windows formsApplication

Hi, I have created pictureboxes dynamically in windows forms Application... its working well... now i have to generate label boxes dynamically and that label boxes will display in bottom of the each picture box and that have to display the corressponding picturebox name... how shall i do this? Give me the solution of this... Thanks In A...

Is possible to set the TextRenderingHint to be used for a whole application?

Hello, I wanto to use antialiased fonts in a C# application. I have read here how can be done with the Paint event of each form: public class SmoothingFonts : System.Windows.Forms.Form { ... private void InitializeComponent() { ... this.Paint += this.SmoothingFonts_Paint; } private void Smoothing...

Does Open Office need to be installed to be used by a deployed application?

I am thinking of using Open Office from my winforms application to produce printouts of data. I would like to reference the API and programmatically manipulate documents from my client PCs. To clarify, I don't want to host a window with Write inside it so users can edit documents from within my application. I just want to programmatica...

Get the standard context menu for System.Windows.Forms.RichTextBox

How can I get the standard context menu in a RichTextBox, like the one in TextBox (Copy, Paste, IME etc.)? I'd go with a P/Invoke solution if nothing is available out of the box. Or do I really have to follow those strange advices to create a custom menu to get a standard menu (sigh)? ...

C# Process Killing

i need to write a program in c# that would just start, kill one process\exe that it is supposed to kill and enditslef. The process i need to kill is another C# application so it is a local user process and i know the path to the exe HOW TO DO IT... F1! F1! ...

Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on

I get the following error Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on. This is a callback from a wcf. I have a textBox and I need to update the value and appendtext to it. This value is coming back from another thread and updates the UI. public CarStatus CarSta...

Synfusion WinForms grid control: What events can I subscribe to for when a cell's content changes

It's been many years since I've used this "API" (yes, in quotes, as it's possibly the most confusing API I've ever come across!) My need is a very simple one. I want to subscribe to an event that tells me that a cell's content has changed and what the new content is. There are a thousand and one events fired that tell you when a cell ...

Weird behviour of creating graphics from a form's handle

EDIT: sorry, my bad, i forgot a line. and those are clean conditions (completely new project) Form frm = new Form(); Graphics graphics = Graphics.FromHwnd(frm.Handle); frm.FormBorderStyle = FormBorderStyle.None; frm.WindowState = FormWindowState.Maximized; frm.TransparencyKey = Color.Magenta; ...

Bread-crumb style navigation for Winforms

Does anybody know of a bread-crumb style navigation for Winforms like the one from DotNetBar. http://www.devcomponents.com/dotnetbar/BreadCrumbHorizontalTreeControl.aspx I really like that control. However I am using a other UI library already and just for this control I do not want a reference to another 4 MB lib. I just need this co...

What encoding does the System.Windows.Forms.RichTextBox use for unicode chars?

I've got a WinForms RichTextBox in my application. When I enter the Chinese text "蜜蜜蜜蜜", the control uses the following RTF: {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fmodern\fprq6\fcharset134 SimSun;}{\f1\fnil\fcharset0 Microsoft Sans Serif;}} \viewkind4\uc1\pard\f0\fs17\'c3\'db\'c3\'db\'c3\'db\'c3\'db\f1\par } The test s...

Tag property for Controls not carrying over to static method

I have the below method in a class, HUD.cs, that has helper methods. The below method is suppossed to check all controls TAG for "required" and highlight those it finds. It works fine if I call it from a UserControl and the Control's to be Highlighted are not contained in a GroupBox but when they are the TAG does not seem to come acr...

Bootstrapping Dependencies (using StructureMap) in winforms

I am trying to keep the IoC registration off to the side just like it is done in CodeCampServer via the DependencyResolution project, so that only one project in my solution holds a reference to StructureMap. I have implementations of interfaces in my Client/UI project which I want registered, meaning that this DependencyResolution Proj...

Databinding, what’s the point if I have to recreate the binding every time I want to show data from a different row

Am I missing the point here, I don't see how this is any better than just assigning the Text property of a Label directly? //class variables Binding stateBinding; MyRowType rowForDataBinding; ChangeBoundData() { rowForDataBinding = GetNewRow(); lblStatus.DataBindings.Remove(temp); temp = lblState.DataBindings.Add("Text", row...

What is the best way for a WinForms application to determine exactly which Windows operating system it is running on?

I have a WinForms application that needs to behave in specific ways (specifically shell to a certain installer) based on the operating system on which it is running. I am using the System.OperatingSystem class, and combining the PlatFormID, Major, Minor and Build numbers which gets you most of the way there. Unfortunately, the properit...

Reducing roundtrips between client and server

Hi, We are developing desktop application in vs2008 with winforms and sql server 2008.At present, we make lot of dbase calls(linq to sql) on form load, so this make the application real slow.One option is to load all the data required at the start of application load, and store it in a cache(just static collections).What other options w...

.NET WinForms - How to listen to events for system LogOff, User Locked, Hibernate Started and System resumed?

I want to listen to events in my windows forms .NET application for the following system wide events : Log Off Lock Windows Hibernate Started Sleep Started System Resumed Are these possible? Thanks ...

TCP stuff never works for me

Hi All I am trying to get a little client/server thing going just to learn how to do it... But after using many samples, following several tutorials even on msdn, none of them have ever worked. I keep getting the following exception: System.Net.Sockets.SocketException: No connection could be made because the target machine actively re...