winforms

AutoFit Label Font Size

For a System.Windows.Forms.Label is there a way to auto-fit the label font size depending on the label size? ...

Which GUI control is suitable for this purpose?

Hello, I'm using winforms of .NET & C#. I'm developing a medical software. I need to implement "Patient History". When doctor enters the PatientID. All the previous appointment dates will be displayed in a side panel. These entries will dynamically fetched from the database. Interface will be more or less similar to Histroy in web brows...

Get label height for fixed width

Is there any way I can get the height of a label, if it hypothetically had a certain width? I've been trying with control.GetPreferredSize(size) like so: Dim wantedWidth as Integer = 100 dim ctrlSize as Size = label.GetPreferredSize(new Size(wantedWidth, 0)) because I thought that setting height = 0, would indicate a free height, but ...

VS 2008 designer and usercontrol.

Hello, I have created a custom data grid control. I dragged it on windows form and set its properties like column and all & ran the project. It built successfully and I am able to view the grid control on the form. Now if i try to view that form in designer, I am getting following error.. Object reference not set to an instance of an ...

Is there a way to change the orientation of a DataGridView (WinForm)?

I don't think it is possible but I'm still asking the question... Basicly, I would like to display the DataGridView column horizontally and the row to be displayed vertically. Yes, I know there some third party components that would allow me to do this but I would like to use my custom DataGridViewColumn in my grid. Regards, Simon ...

Why the same code in WPF is slower than in Windows Forms?

I made bunch of benchmarks of the framework 4.0 and older and I can't understand why the same code is slower when using WPF compared to Windows Forms: This is the code, it has nothing to do with the UI elements: Random rnd = new Random(845038); Int64 number = 0; for (int i = 0; i < 500000000; i++) { ...

What is the best free skinning library for Windows Forms?

I would like my Windows Forms .NET application to be a bit nicer, having fancy rounded windows corners, non-standard color set, pretty controls. Though all this is possible to implement with custom ownerdraw, I'd like not to spend much time and take existing free implementation (if any). Please recommend the choice of yours. ...

How do I fix tooltip help in Windows Forms apps under Windows 7/Vista?

I've noticed that Windows Forms applications running under Windows 7 Professional 64-bit display help tooltips incorrectly. Specifically, this is when you use a HelpProvider and SetHelpString on a control. When using the "?" caption bar help button and clicking on a control that has an assigned HelpString, the tooltip looks like it is ...

DataGridView with Custom Object List throws NotImplementedException when Editing

I am building a WinForms application with a few custom business objects. I bind a List of a single type of object to a DataGridView with BindingList and implement IEditableObject on my object, but when I attempt to edit the values in the DataGridView I get the following exception: The following exception occurred in the DataGridView: ...

Set WordWrap= false to a Label

How shoudl I set WordWrap = false to a System.Windows.Forms.Label? I have a header on a panel. Should show "MyPanel capt...". So I use AutoEllipsis = true, but is not sufficient. I use also "AutoSize = true", because want that the label take minimum space possible. A propos, VB6 did it. ...

Windows Forms label custom control origin change.

I have a custom control derived from a label. I need to change the native control's location origin from upper left to lower left. Is there a method or property to do this? ...

Windows Forms Dead. Long life to WPF.

In PDC sessions i see only Framework 4.0, Azure and WPF. My all applications is in windows forms and asp.net (codebehind) and framework 2.0 or 3.5. I see i'am obsolete, ok. But my questions is Windows Forms is dead, i need start migrate to WPF or Silverlight? or my Windows forms with Devexpress can leave more than 3 years? ...

C#, WinForms: Which view type for periodically updated list?

I'm having an application, that periodically polls a web service (about every 10 seconds). In my application logic I'm having a List<Message> holding the messages. All messages have an id, and might be received out of order. Therefore the class implements the Comparable Interface. What WinForm control would fit to be regurarly updated (...

Show form that showDialog from mainForm won't block it, but closing mainForm will close it

how yo show a form which needs to run synchronously. I tried running application.run from a queueworker of a threadpool- but I had some invalid handles sometime. tried using a regular thread but then when main form closes it doesn't close this- and I don't really like the idea of killing the thread on_formclosing. if I use form.show it's...

When should I be cautious using data binding in .NET?

I just started working on a small team of .NET programmers about a month ago and recently got in a discussion with our team lead regarding why we don't use databinding at all in our code. Every time we work with a data grid, we iterate through a data table and populate the grid row by row; the code usually looks something like this: Di...

Using a delegate to populate a listbox

Ive been playing around with delegates trying to learn and I ran into one small problem Im hoping you can help me with. class myClass { OtherClass otherClass = new OtherClass(); // Needs Parameter otherClass.SendSomeText(myString); } class OtherClass { public delegate void TextToBox(string s); TextToBox textToBox; publ...

How to save the ListView contents to a text file?

How to save the ListView contents (including the ColumnHeaders) to a text file? thanks. ...

How do I use the Windows API Code Pack in VB.net 2010 Express?

Hi all, I recently downloaded the Windows API code pack for .net, and seeing there was VB.net examples inside there, I opened them up. Upon building I get a warning that the referenced components 'Core' and 'Shell' could not be found. Looking in the code pack folder I see there are no DLLs at all, but instead a whole load of C# sources. ...

Adding checkbox dynamically

public Form1 f1 = new Form1(); int p = 150; int q = 100; public void add() { //CheckBox c = new CheckBox(); //c.Location = new Point(p, q); //c.Text = f1.sub[0]; //this.Controls.Add(c); CheckBox chkBox = new CheckBox(); chkBox.Location = new Point(p, q); chkBox.Text = "Checked"; chkBox.Checked = false; ...

Versions of Enum

Hi, I've got Enum: public enum ObjectType { Country=0, Region=1, Province=2, City=3, Hotel=4 } I have two applications in two language versions, and this Enum is displaying in some place, so depends of language version I wanna displaying correct version of Enum in german version instead Country Land etc. This App...