winforms

How do I enable scripts when setting document using WebBrowser.DocumentText

I'm using the Windows Forms WebBrowser control, and getting it to display a document that I create on the fly and set using the DocumentText property. The document that I create references a script file in the same directory as my executable. Trouble is, when the WebBrowser control displays the page, the scripts aren't enabled. Now I kn...

Using Visual Studio Image Library PNGs in a Windows Form app

My question is about the Visual Studio Image Library that comes with VS2008. In the _Common Elements\Annotations folder, there are PNGs with multiple sizes and I was wondering what the intended use of these is. Is there an standard way to implement these images, e.g. in a Windows Forms status bar? Here are three of the PNGs as an exam...

OnPaint method is being call for every child control.

I've a UserControl (WinForms, .net 2.0), and I've this: protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); var rect = e.ClipRectangle; var pen = new Pen(Brushes.LightGray, 1); e.Graphics.DrawRectangle(pen, rect); } I basically want to draw a border on the UserControl, but the rectangle is being draw in all the ...

What's the max size I should use for a WinForm dialog ?

I'm designing some dialog boxes, and I'm having a hard time to fit everything. (and it has to fit on a single dialog box by design, so please don't tell me I should make two dialogs instead of one:)) I'm wondering what's the max size a dialog can have before being annoying for the end user. Of course it should't be bigger than his resol...

What method or event should I use prepopulate an extended ListView?

I've written an extended ListView in C# WinForms. It's purpose is to show a list of currently running applications using the WinAPI. However, If I try to populate the ListView in the constructor it works when I run the application, but if you try to put the control on any form it will crash VS 2008. The reason for the crashing is I beli...

How to add Application Settings from a custom component (WinForms)

I have a WinForms user control that, when added to a form, should automatically add some elements to application settings. (Of course, the user should be able to customize/disable this behavior.) is that advisable? What is the "good" way to do this? [edit] The control provides a default implementation for the file menu, the consumer on...

How to dynamically display one of two Winforms tabs?

I have a TabControl with 5 tabs, and the contents of one of the tabs depends on some conditions or modes - Sometimes it needs to show one set of controls, on other times it should show an entirely different set of controls. What is the easiest way to achieve this? I tried setting up two different tabs, and using something like tab.Enabl...

Best way to show screens to user on application

I'm developing a Winforms application which has been running for years with an explorer view (TreeView left, screen right). I means that: All the screens have an hierarchy organization All the nodes on TreeView have one and only one screen related. A screen gets activated when a node on treeview gets selected. One of the advantages i...

Get a Bitmap from a WPF application window?

The Winforms System.Windows.Forms.Control class has an instance method "DrawToBitmap" which I think is very useful in a variety of circumstances. I'm wondering if there's an equivalent way of getting a System.Drawing.Bitmap from a WPF application? I realize I could do some P/Invoke stuff to just get the application window, however I ...

Submit by pressing enter in a windows form

In order to transfer text from one textbox to another, I have created a submit button. However it would be preferable to use the functionality of the 'enter' key. I am not sure but i think the ascii code is 13.Anyway how do I go about this task at hand? ...

Expression Blend 2/WPF Book

I'm looking for an Expression Blend 2 book that includes best-practices (Expression Blend 2/Visual Studio 2008) designer perspective (Expression Blend 2) programmer perspective (interoperability with Visual Studio 2008) How-To-chapters for Windows Forms developers (how to solve the same problem with WPF) Could you make a recommendat...

WinForms Volume Slider/Trackbar User Control

Hi All, I'm looking for a trackbar-like user/custom control to use in my .NET 2.0 WinForms app. Note: I'm NOT asking how to control the volume in a WinForms app. Anyone knows of a nice looking custom painted slider/trackbar control that could be used in my app to let user set the volume? (such as the ones used in multimedia apps) Id...

.NET Winforms: prevent button click trigger for a multiline textbox on a "AcceptButton" enabled form?

Well my problem is this: I set the AcceptButton on a form and this gives me the nice effect that it triggers the buttons Click event, but if I'm on a MultiLine textbox I don't want this to happen. Then I just want it to put a enter in it. Is there any way to do this? ...

Variable height rows in WinForms ListView

Is it possible to have variable-height rows within a WinForms ListView in Details mode? There is no RowHeight or Rows[i].Height property on the control as far as I know. Some blogs suggests implementing OwnerDraw, which I did, but I still can't find anything resembling height property from within the event handlers. Ideally, the row ...

WinForms ListView, Remembering Scrolled Location on Reload

I've got a list view that I'm populating with 8 columns of user data. The user has the option to enable auto refreshing, which causes the ListView to be cleared and repopulated with the latest data from the database. The problem is that when the items are cleared and repopulated, the visible area jumps back to the top of the list. So if...

Load and Query Web Configuration

Is it somehow possible to load a web.config file in a WinForms app and query the resulting configuration, instead of using XML to find some less than semantic 'add' element? ...

WPF or WinForms for internal tools?

At my company we develop a number of tools for internal that range from simple utilities to full-blown editors. The priorities for these tools are stability, usability, and turn-around time (meaning how quickly new features can be added). We've been using WinForms up until now but there's a couple of new tools on the drawing board and I...

Sometimes Connected CRUD application DAL

I am working on a Sometimes Connected CRUD application that will be primarily used by teams(2-4) of Social Workers and Nurses to track patient information in the form of a plan. The application is a revisualization of a ASP.Net app that was created before my time. There are approx 200 tables across 4 databases. The Web App version re...

retrieving an item in a listview

I'm using ListView.GetItemAt(x,y) to retrieve an item from the ListView, but I'm not able to get the item when I set the FullRowSelect option to false. I'm not sure of how to do it in .NET 1.1. Does anyone have any pointers? Here's a code snippet: public int GetListViewSubItem(ListView listView1, Point pt) { const int LVM_FIRST ...

Graphics.FromHwnd(IntPtr.Zero) returns null, why?

I'm currently investigating a problem with a 3rd party component (DevExpress) in my application. My issue is quite similar to this one DevExpress KB article. I get the same exception with more less the same stacktrace. So I used .NET Reflector to find out, what may be null in this scenario, and the only object which is a candiate to be n...