TopToolStripPanel won't show in UserControl - c#

I'm currently trying to create an image previewer in my program, which I'm doing by creating a UserControl. All seems to be working great, except that I now would like to move some of my buttons to the top of the UserControl.
I have done this by creating a ToolStrip and adding two buttons and a combobox. My problem is, that the new ToolStrip (toolStrip1 - see Document Outline pic.) won't show when I run my program. I have tried settings toolStrip1.visible = true and using the .BringToFront() method, but none of these options seems to work.
Can someone help me solve this irritating problem?
P.S. toolStrip2 is showing just fine in BottomToolStripPanel.
Picture 1: My Document Outline
Picture 2: My Image Previewer Design. The top bar is toolStrip1 which I'm currently not able to see when I run my program.

I've quickly duplicated your layout, and it worked without a problem here.
Do you not by any chance set the "TopToolStripPanelVisible" property on the "toolStripContainer" to 'False' programatically?

Related

How to avoid image overlapping the text of TabPage in WinForms after setting it programatically?

I have a Windows Forms application with a TabControl that has two TabPage objects:
What I am aming for is a way to display an icon beside the titles of the tabs. For that, an ImageList is assigned to the TabControl so the ImageIndex property of the tab pages can be set. When I do that in the designer, it looks fine, but when changing it programatically in my code like this:
myTabControl.TabPages[0].ImageIndex = 0
, it has this weird overlapping effect:
How can I avoid this? Things I've tried are myTabControl.PerformLayout() and myTabControl.Invalidate(), but none of them worked. Thanks!
So apparently, there is a workaround solution:
myTabControl.ItemSize = myTabControl.ItemSize;
This only works if the SizeMode of the tab control is set to TabSizeMode.fixed. Thanks to Dr.Null (comment above) to point this out.
While this is simple though, it's not so elegant and confuses readers. I wonder whether there are other, intended solutions or whether this is a "hole" in WinForms Microsoft didn't consider.

Error When using Microsoft.DwayneNeed to solve WPF airspace isssue

I have a wpf app,which used winform control on the mainwindow.Of course ,this winform control stays ontop when a show a modal border. After that,I found Microsoft.DwayneNeed way to solve this problem.It works. But there's a new problem shows up. Let me describle my situation:
In the MainWindow,I have a Grid,which has three columns.The control in first column is a normal wpf control.The second column contains a Gridsplitter.And the third columns is where the winform control lays in.
Before I use AirspaceDecorator(From Microsoft.DwayneNeed) as container of winform control,except the winform control always stays on topmost,every thing is ok, and GridSplitter works well.
After I use AirspaceDecorator as winform control's container, winform control doesn't stay topmost.It's good,it's what I want. But surprisingly, GridSplitter doesn't work any more:
1.Generayly,I can't drag GridSplitter --- it should be drag horizontally as designed.
2.On occassionly,GridSplitter will be dragged to the end of the left or the right edge of window .At this curcirmstance,the winform control occpies all the window,or zero.
I tried some ways,such as AirspaceFixer,using WinformHost to host dialoge border,etc. But none of these methods works.
Thanks !
After some testing,I resolved this problem.The answer is to use AirspaceFixer correctly.
Before you call something show on winform control that wrapped by AirspaceFixer,you should set FixAirspace to true,and after you hide upper wpf control,you should set FixAreaSpace property to false. Just like it's demos shows up.

Winform User Control size switch back to initial size after localized

this is my first thread on this great website for programming :)
I have a problem with my UC. I'm currently developing an extended version of DataGridView, which added some functionality like paging support.
Here is the picture of the UC inside a form, after I make it bigger than the initial size:
And finally, I change the form's language to Indonesian. And then the designer suddenly repaint my UC. The size of the container of my UC is OK, means the designer remembers that I resized my UC before. But unfortunately the controls inside the UC's container gets switched back to their initial size, leave some blank spaces inside. This behaviour only happen in design time. The UC is fine in runtime mode, its size works well.
How could this happen guys? Although it's fine in runtime, but it's ugly in design time.
Sorry for my English, greeting from Indonesian :)
Thanks.
===SOLUTION===
After play a bit, finally I've found the solution. Before I place the controls inside to the container, I must first add a Panel to the container, set it to transparent, and set its Dock property to Fill. Then followed by DataGridView and BindingNavigator to the rest. Build and it works like a charm!
It seems that the Panel resolves the problem :)
Cheers
Maybe it will help to change the order of the factors. First change the Form language to Indonesian. Then save your project and close it. Open it again and check if it still on Indonesian then place the DataGridView control on the form and re-size it.

C# winforms toolbar buttons

I got an application that the main form contains a System.Windows.Forms.ToolBar.
I want to add a new System.Windows.Forms.ToolBarButton with a little longer text from the rest. so on the designer window when I press Enter after I changed the text, I see part of it with 3 dots (...) and when I click OK, the toolbar itself gets very wide for some reason and the spaced between every item gets bigger.
I couldn't find a lot online about this control... maybe it's old but I can't change it.
I tried to access the buttons but when I drag, the whole toolar mooves.
What can I do ?
Thank you very much !!

WPF validation showing from different layers

I am trying to build a MDI UI in WPF.
I have tried MdiContainer and WPFMDI but I have an issue in both cases. If I have a usercontrol with validation showing red borders, and another user control is shown on top of it, the red border from behind is shown.
I have shown the behavior at https://wpfmdi.codeplex.com/workitem/13413 and https://mdicontainer.codeplex.com/discussions/644330
Since the same issue happen in both library, is there something WPF-related?
Any idea on how to fix it?
Since it seems a complex task, any ideas on how to build MDI UI using WPF that would work with validation?
I finally found the issue and it is not related to the WPFMDI component I am using.
The solution is to wrap your StackPanel or Grid containing the controls being validated into an AdornerDecorator.
The solution was found at https://www.devexpress.com/Support/Center/Question/Details/B195328

Categories

Resources