winforms

How do I sense the end of a user scroll of a .Net TrackBar?

I have a TrackBar and already have the Scroll event treated, but it may trigger 10 times during a user scroll, and I would like to update a file when the user finishes scrolling. How do I sense the "end of scrolling" ? Would MouseUp and KeyUp do for this purpose ? Thx. ...

Drag'n'drop data between instances

I'm attempting to allow my users to drag and drop certain rows of data from one custom list control to another, where the second list control is in another instance of the same application. DoDragDrop(parameterTypedListView.SelectedObjects, DragDropEffects.Copy); where parameterTypedListView.SelectedObjects is a generic IList where T ...

Overriding the location of Controls even when they are directly accessed by myControl.Controls(index)?

Hi, I want to make a UserControl which holds and moves other controls within itself. I worry that the Controls collection can be used to destroy all the internal logic of the UserControl. Remembering that the .Net Framework TableLayoutPanel locates its own Controls, I created a 30x30 TableLayoutPanelm each cell containing a square Label...

Using System.Windows.Forms in a Visual Studio Macro

I have started writing a Macro in Visual Studio 2005 like this: Public Sub myMacro() Dim myListBox As New System.Windows.Forms.ListBox() For Each x As String In xs myListBox.Items.Add(x) Next But I'm completely at a loss as to how to display the ListBox, I'd like behaviour similar to this InputBox example: Dim s...

Windows.Forms and gtk# interoperability?

Can I combine code that uses System.Drawing.Bitmap together with other code in a program that uses GTK#? I would like to be able to display the Bitmap image processed in a GTK# window/widget. More generally, is there any interoperability between the two toolkits? For example is there any classes, like Rectangle, that would work on both,...

TreeView bug in windowsforms when using OwnerDrawAll

When clicking on a node in a TeeView using OwnerDrawAll it does not get selected until it receives a mouse up which is a different behavior from the standard mode and obviously not correct. Does anyone have a solution to this? Run the code below to see this behaviour: public partial class Form1 : Form { private System.Windows.Forms...

What are the benefits of using WPF over WinForms?

Hello, I have previously written user interfaces using .NET using WinForms. I'm about to start development on a new piece of software. This software is just a simple utility which will make use of Rich Text fields, a few buttons, dialog boxes etc. It seems WinForms is ideally suitable for this. I don't need anything flashy. However W...

How do I draw onto Control borders?

Hi, I have a bunch of controls laid out and I want to be able to drag an image over and around the controls. My problem is that the image is broken up by the borders of the controls. My question is: How do I register that the control has a border, and how do I find out how much the control's ClientRectangle is affected by this. Also, ...

How to open a different project from current project using threads or processes in C#.?

Hi, I have developed a window application in VS2005 using C#. I need to integrate another project with my project EDIT: i.e pass a variable from 1st project to 2nd project and load the form of the 2nd project. So i called that other project's main using, namespace.className.Main(args); But if i do so, when the 2nd project is open ...

How to setup caption for DataGridView

I'm using DataGridView in a WinForm app to show a table of data. Everything works fine except for the Caption Property of the DataColumn. I tried to set the Caption property but seems that DataGridView is using the Name of the DataColumn as the caption instead of the value of the Caption property ? Have google for this and seems that th...

How do I automatically scroll to the bottom of a multiline text box?

I have a textbox with the .Multiline property set to true. At regular intervals, I am adding new lines of text to it. I would like the textbox to automatically scroll to the bottom-most entry (the newest one) whenever a new line is added. How do I accomplish this? ...

Combo box drop-down closes unexpectedly when on tab control

I have a modal form with a single instance of the built-in .NET 2.0 tab control. The tab control has several pages, and on one of them is a combo box that isn't populated until the user activates it for the first time. When that happens, I handle the DropDown event and run a process that takes several seconds, then I add the items return...

What is the fastest way to paint an image in Windows.Forms?

I've used a number of techniques in the past to paint images in Windows.Forms and I'm now revisiting some core libraries that handle rendering skin images for our product. I'm interested in particular in rendering the same image multiple times (tiled) to represent the field of a background control. Assuming the image is exactly the right...

How to program a delay of video presentation across shared monitors?

I am looking for a decent programmatic approach to delivering the illusion of "riding in a van". Here is the synopsis: I have a friend who is opening up a bar in San Francisco with a room interior designed to be like the inside of a van (picture the inside of the Scooby Doo Mystery Machine) . Set into the walls are “windows” and behind ...

Returning the property of a child control in a getter is infinitely recursive?

So...this one has me stumped. I am using VS 2008 (C#). I have some code that is infinitely recursive, but for the life of me I can't reason why (well, I have a guess). You can reproduce the problem by doing this: Create a new Form or UserControl class. Add a child control (button, label, whatever) to it. Open the code file. Overr...

Designing Options/Settings Forms in .NET

I've got an application with about 35~ different settings in different categories. What are the best practices to expose this to the client. Secondly is there any VS.NET add-on or library (commercial or not) which can help to speed up this process. Something like "Property Grid" maybe but with a more professional and user friendly loo...

Is there a way to 'lock' the last item in a ListView to always show?

I am listing folders and folder sizes in a ListView for a VB.NET WinForm program I'm writing. I would like to total the folder sizes in the last entry of the ListView and 'lock' it show it always shows (even if scrolling through the list. Is there a way to do this? I'd really like to avoid adding another control on the Windows Form ...

What's wrong with my ListView Callback retreiving subitems?

I'm trying to retrieve the SubItem in my ListView from another thread, but I keep getting the Item instead of the SubItem. I'm not sure how to code this properly. Below is the code I'm using: Delegate Function lvExtractedCallback(ByVal x As Integer) As String Private Function lvExtracted(ByVal x As Integer) As String Static Dim l...

Icons/graphics for your applications

I need to source some graphics/icons for my application I'm writing (Windows WinForms). I need graphics for toolbar buttons, icons for form headers and graphics for wizard dialog boxes. As a last resort I'm willing to create them myself - a move that might make them (and my whole application) look amazingly bad. What are some good sou...

Is there an ORM that can dynamically generate a DAL from within a .Net WinForms app?

I'd greatly appreciate your advice on a strange specification. We have a requirement to create an application where users can drag/drop field types onto a form so that they can create their own "app". I have the front-end setup, but the back-end is a big problem. There are forward mapping ORMs and reverse mapping ORMs, yet I've not ...