winforms

Any way to create a hidden main window in C#?

I just want a c# application with a hidden main window that will process and respond to window messages. I can create a form without showing it, and can then call Application.Run() without passing in a form, but how can I hook the created form into the message loop? Is there another way to go about this? Thanks in advance for any tips...

Disabling the exit button on a windows form?

Is there a way to disable the exit button on a windows form without having to import the some external .dll's? I disable the exit button by importing dll's using the following code but I don't like it. Is there a simpler (built-in) way? public Form1() { InitializeComponent(); hMenu = GetSystemMenu(this.Handle, fa...

WinForms C# DataGridView force refresh

Baby steps rolling... I have a form with a data grid bound to a table. I have some textboxes on the form bound to the table[columns], so as I scroll the grid, the textboxes show corresponding data. I go to an "Edit Mode" of the textboxes and change the content and hit a save button. The grid doesn't refresh the changed context until ...

Embedding a hyperlink or button in the appointment label of a SchedulerControl

For quick reference on the principle control I'm working with: What Is An Appointment The client has a very specific, ackward request. Modify the Appointment Label on the DevExpress SchedulerControl so that the user can click or double click on a person's Name and go to their profile instead of the appointment edit form. The subject fi...

AccessViolation exception when form with AxWindowsMediaPlayer closed

I have a AxWMPLib.AxWindowsMediaPlayer on a form. When I close the form, I get "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." exception. It is OK with hiding the form but not with closing. Everything's fine when the component is removed from the form. This is Winforms .Net3.5. A...

How to speed up .NET winforms rendering

I have a series of forms and navigate between them. Each form has a set of controls for which I load properties from SQLite database and this is the long (about 1s) operation that doesn't give users the best feeling because the form is gradually being drawn. I don't quite mind the delay but I'd like the form to be drawn when all data...

Opening a form in C# without focus

I am creating some always-on-top toasts as forms and when I open them I'd like them not to take away focus from other forms as they open. How can I do this? Thanks ...

How can I detect mouse button held down over a winforms control?

I want to implement a custom scrollbar but want it to work like the standard one. So I need to detect that the mouse button is held down over either the up or down arrow at the ends of the bar so that the user can scroll using the bar ends. How can I detect that the button is being held? MouseDown only fires once when the button is f...

ADO.Net databinding bug - BindingSource.EndEdit() changes current position

What is the correct order of processing an insert from a data-bound control using BindingSource, DataSet, and TableAdapter? This is causing me eternal confusion. I have a form that is used to add a new row. Before showing the form, I call: bindingSource.AddNew(); bindingSource.MoveLast(); Upon Save, I call: bindingSource.EndEdit();...

C#: How to access a button outside the form class

Hello, I want to either enable or disable a button from another file,what should I do? This is the form class declaration: public partial class Form1 : Form I tried with Form.btnName.enabled = false/true but there's no btnName member. Thanks in advance! ...

WinForm MessageBox replacement with copy and "more detail" option?

I have seen some apps with a messagebox which allows the user to copy the message and a "more detail" button which when clicked, the messagebox expands to show more information. Is there a similar free component I can download and use in my .NET apps (preferably with source)? I know I probably can develop one but I just want a ready mad...

Retain foreground window when starting drag and drop operation

In my .Net application, the user can drag rows from a grid on a main window into other application windows. Often the main application window is behind the window that the user is dragging into. By default, as soon as the mouse button is depressed on the main window, it gains focus, hiding the window that the user wants to drag onto. I...

Using WPF SplashScreen in .NET 3.5 WinForms

Can I use the built in WPF splash screen functionality in a WinForms project compiled under .NET 3.5 SP1 VS2008? ...

Invalidate does nothing

I have a datagridview on a form with an associated SelectionChanged event. When the selected row contains "attachments" then the backcolor of the btnComments control should turn yellow as follows: int noAttachments = 1; if (noAttachments > 0) btnAttachments.BackColor = Color.Yellow; else btnAttachments.BackColor...

Forcing Frame by Frame rendering in Microsoft's Virtual Earth 3D

I'm writing a plugin for Virtual Earth 3D and I'd like to force rendering frame by frame so that each frame is rendered 100%. Currently when I use it's built in movement methods, movement is more important than rendering, so the frames are blurry to say the least. Does anyone know how I can do this? Thanks. ...

Is there a .NET control out there to emulate the Word 2007 selection toolbar?

I'd like to have a toolbar similar to the hover toolbar in Word 2007 (see picture) show up when I highlight text. Does this control exist (free or otherwise) or am I S.O.L. to hack it together myself? Thanks! If anyone has any tips on how to put this together that would be appreciated as well. I don't need the fade-in/out effects th...

Obtain Position/Button of mouse click on DoubleClick event

Is there a method to obtain the (x, y) coordinates of the mouse cursor in a controls DoubleClick event? As far as I can tell, the position has to be obtained from the global: Windows.Forms.Cursor.Position.X, Windows.Forms.Cursor.Position.Y Also, is there a method to obtain which button produced the double click? ...

.NET Solution Setup Advice when considering updates

I've written a winforms application that is deployed as a setup/msi install. The main reasons for not using ClickOnce deployment are: Need persistent data storage in the directory of the app Need to be able to install for "all users" At the moment, the application uses "one .exe to rule them all". Essentially, the "program files" d...

"Collapse" Panel Control Borders for WinForms

Is there any way in WinForms to emulate border-collapse from CSS? Imagine this: You have a Panel control with a border of FixedSingle, giving it a 1px black border, docked to the top of a form. You add a second Panel control with the same border and also docked to the top, in effect stacking that Panel underneath the first Panel. The pr...

how can i change form shape in vb.net

I used to change the Form shape in VB 6.0 using the following code: Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVa...