-
Aug 12th, 2024, 07:45 AM
#1
Thread Starter
Hyperactive Member
Custom Controls - Designer
Hi,
If I create a custom control, let's say a Panel. If I have various controls within this Panel, more often than not after running the program in my designer view that Panel goes blank and the controls aren't visible.
I have to close the designer and open it again and everything is displayed again.
Is there a way to prevent this happening?
Thank you.
-
Aug 12th, 2024, 11:32 AM
#2
Re: Custom Controls - Designer
Please provide the simplest example you can to demonstrate the actual problem. Your question really doesn't make all that much sense as it is because a Panel is not a custom control. It may be that you should be creating a user control, which is a specific thing, but it's hard to tell because your question is too vague.
-
Aug 13th, 2024, 08:35 AM
#3
Thread Starter
Hyperactive Member
Re: Custom Controls - Designer
Apologies, I have created a Custom Control "CustomPanel" that Inherits the standard Panel Control.
vb Code:
Public Class CustomPanel
Inherits System.Windows.Forms.Panel
Protected Overrides Function ScrollToControl(ByVal activeControl As System.Windows.Forms.Control) As System.Drawing.Point
Return Me.AutoScrollPosition
End Function
End Class
In the form designer for the Form that I use the CustomPanel on I have several other Controls e.g. TextBox, ComboBox etc. placed within the CustomPanel. They all appear fine, but more often than not after I've clicked "Start" to test my application the Panel is blank. I can select the contained Controls from the drop down in Properties, but it's only after I close the designer and open it fresh that they all appear as they should. Also if I do use the Properties drop down to the select a Control, the outline highlight for the selected Control shows way off position. I will get some screenshots when I'm back home.
Thank you.
-
Aug 13th, 2024, 10:47 AM
#4
Re: Custom Controls - Designer
I'll be interested to hear whether anybody has a good answer for this one. It sounds like a bug in the designer, to me. VS2022 is pretty good, but it is not without flaws. I've seen cases where the designer failed to render properly, and they may or may not be related to your specific case. Just yesterday, I was looking at a simple WPF page (form, just not called a form), and I couldn't see it at all. In the WPF designer, sometimes it starts out zoomed way out and scrolled weirdly, such that the form is there, it's just shrunk small and off the bottom of the screen, but not in this case. I couldn't find that form anywhere, so I closed the designer and re-opened it, and all was well. That sounds suspiciously like what you are describing, it's just that I was in WPF.
My usual boring signature: Nothing
-
Aug 13th, 2024, 10:04 PM
#5
Re: Custom Controls - Designer
Originally Posted by Shaggy Hiker
I'll be interested to hear whether anybody has a good answer for this one. It sounds like a bug in the designer, to me. VS2022 is pretty good, but it is not without flaws.
The designer was also rebuilt from scratch for .NET Core, so it contains some bugs that do not exist in the .NET Framework designer. If this is a .NET Core app (including .NET 5 and later) then I would suggest testing the same thing in a .NET Framework project to see whether the same thing happens. If it works as expected in .NET Framework but not .NET Core then it is almost certainly a designer bug and you can report it to Microsoft. They are actually adding new features to WinForms in .NET 9 so they are more likely address such issues now than they have been for a while.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|