winforms

Is this part of MVC in .NET?

I have a .NET MVC winform app. I've created an AppDelegate class that handles application startup and shutdown...for now (it might do more later). Winform apps have a Program.cs file that does some app initialization, starts the message pump and creates the first form. In my app, the first form is AppDelegate, which isn't really a fo...

Using the AutoComplete feature of ComboBox, while limiting values to those in the list?

In WinForms 2.0, a ComboBox has an Auto-Complete feature, that displays a custom Drop-Down list with only the values that start with the entered text. However, if I want to limit valid values to only those that appear in the ComboBox's list of items, I can do that by setting the DropDownStyle to DropDownList, which stops the user from e...

C# Mono+Winforms MessageBox problem

I have a file called hellowf.cs class MyFirstApp { static void Main() { System.Windows.Forms.MessageBox.Show("Hello, Mono+WinForms!"); } } On Ubuntu 8.10, I do the following gmcs hellowf.cs -r:System.Drawing.dll -r:System.Windows.Forms.dll mono hellowf.exe ... and it looks like this: The second part of the message is m...

Does Visual Inheritance work with User controls in VS2008

I have a base User Control. I place Ok and Cancel buttons on the bottom right of the control and anchor them Bottom and Right. I then create another user control that inherits from the base user control. I resize the inherited control (e.g. increase height or width). Throw the inherited control onto the form. Run. The inherited contro...

How to autosize User control when it's shown

Hello, I have a Winforms project with a bunch of User controls. I'd like the user control to move itself to be at the 1,1 position relative to its container (whether it's a form or a Panel control). And resize itself to be able to fit half the container. What event can I respond to in the UserControl to be able to do this without any ...

c# StatusStrip questions

System.Windows.Forms.StatusStrip I have added a StatusStrip to my winforms app, but I am having a few problems. I would like to have a label anchored at the left and a progressBar anchored on the right in the StatusStrip, but I can't find a way to set these properties. I then thought that I may need to create two statusStrips and anch...

Loop through all elements in a ListView in virtual mode

I have a reporting module which creates PDF reports from ListViews. Now, I have a ListView in Virtual mode and therefore I cannot loop over the Items collection. How do I loop over all elements in the list view from the reporting module? I can get the VirtualListSize property, so I know how many elements there are in the list. Could I...

.NET: Locking a ToolBarButton without specializing the class

Hi, I am interested to lock a ToolBarButton in .NET 1.1 so that property .Enabled = True is ignored. I have looked at the members of it and cannot find anything useful. I have found Property Change Notification in my research and it seems to be available only in .NET 3.0. Have you implemented something similar before? Is there any worka...

How do I get the widths of the borders drawn by ControlPaint?

I'm drawing a border with System.Windows.ControlPaint.DrawBorder3D, and want to draw into the rectangle inside the border. How do I get the width of the border, so that I can find the rectangle inside it? UPDATE: With the default theme, the borders are 2px top and left, but only 1px bottom and right, so SystemInformation.Border3DSize i...

Default button hit in windows forms (trying to find the best solution)

The question is: How to make default button be focused on form focus and response on "Enter" hit, but not focused when the caret is in textbox with multiline property set to true for example?..I know that i can do some exceptions in code, but maybe there is some "best practices" i dont know for now :( thank you ...

Databinding in windows forms on an object graph with possible null properties?

If I have an object graph like this: class Company { public Address MainAddress {...} } class Address { public string City { ... } } Company c = new Company(); c.MainAddress = new Address(); c.MainAddress.City = "Stockholm"; and databind to a control using: textBox1.DataBinding.Add( "Text", c, "MainAddress.City" ); Everything is...

Embed image into a textbox

I have a Windows Forms (.Net 2.0) app and I have a request to embed some custom images into some textboxes(like the new version of Tortoise does). ...

best way to show several images on a winform in c#

best way to show several images on a winform in c#? Datagrid? ...

In C#, is there a way to open a 2nd form with a tab selected?

Does anyone know a way to open a 2nd form in a .NET application with a certain tab selected in a tab control on that form? This is what my current code looks like which just opens the form: SettingsForm TheSettingsForm = new SettingsForm(this); TheSettingsForm.Show(); SettingsForm.cs is the name of the 2nd form to be opened. Thanks ...

Can I change the input behaviour of a DateTimePicker control?

The default input behaviour of the DateTimePicker when entering a date is like this: YYYY(Right Arrow)MM(Right Arrow)DD The user want to enter the date like this: YYYYMMDD Is there any simple way of modifying the input behaviour of the DateTimePicker so that is does behave like the user want it to? TIA ...

How do I prevent print screen

I have a requirement that an application I am working on prevent the user from being able to easily capture the contents of the screen. I have communicated that there is no feasible way to completely prevent this from happening, but I'm looking for methods to introduce some hurdles to the process. I'm using C#/.NET 2.0 and WinForms ...

DataGridView: Which Event do I need?

I have the DGV bound to data and all the other controls properly. What I am trying to do now is update a PictureBox based on the contents of the data row. The picture is not a part of the bound data, its always available on the web. I have a function that will build the url string to a webserver with the images I need. The problem is t...

Winform Checklistbox Headers/Columns

Is there a way to implement a new column with a header in a checklistbox in vb.net? I've done a bit of searching, but didn't find much on the topic. Should I just abandon the quest and use a listview or some other control? Thanks for any/all help! JFV ...

WinForms/WebForms controls' default case musings

Why does the WinForms default name for controls start with lowercase, but is uppercase for WebForms? What's the likely rationale for this? ...

Databinding in C# and .NET

I am pretty new to C# and .NET and I'm strugling a little with the whole concept of databinding. What I am asking for is a quick rundown of the concept, or even better, point me towards sources on the net (preferred) or in print that can help me get my head around the idea. EDIT: I do my development in vs2008 and we are using winforms ...