windows-forms-designer

c# winform : override default properties in designer from custom control

﹥>﹥吖頭↗ 提交于 2019-12-11 08:49:36
问题 Here is the situation. I made a custom button control : public partial class EButton : Control, IButtonControl This control contains a button. I use getters/setters to edit his properties in designer, like this : [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] [Browsable(true)] public UIButton Button { get { return EBtn; } set { EBtn = value; } } Now, I can access all of my button's properties in the designer. My problem is that no matter what I define, this is

Get all controls of the current form at design-time

家住魔仙堡 提交于 2019-12-11 07:33:53
问题 I have a question about design-time things: I've made a component with an property "Links". Those links are Controls. Now I want to make a UI-Dialog (for editing this property in the property grid). How can I get all controls of the current form? I think the component has an connection to it, but where? I can't find anything. Thanks :) 回答1: This is quite untrivial to do, I don't know of any examples of .NET components that do this. You can get to the form at design time with the Site property

C# Winforms Application Failure in sending Email: The remote name could not be resolved: 'smtp.gmail.com ; Operation Timed out

邮差的信 提交于 2019-12-11 06:43:39
问题 My WinForms C# program sends email. I've used MailMessage and SmtpClient . In the constructor of SmtpClient I passed smtp.gmail.com and port 587. This is working on my friend's computer, however when I try it I get this error: System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: The remote name could not be resolved: 'smtp.gmail.com' System.Net.Mail.SmtpException: Operation Timed out How do I fix this error? Why is it specific to my computer? If i use port 25 i

UseCompatibleTextRendering property not created by designer when it is set to false

无人久伴 提交于 2019-12-11 06:38:57
问题 I do not wish to use compatible text rendering, but I do not wish to use Application.SetCompatibleTextRenderingDefault(false); Naturally, I thought all I had to do was set each label's UseCompatibleTextRendering property to false. The Forms Designer, however, apparently only generates code to set the property if UseCompatibleTextRendering is set to true. No problem, I thought, that must mean that UseCompatibleTextRendering is initialized to false by default. Yet when I start up my form, lo

Need To Hide A Designer-Only Property From PropertyGrid For A .NET Winforms Control Part II

烂漫一生 提交于 2019-12-11 06:16:40
问题 This is a follow-up question to: Need To Hide A Designer-Only Property From PropertyGrid For A .NET Winforms Control I have replaced the default TypeDescriptorFilterService with my own implementation (so cool!), and the FilterProperties event handler is firing. I see how the previous question helped to hide those specific TableLayoutPanel properties. Now I have a more general requirement on a project to hide certain properties. My current specific goal is to hide the "(Name)" property for my

Making an array of textboxes is not working

人走茶凉 提交于 2019-12-11 04:54:57
问题 Ok so here is my designer.cs code for (int i = 0; i < textBoxes.Length; i++) { textBoxes[i] = new System.Windows.Forms.TextBox(); this.textBoxes[i].Location = new System.Drawing.Point(90, 50 + i * 20); this.textBoxes[i].Name = "textBox" + i; this.textBoxes[i].Size = new System.Drawing.Size(100, 20); this.textBoxes[i].TabIndex = i + 1; this.Controls.Add(textBoxes[i]); } This was edited code below the Windows Generated code private System.Windows.Forms.TextBox[] textBoxes = new System.Windows

Winforms: Why do events fire at design-time?

孤人 提交于 2019-12-11 03:38:28
问题 Why are messages displayed at design-time? My code is : class Class1 : TextBox { public Class1() { this.Resize += new EventHandler(Class1_Resize); } void Class1_Resize(object sender, EventArgs e) { MessageBox.Show("Resize"); } } Pic : 回答1: Because that's the way the Form designer works. It's actually instantiating your control when it displays it in your form at design-time. Thus when you resize the control in the designer, your code for the message box fires. 来源: https://stackoverflow.com

Accessing connection string from base form causes designer error

时间秒杀一切 提交于 2019-12-11 02:56:35
问题 I have a vb.net windows forms application in which I'm using inheritance for the windows forms. I have a base form that provides some of the basic layout and methods that will be used with all inheriting forms. This includes the initialization of an entity framework context in the base form constructor . Dim dataContext As New CCEntities() The child form can then make use of this context. The application compiles and runs without error, but when I try to view the child form in the designer,

C# Winform CollectionPropertiesEditor - How to hide some properties in the built-in PropertyGrid based on runtime condition

醉酒当歌 提交于 2019-12-11 01:37:56
问题 Is there a way to hide show properties in “CollectionPropertiesEditor’s PropertyGrid” Recently I found out that there is a way to change the PropertyGrid’s Browsable attribute at run time. I want to know if this can be done to a “CollectionPropertiesEditor’s PropertyGrid”, I have been un-successful at finding relevant results on Google Search. Now I have my hopes on StackOverflow to help me solve this problem. Problem: I had to add some properties to GridColumn control due to new customer

How to add a UserControl which is in a Folder in Project to ToolBox

余生长醉 提交于 2019-12-11 00:02:05
问题 I'm working on a Windows Forms project in Visual Studio 2012 . In the solution of the project, I created a new Folder named userControls and added to it a user-control ( UserControl1 ). Here is the tree view of the solution: How can I access the UserControl in that folder from the ToolBox ? Rebuilding the Solution and restarting Visual Studio didn't solve my problem. 回答1: User controls which are in the current project will be added to toolbox automatically after a successful build and you don