windows-forms-designer

WinForms Button Array

久未见 提交于 2019-12-13 06:18:10
问题 I'm learning C# and I've got the exercise to create a calculator with Windows Forms. Right now I just added 9 buttons for the numbers and 4 buttons for the casual operations (+,-,*,/) and a label to write in the numbers as strings. Currently I'm doing this: private void button1_Click(object sender, EventArgs e) { WriteInLabel(1); } private void button2_Click(object sender, EventArgs e) { WriteInLabel(2); } //etc. //function to write the Text in label1 private void WriteInLabel(int i) { label1

Removing Visual Studio 2010 Event Handlers

耗尽温柔 提交于 2019-12-13 02:39:53
问题 I am working on a project that I had left all the controls with default names until recently. Multiple times at the start of the project, I accidentally double-clicked something and it created an event handler for that control. At the time I didn't know how to remove them, because Ctrl+Z would undo far more than I wanted. I now know that I can view and refactor the events that are being used by a control in the Events section of the Properties windows. I have mostly fixed these problems but I

IExtenderProvider add just some properties depending on object type

久未见 提交于 2019-12-13 02:09:30
问题 I'm having an issue and I don't know if this is indeed doable (if there's a "hacky" way, I'm all up for it, but I haven't found one). I have an IExtenderProvider component that I'm using to have my own UITypeEditor for some properties on third-party controls (which I can't change, for obvious reasons). These controls don't necessarily inherit from the same base (and if they do, the base doesn't necessarily have the properties I want to extend, and those are defined in the same class). So,

C# Winforms Designer calling base property instead of 'new' one?

[亡魂溺海] 提交于 2019-12-12 18:45:52
问题 I have a class that inherits from another class, who has a non-virtual property ("Controls"). Since I can't overwrite this property, Im using the 'new' keyword associated with my property. At runtime, this property is called as I want it to, in the correct context. When I open my form from the designer, the designer calls the base.Controls instead of my 'new' control. Am I missing something, or is this just incorrect behavior in the winforms designer? Edit, added the code in question for more

Find the Type of a Class using its full name during Design-Time

限于喜欢 提交于 2019-12-12 15:24:41
问题 Edit: I am using DataSourceProviderService.InvokeAddNewDataSource method to display Data Source Configuration Wizard during design-time in Visual Studio. If user choose an object (as explained here), and click finish, I will get a string like "Namespace.ClassName" . To display the Properties of the selected object in designer, I need to find the correct Type of the object in an optimized manner. I have the name of a class and its namespace ( Application.Data.Employee ). I want to find the

Windows Forms Designer destroys form layout

本秂侑毒 提交于 2019-12-12 14:39:18
问题 This morning I stumbled over a weird issue in Visual Studio's Windows Forms designer. I have a form which worked for about a month now without changes. It looks like this in the application: (text made unreadable because I'm not entirely sure of the legal implications here). Now starting today, apparently (I think I had the form open in the designer yesterday without problems) it looks like this in the designer: Looking at the diff, every control (or nearly every one—labels were not affected,

Windows Forms application option seems to be missing?

拟墨画扇 提交于 2019-12-12 13:15:27
问题 I am learning how to design a Windows Forms Application in Visual Studio 2017. The tutorial asks me to create a new project using the File -> New -> Project option and selecting 'Windows Forms Application' in the new project dialog box. However, when I explore this option in Visual Basic, my New Project dialog window only has three options, and the Windows Forms Application is not one of them (see screenshot - attached). Just wondered if anyone might be able to suggest how to get this option

How do I debug Windows Forms Designer crashing?

自古美人都是妖i 提交于 2019-12-12 12:06:45
问题 I have a windows forms project. It has a main form derived from System::Windows::Forms::Form which I can open in designer without any problems. If I try and close designer though, it kills Visual Studio (v2008 with SP1). The form includes a tab control which has pages with various System::Windows::Forms::UserControl derived forms. So I'm guessing the fault lies somewhere in the main form or one of those sub-components. The problem is I don't know how I can narrow it down at all? I've tried

Designer does not generate code for a property of a subcontrol. Why?

我是研究僧i 提交于 2019-12-12 10:43:22
问题 I created SubCtrl inheriting UserControl. It has no code. I created then Ctrl, which also inherits UserControl. It has a SubCtrl in it and its only code means to expose it publicly so it appears in the property list of Ctrl: public subctrl.SubCtrl SUBCTRL { get { return this.subCtrl1; } } Then I created a simple Form project which only has a Ctrl in it and no code. As I wanted, SUBCTRL appears in the property list of Ctrl so I can change things. I changed the background color (say, to red),

My Windows Form keeps on shrinking/resizing on build

不打扰是莪最后的温柔 提交于 2019-12-12 08:25:03
问题 I am working on a Windows Forms project. It contains a tab controller with multiple pages and multiple controls on each. It appears that relatively recently, after some form changes, that each time I build and run the solution the form resizes/shrinks. So if I set the size of the form height to 768, once I click 'Start' to build and run it, I can actually catch a glimpse of it resizing itself during the process and then the form loads 21 pixels shorter than the height value it was at build