winforms

How to get the form active control?

Is there a way to get the form active control? I was checking in the help for the "Support.GetActiveControl" method but it isn't supported :) for the Compact Framework. I suppose that I can track the focus by adding a custom GotFocus event handler to all the form controls, but I'm looking for a more generic way that can be implemented ...

Spinning a 3D model in C#

How do I take a 3D model that I created in 3D Studio Max and put it into my Winform C# program and make it spin? I'd prefer not to use DirectX if possible. I don't want anything complex. I simply want my model to rotate along the X axis. Thats it. Thanks ...

Possible way to attach database to exe

I created a small application using C# winforms that uses SQL Server as a database. Is there a way to attach the database to the exe file so I won't need to install SQL Server on all the machines that I want to run the program on? ...

Opening A WinForm Programmatically In Another WinForm's Code

Happy Friday SO! I'm building a multi-WinForm application and am having some troubles. I have a main WinForm that stays open at all times. It hits a database every minute looking for changes, and if there is a change, it will open the second WinForm (this may seem like a stupid way to do things, but for my purpose, this is the best m...

Dynamically changing Mouse speed

Guys, I have a C# Winforms application with a panel inside the form. What I want to do is, whenever the mouse pointer enters this panel, I want to slow the movement speed of the mouse by 50%. Once the pointer moves outside this panel, I want to speed of the mouse to resume normal 100% speed. How can I accomplish this in C#? ...

Direct video card access

Guys, I am trying to write a class in C# that can be used as a direct replacement for the C# Bitmap class. What I want to do instead though is perform all graphic functions done on the bitmap using the power of the video card. From what I understand, functions such as DrawLine or DrawArc or DrawText are primitive functions that use simpl...

Problematic comboBox Windows Forms

Hi, I use VS2008 C# + Windows Forms. I can't understand why comboBox does not behave the way it should. In Design mode, I added a comboBox to my form, and edit Items to add "A" and "B". Double-clicking brings me to SelectedIndexChanged event, which I edit to display the selected text with MessageBox. private void comboBoxImageSet_Sele...

How to close a different WinForm from another's WinForm's code?

The title says it all: How can I close a different WinForm (B) from a different WinForm's (A) code? I already have it set up so WinForm (B) gets opened in WinForm (A)'s code: Form2 form2 = new Form2(); form2.ShowDialog(); ...

Adding an ActiveX control to a tab Page

this is the code I am using: tabPage1.Controls.Add(AXViewer1); where AXViewer1 is a third party ActiveX contorl (non .NET) that I want to add it to the my tab page. Is it wrong to it the way I did ? since it has not added it to the tab page with that code. ...

Null Ref when adding TabPages at runtimes

This is a sample code I wrote to add some tab pages with the controls in them at run time. but when I run it , I get a Null Ref exception error. what part I am doing wrong? TabPage[] tabPages = new TabPage[2]; CheckBox ck = new CheckBox(); tabPages[0].BackColor = Color.Firebrick; tabPages[0].Controls.Add(ck); tabPages[1].BackColor = Col...

How To Make Moving News Bar in Windows Forms Application without Timer

I'm making a desktop application in C# which contains a moving News Bar labels. I'm using a timer to move these labels but the problem is that when i make the interval of this timer low (1-10 for example) the application takes very high percentage of CPU Usage, And when i make it higher(200 -500 ) the movement of the labels becomes inter...

multiple FileSystemWatchers to monitor files on local system?

We're writing a text editor like tool for our internal accounting package system that has actions that can be done by our own Xml language specs. These macro commands are specified in Xml files and we need the ability to monitor if files openned have bean modified externally. The only problem is that there maybe 20-30 files with differe...

Update Statement Updates 0 Rows via the C# Winform Application?

First of all, please help me out! I can not take this anymore. I could not find where the error is located. Here is my problem: I'm trying to update a row via c# winform application. The update query generated from the application is formatted correctly. I tested it in the sql server environment, it worked well. When i run it from the a...

EntityFramework performance problem

I'm using EntityFrameowrk 4 and WinForms. I have a DataGridView which shows 5 to 12 thousands of records. The records are from different levels of hierarchy. There are records of classes A, B, C, D, where A contains a collection of B, B contains a collection of C, etc. The most numerous class is D. In the DataGridView this hierarchy is f...

Custom Controls Properties - C# , Forms

Hi I m adding custom control to my flowlayoutpanel , its a sort of forex data , refresh every second , so on each timer tick , i m adding a control , changing controls button text , then adding it to flowlayout panel , i m doing it at each 100ms timer tick , it taking too much CPU , here is my custom Control . public partial class...

Combobox in bound DataGridView

Hi. I've got a DataGridView control which is bound to a database table. I want one of the columns in the gridview to be of combobox type. The combobox should contain a list of hardcoded strings, which is the same for all rows in the datagridview. One of the fields in my database table is an index for this list of hardcoded strings. ...

Retrieve Calendar information in C#

I have a WinForms app that I am working on. How can I retrieve the date (and ideally time) from the user using the MonthCalendar control? ...

Get the currently focused textbox in C#

I have two textboxes, and a button. When I press the button, I want to know where my current caret is (either of the two boxes). I need this to know where to insert a certain text. I tried textbox1.Focused; textbox1.enabled but neither worked. How should I implement this? Thanks ...

Load thumbnail image into PictureBox from directory

Hi, I use the following code to get thumbnail of image in Resources, and display on Picturebox. Image tmp = (System.Drawing.Image)myManager.GetObject(tempImage); cfgPassPicture[m].Image = tmp.GetThumbnailImage(40, 40, new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback), System.IntPtr.Zero); How do I do t...

winform friendly class name

I have a c# winform application that when used spy++, gives "WindowsForms10.Window.8.app.0.33c0d9d" as class name. Is there a way to change that to something more friendly? ...