winforms

Strange Visual Studio Behaviour when setting Application Resource Dictionary

I'm trying to set the current WPF Application ResourceDictionary programatically. (I have a WindForms project, so no "App.xaml" to do that for me). Note: If anyone knows how to bind the equivalent of an Application.Resources to a ElementHost and all of its child controls hierarchy, this is the ultimate objective here. I added to my cod...

Creating a windowless, zoomable text region that proxies to a real Winforms textbox in C#

Important: we really need the stated functionality, so please don't start suggesting alternatives. We're trying to display and input text on a custom WinForms control that includes text and non-text regions - in other words, a modern canvas. We need to be able to display the text and caret on the custom control at various zoom levels a...

How to create a non-selectable TreeView node?

Hi all, I will have a treeview with a root node initially and i will have context menu to be opened when i right click on the root node. AFter that i will save a file to save my data in to that. Alng with that i will load a child node for that . So that tree will looks as follows Root |-> some.txt |-> A(child ...

Windows forms designer broken in VS2010?

We've recently upgraded from VS2008 to VS2010. The conversion of our vb.net Windows Forms app went well, but we're now having big problems with the forms designer. Pretty much any change to the layout of a form (sometimes just a solution rebuild) will work once, but on recompile, the IDE designer refuses to display the form, the error ...

Using a method to manipulate a control in WinForms

I use the same code to fill a control in my WinForms over and over again, so I figured: Hey, you should make it a method instead of copy-pasting it! So, I created this in my Main class Main internal static void FillWithStuff(RichTextBox box) { Data data = GetSomeData("doesn't matter"); foreach (Row row in data) { box.Text += row....

Dynamic drag/droppable 3 deep nested control

Hi all. I have (what I think is) a unique problem to solve, but a solvable one, written in C# .Net3.5 in VS2008. I want to have a group of classed inheriting from parent class 1. a Collection of controls, controls to be stipulated by child classes and assumed different for each, 2. Another control of some sort this controls are to be...

User can press and hold only one keyboard button at a time

Hi there, I have a standard WinForms-application. I want to implement such functionality: user can press and hold only one keyboard button at a time. If he tried to press a button, while another button pressed, then it gets no result. PS: this behavior spreads only to a form that I want, not to all forms of my application. C#, 2.0 - ...

Basic Threading Question

This question has probably been asked in various ways before, but here is what I want to do. I am going to have a Windows form with many tabs. Each tab will contain a grid object. For each tab/grid that is created by the user, I would like a spawn off a dedicated thread to populate the contents of that grid with constantly arriving infor...

Win form application freeze on HttpWebRequest file post

I have an application that will upload files from my client to a web server using HttpWebRequest (with the function suggested here: http://stackoverflow.com/questions/566462/upload-files-with-httpwebrequest-multipart-form-data) My problem is that when the file (about 10 mb in size) is being posted the whole application freezes (e.g. "ap...

Open Source WinForm Controls

Is anyone aware of open source WinForm controls similar to what Infragistics or Telerik might offer? I'm looking for the standard controls like edit controls, grid etc. But I also want a tab like control and a slideout control would be nice too. Thanks ...

About Load event of Windows Forms UserControl

Is there a guarantee that the Load event if an UserControl always occurs after the InitializeComponent() method and the constructor have been completed? ...

Control Form from other Classes and other main Problems

I'm not that good in OOP or even C# but I want to try to keep my code as clean as possible. Lets say we've got something like that within the Namespace "GoogleCalendarNotificator": public partial class MainForm : Form { private object calendarData; public MainForm() { InitializeComponent(); ...

Manipulating a Form from a BackgroundWorker

I have a MainWindow (form1) and a class called Module In Module there is a method to create a new Backgroundworker and change a label in MainWindow. I have tried creating a public or internal method in the MainWindow code and calling it in the Module class but it doesn't seem to work. Can anyone help me figure this out, it's just somet...

c# - how does child and parent comuncate

let's say i have a form and his child and i want the child to trigger his father without them knowing each other in other words i want the child to be generic for example let's say i have a form button and a richTextBox and i want with evey click to change the richTextBox text i want form and button to not know each other how can i...

How to determine if KeyCode is printable character

I am handling the key down event on one of my controls. If the key pressed is an actual input (alphabetic, numeric, or symbol of some kind) I want to append it to a string I have. If it is a control character (enter, escape, etc..) I don't want to do anything. Is there a quick and easy way to determine if the key code is a printable ch...

C# Winforms - Change a Listview item's label

Hello Again, I have looked through the listview controls and wasnt able to find how the label for each item is defined. When I load an image into the listview, I see the full path of the image under the image. What Im looking to do is replace the text with something more descriptive of the image itself, and not the path where it is loca...

In winforms, how do I dynamically change the url of my web reference?

I have 2 web sites with the identical web service. For web service "SampleService", I would like to know how to choose which web server to choose from. Web service: "SampleService" Web reference "SampleWebReference" Web service url: site 1: http://www.samplesite.com Site 2: http://www2.samplesite.com Need: Through code, how do I chan...

Listen keyboard shortcuts c#

how can i run a method when someone user a keyboard shortcuts like CTRL + G ? the application is a Windows forms application and i only want to capture them when the form is activated. ...

Deleting Entities on Entity Framework 4

I'm using Entity Framework 4. I'm detaching the object graph using Serialization. Getting the List, bind to a BindingSource, to the GridControl and deleting adding modify rows. Then go back and Attach the object graph back. How to ensure which rows are for deletion, which are modified, added rows is easy for EF to understand. I'm also th...

Show a winform over the notification area

I want to show a winform in the very right down corner just above the system tray, How do I do that? Here is my code: public static void Notify() { Rectangle workingArea = Screen.PrimaryScreen.WorkingArea; Form fm = new Form(); fm.ClientSize = new Size(200, 200); int left = workingArea.Width - fm.Width; ...