winforms

How do I get a control which looks like a TabControl with no tabs?

We have a form which displays media items in tab pages of a tab control, and I'm implementing a feature which allows users to 'pop out' the tab pages into their own forms. However, when I add the media player to a form rather than a TabPage, the background switches from the gradient fill of a tab page to the plain SystemColors.Control b...

.Net winform property says Visible but I can't see it

I have a weird situation where I open a form from my application, hide it, and when I try to show it a second time, the Visible property says true, TopMost true also, location is correct, yet I can't see it. Any ideas where and what to look at to work out what the problem is? (Note: there may be issues with event handlers/delegate, bu...

How do I draw a 3D border using visual styles?

I can draw a 3D border using ControlPaint.DrawBorder3D, but I get the 'Windows Classic' 3D border. I want to draw the current theme's 3D border - in the default XP theme, this is a 1px blue or gray border. How do I draw that, and how do I get its widths? ...

c# threads and properties

Hi! I want to read two properties from a worker thread. Here it is an example of the class: public partial class FrmPrincipal : Form { private int Height; private int Width; private string token; public FrmPrincipal() { InitializeComponent(); ... } private void menuItem1_Click(object sender...

TreeView re-grabs focus on Ctrl+Click

I have a WinForms TreeView control that I would like to use to open another form based on which node is currently selected. I want to open that other form when I Ctrl+Click on the node. Currently, it works the way I would like if I open the other form in a DoubleClick handler (and double-click on the node, obviously); however, if I use...

Form's lost focus in C#

This may be a simple C# question but I need a solution thou' I have two forms, form1 and form2, with form1 having a button. On the click of the button, I wanna show form2. But when this form2 looses foucs I wanna hide it (form2). How do I do it ?? I tried to subscribe to LostFocus event of form2, but it isn't working. Please help me w...

c# threads and properties second part

I have this code: public partial class FrmPrincipal : Form { private Image imagen; public FrmPrincipal() { InitializeComponent(); ... } private void menuItem1_Click(object sender, EventArgs e) { Thread t = new Thread(RequestImage); t.Start(); } private void RequestImage(...

System.Windows.Forms.DataVisualization Namespace Fine in One Class but Not in Another

Hi. I'm getting this error The type or namespace name 'DataVisualization' does not exist in the namespace 'System.Windows.Forms' (are you missing an assembly reference?) Here is my using section of the class: using System; using System.Collections; using System.Collections.Generic; using System.Windows.Forms.DataVisualization.Charting...

Update Label while processing in Windows Forms

What is the best way to update a label on a windows forms application while processing. I have a loop that does some processing to files on the users system when the user clicks a button. foreach (System.IO.FileInfo f in dir.GetFiles("*.txt")) { // Do processing // Show progress bar // Update Label on Form, "f.Name is done pro...

Move a PictureBox with mouse

Hi! I'm developing an app for windows mobile (Compact Framework 2.0). It has a wimforms with a pictureBox. I want to move the image of the pictureBox but I don't know how to do it so I choose to move the hole pictureBox. To do it I use this event: private void imagenMapa_MouseMove(object sender, MouseEventArgs e) { imagenMapa...

How to select all text in Winforms NumericUpDown upon tab in?

When the user tabs into my NumericUpDown I would like all text to be selected. Is this possible? ...

What should I do with INotifyPropertyChanged when a child list changes

I have a set of data objects that I am using for databinding that implement the INotifyPropertyChanged interface and I'm trying to figure out what to do with properties of complex type. If I have something like class C { private string text; public string Text { get { return text; } set { if(Text != value) { text = value;...

Imitating outlook scheduler using winform

what is the best way to mimic the scheduler screen of the outlook 2003. Currently I'm using DataGridView with customized DataGridViewCell and DataGridViewColumn as sugeested in msdn. I think DataGridView is heavy. Is there a better approach which is light weight and less CPU consuming to solve this problem? ...

How do you playback MP4 video in a Windows Forms App

I'm wondering what the best way is to play back an MP4 video in a Windows Forms application (.NET 2.0) on Vista and XP. ...

How do I detect control entering/leaving on a per-application basis, without access to the control's form?

I can use the Control.Enter and Control.Leave events to detect when user focus enters or leaves a control, but this only works on a per-form basis. I use more than one form in my application, and want to track which control has user focus, I have to use the forms' Activated and Deactivated events to track which form is active and then t...

c# CF, WinForms and double buffer

Hi! I have a CF 2.0 app with a PictureBox on a Form. I want to move the PictureBox with mouse move and I need to add Double Buffer to the form to avoid flickering. How can I do this? Thanks! ...

When upgrading an Assembly, what's the best way to migrate files in Isolated Storage?

I have a .Net 2.0 C# application that occasionally gets updated and the Assembly Version and File Version are incremented. This is all working fine, but it also breaks storing xml settings files in Isolated Storage. (The xml files are generated by DevExpress XtraGridView.SaveLayoutToXml()) Is there a way to copy these files from the old...

Where do you put SQL Statements in your c# projects?

I will likely be responsible for porting a vb6 application to c#. This application is a windows app that interacts with an access db. The data access is encapsulated in basic business objects. One class for one table basically. The existing vb6 business objects read and write to the DB via DAO. I have written DALs and ORMs a few times be...

Customising the browse for folder dialog to show the path

Does anyone know what is the simplest way to customise the System.Windows.Forms.FolderBrowserDialog so a path can be entered using text in a textbox below the tree. I want this so it's easy to select unmapped UNC paths. This trick here kind of scares me. Looks like this KB kind of helps. ...

c# Drawing a Line with a gradient colour?

Is it possible to draw a line using a graduated colour? I want to be able to draw a stright or a curved line (if possible) where one end of the line is Blue and the other Red. Further There might be a beed to have more than one gradient per-line e.g the colour going from blue -> green -> red. Im thinking that this might just consist ...