WPF Helper lines in Designer mode not showing any more - c#

I have searched around using different terms, I don't know the correct name of what I search so it's hard to find something relevant about it.
In Winforms when you drag a control into a form and drag it around if there is another control you will see visible lines in the designer (snap lines I think) that are showing the alignment from the control you are dragging to the other. In WPF there was the same but I don't have it anymore and I can't find it anywhere in the tools/options. I did not change anything to my knowledge that would change that behavior.
Is it due to an update and they removed it or what happened that I don't have it anymore?

See bottom, left side of the designer. There are a couple of toggle buttons there which may be of help.

Related

Can't see a button in designer

I'm on Windows 10, maintaining a C# Desktop application using Visual Studio 2019, putting controls onto a Form (System.Windows.Forms.Form). I'm attempting to change an application; reworking where the controls go etc., so there is code and control design that I want to keep and put into different locations. I am using the visual designer and connecting to code using the control events (as opposed to creating the forms dynamically).
I have Document Outline visible on the left; I cut several groups of controls I intend to paste back later, so all that one particular TableLayoutPanel has in it now is two buttons. But I cannot find those buttons in the designer. I can see them in the Document Outline; they're in a TableLayoutPanel (in a group box in another TableLayoutPanel on a TabPage, etc.). When I click on a control in the Document Outline, the corresponding control is usually highlighted in the View; however, when I click on either of these buttons, nothing is highlighted in the view.
I tried resizing the Form (which determines the sizes of all these panels/tableLayoutPanels set to 'fill'); it's currently at 1367,850; one of the button locations shows as 664,752, but I don't know in what coordinate system that applies. I tried manually setting the location to 50,50 in the properties window, but it won't let me change that there.
These buttons appear at the bottom of the form; they've never appeared there, but I've noticed sometimes the designer has shown dotted-line outlines of them outside the form entirely. They appear in place when the application is run.
I've tried changing between the 100% scaling and the 125% scaling; that didn't help. For two buttons, I suppose I could delete them and recreate them, but there are many, many controls on this UI, and if there's some trick to making things appear I'd like to know about it.
Is there a trick to this that I'm missing?

Outlines around all of my objects are gone in all projects VS 2010

My initial question was unclear (because to be honest I am not sure what the dotted lines around every control in the form in Design view is called). Reinstated:
All controls I have added to my form have a dotted line around them so you can see their shape and size. Those dotted lines have always been there by default and since have disappeared. I have not changed anything that I know of and now I am unable to view all of my controls because some do not contain text. For example, if you add a label to your form but leave the Text blank, you are unable to see it in design view. There used to be a dotted line around all of my controls so I knew exactly where they were and what size they were. It is now gone.
This is as clear as I can describe it unfortunately.
I have uploaded a pic here Pic of what it looks like now
These are pictureboxes and there is no easy way to see where their edges are without clicking on them and even then it only shows dots to drag and drop. I used to have dotted lines around all of my controls and now they are "invisible" I need to get them back.
I was able to find a pic of the way it used to be and have uploaded it here:
Pic of the way it should look like
These are Windows forms
I hope this makes sense and I am literally at a stand still until I can get this resolved.
Thanks in advance!
DH

Windows Forms Panel control slowly creeping

So I'm working on a card maker for a TCG. I seem to have encountered a very odd glitch and can't find a decent workaround. I have several panels that contain various controls for determining the different variables of the card, like so:
However, I've noticed that if I go into the Form1.cs file and change code--any code at all, from adding/removing comments to deleting and restoring a semicolon--and then go back into the design view, the design view window goes black for a moment whilst it redraws everything, and then pops back into place...except that the right-hand side of various panels has been bumped to the left about 5 pixels. It doesn't seem like much, but after multiple changes, multiple swapping back and forth between windows I get this:
...which of course is hideous and unusable. For a long time I couldn't determine why some panels did it and others did not, but finally while reworking the Keywords tab you can see in the screenshot, it dawned on me that it was any panel that I have set to anchor both on the left and right hand sides of the parent control. This is to allow the user to resize the window to their heart's content. I currently have a kludge in place in which I modified Form1.Load() to hard-code the size of the affected panels. This is of course entirely against the whole point of using a visual editor in the first place.
The hierarchy of the controls goes Form1->SplitContainer->SplitContainer.Panel2->TabControl->StatsTab->StatsPanel. This unfortunately doesn't appear to be a code-based problem since I don't write any code to affect this. The redraws apparently actually change the StatsPanel.Size property, and if I cycle back and forth I can watch it sloowly decrement.
So, does anyone know what might be wrong? I don't like to jump to "oh Microsoft has a glitch in their editor" but I can't find anything else that I am doing or setting that could be causing it. Any help would be most appreciated.

visual studio 2005 designer moves controls and resizes Form

When i open a form in visual studio 2005 (c#) the designer automaticaly resize the form and move/resize controls without touching the designer at all. The source file is changed and when i close the designer i'm asked to save the *.cs file.
I tried to look into visual studio options without any success.
any ideas?
visual studio setup or something?
thanks,
Tal
I have been working on this problem for most of today and found some interesting things: The main source of the problem seems to be relying on anchoring. If I use docking to position my controls, instead of anchoring, my problems seem to go away. I found a couple of blog posts from 2003(!), which detail how you might use docking instead of anchoring, and explain how anchoring can break the Windows Forms designer. It seems like this problem might be over 7 years old!
Here are the posts:
http://weblogs.asp.net/rweigelt/archive/2003/09/24/28984.aspx
http://weblogs.asp.net/rweigelt/archive/2003/10/17/32407.aspx
http://weblogs.asp.net/rweigelt/archive/2003/10/23/33181.aspx
This is due to AutoScaleMode-property. Your forms have probably been designed with a different DPI or Font settings than you have now in Windows display settings. AutoScaleMode-property has 4 different possible values : Dpi, Font, Inherit or None. In Dpi or Font mode, your forms and controls will be automatically resized depending on windows display settings.
So, set the AutoScaleMode-property to None in all your forms and controls and they won't be automatically resized anymore. Try to design your forms in order to let sufficient space in every controls so that text will fit even if text size is set to 125%.
I found a work around.
not sure what happens behind but i changed my display properties. and it works fine.
here is the sequence: display propertis->settings tab->advance.
in the the advance dialog i changed the "DPI Settings" from Large (120dpi) to Normal (96 dpi)
Had the same problem with controls anchored top, left and right within complex TabControls. The visual studio forms designer was increasing the width of all nested controls each time I would open the form.
I found a simple workaround thanks to this post. I simply added a panel to each tab and set their dock property to fill. All existing controls within the tabs were moved inside those panels. This works, even if the controls are anchored top, left and right.
Works at least for Visual Studio 2013 and 2015.
This is one you should live with. Even in VS2008 such things happen from time to time. It is mostly depends on form content (controls, positions, etc), and there is no option in VS to disable such behavior.
When you open your form in designer, vs runtime rebuilds visual appearance from code behind. And sometimes it made changes at this moment. Also when you are simply adding one control to form, designer fully rebuilds codebehind and resource files. This is well known issue, and seems that MS won't fix it, because they move in WPF direction.
So several points to simplify your life:
Move to VS2008, designer were more consistent, but still shuffle controls in .designer.cs file
Place your code in one of the source repositories, so if you accidentally saved such form, you can restore it from repositary.
Setting the form Min and Max size settings to the current size was a good work around for me. This prevented VS from resizing it.
I had a trivial form with few controls on it, where the OK and Cancel at the bottom were being shifted up as soon as the form was opened in the VS2013 designer. The same behaviour was observed in VS2015.
The accepted answer here of DPI did not solve the issue for me, nor were there any issues on the size of the form/padding/margins.
Removing the controls that are shifted and adding them back into the form solved the problem for me, as suggested by ptutt here:
Visual Studio designer moving controls and adding grid columns when form is opened
While I appreciate ryantum's suggestion and links of using docking [with panels], as also referred to in the link above with Roland's blog post here https://weblogs.asp.net/rweigelt/28984, with something so trivial I'd rather just make it go away with removing/adding back in.
I found locking the controls from the format menu was a simple and effective solution. VS2013
I had this problem with VS 2015.
I used dock panels with the controls that moved unexpectedly as their childs.
By default the controls will be aligned to the left, but you can change the orientation.
My buttons stopped moving.
I had this issue, too. Every time I opened the designer, every box with anchor "right" was moved about 20 Pixels to the left. Additionally, the bottom of every box with anchor "left" was about 200 pixels outside the form.
This form has many controls and should not shrink on smaller displays, so it was set to autoscroll, the form itself was smaller in the designer than the shown minimum size (historically...). I just set the size to the minimum size so that no scroll bars appeared in the designer and the anchors worked as expected without screwing up the postitions.
I read the first post from ryantm's answer which led me to the solution. Apparently it has something to do with the order .Net executes events such as setting the size of a form.

How can I create a button with an embedded close button

I am trying to create a panel which will have a set of "buttons" on it.
These buttons should have the following behaviour:
Appear similar to a tag (with
rounded edges)
Contain a red
cross to remove the filter/tag from
the panel, similar to the way internet
explorer tabs have an embedded cross to close the individual tab.
allow the user to click
on the tag and respond like a normal
button (as long as the click is not
in the red cross)
Number 1 is no problem, this is just appearance, however, regarding numbers 2 and 3, I am not sure if there is already code out there do to something similar...and I dont really want to reinvent the wheel if I can avoid it!
My question is: Does anyone know if there is something out there in infragistics which will do this simply, or will I need to write this myself by subclassing winform buttons?
Thanks in advance!
Is this new development or maintenance of an existing project?
If it is maintenance, you have a somewhat tougher time ahead. You'll implement a UserControl, probably segmented into two buttons. Use docking to get the behavior as correct as possible. The far right button would contain your cross image; the left (which would need to auto-expand as you resize the control) would contain your primary button behavior. Play with the visual styles until you get them right (EG, removing borders, etc).
If this is new development, and you haven't gotten too far into it, you might consider using Windows Presentation Framework (WPF) instead of WinForms. It will be easier to build the control and get it to look exactly how you want it. WPF includes an extremely powerful control compositing system which allows you to layer multiple controls on top of each other and have them work exactly as you'd expect, and it carries the added advantage of allowing full visual control out-of-the-box.
Either way, this is more work than dropping in an external component ... I've used Infragistics for years, and I can't think of anything they have which is comparable. The closest, but only if you're building an MDI application and these controls are for window navigation, is the Tabbed MDI window management tools -- and there, only the tabs (which replace window title bars) have this behavior.
I don't think that infragistics can do something like this. The UltraButton control can't.
Implementing a own control wouldn't be that hard.
your probably going to have to make a costume control for this type of work.

Categories