473,609 Members | 2,222 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# App - Issues with docking, controls not logical

27 New Member
Hi guys,

Just a quick question which i am fairly stumped with. I have had a look around, but it seems to be so simple there hasn't been many problems with it from other people.

My issue is that i have a toolstrip and a datagridview and the datagridview isnt finding the toolstrip above it, and when it is doing a fill dock it is cutting a part of itself off from the user.

I have created these objects using code (has to be through code) and they are inside of a splitcontainer.

Expand|Select|Wrap|Line Numbers
  1. ToolStrip strip = new ToolStrip();
  2.  
  3. DataGridView grid = new DataGridView();
  4. DataGridViewButtonColumn columnn = new DataGridViewButtonColumn();
  5. grid.Dock = DockStyle.Fill;
  6. grid.Columns.Add(columnn);
  7.  
  8. splitContainer1.Panel2.Controls.Add(strip);
  9. splitContainer1.Panel2.Controls.Add(grid);
I have tried adding a dock to the toolstrip and invalidating the panel, but it dosent seem to work.

Any help would be really appreciated.

Cheers
Dec 8 '08 #1
3 3534
Looser
3 New Member
simply change the order of lines, where you are adding controls to your parent control (panel2)
So change order of 8. and 9. line to:

splitContainer1 .Panel2.Control s.Add(grid);
splitContainer1 .Panel2.Control s.Add(strip);
Dec 8 '08 #2
Gun Slinger
27 New Member
wow.... that simple. I was sure i tried that before.

Logically i was sure its the otherway around though. Cause the datagridview would see that there was a toolstrip and make sure that it didnt overlap.

Thanks dude. Answered!
Dec 8 '08 #3
Plater
7,872 Recognized Expert Expert
I believe that when the control is added, it "adjusts" any other controls that are already there, not adjust itself after examining what is already there
Dec 8 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
3126
by: ka | last post by:
I'm using Corwnwood.Magic library for docking in my application. My application to let the users to create their screen look to show some particular data. I treid to dock my things in the way, Left Side: ToolBox Middle: WorkPanel Right: Package Explorer + PropertyWindow WorkToolBox, Package Explore, PrepertyWindow : derived from Content
3
1617
by: Peter | last post by:
Hello Thanks for reviewing my question. I have a simple question. I would like to know how you can arrange the docking order? For example, when I add a toolbar and I set the dock to TOP and then add a listview and set its dock to LEFT, the listview goes to left top to left bottom and my toolbar is now smaller because it was pushed over by the listview. What I want is to have toolbar top left to top right and the listview's top starting at...
1
1378
by: juli jul | last post by:
Hello, I need to place those controls in the form in the order that I am writing: 1)ListView (aligned dock to "Fill") 2)Spliter aligned to left(dock=left). 3)TreeView aligned to left(dock=left). How can I do it? (I tried to add them first without docking in the order 1),2),3) but after doing the dock it wasn't ok)
2
2698
by: Gary Shell | last post by:
We are playing around with using the splitter on a form and want to do the following: 1. On the left side of the form will be a tree view. 2. To the right of that tree view would be a splitter. 3. To the right of that splitter would be a second tree we call a palette. 4. To the right of the palette would be another splitter. 5. To the right of that splitter would be our "content area". We are trying to find a way to allow this...
7
3114
by: Chris Dunaway | last post by:
Where/How does VS determing docking order? I created a form with a panel docked to the top and a tab control with fill docking. I had added some tabs and place some controls, etc., and decided to add a status bar to the main form. I add the status bar and docked it to the bottom, but the tabControl when docked as filled, fills *behind* the status bar.
25
5318
by: Dennis | last post by:
Has anyone really gotten the Docking and Splitter Bars to work for anyting but the simplest application for two controls and one splitter bar filling the whole form? If so, can you enlighten my on HOW! I even tried creating background panels and docking them with the controls on the panels but the docking order seems to be random! Another useless control from Microsoft I think! -- Dennis in Houston
4
1446
by: Tor Inge Rislaa | last post by:
Docking of controls I have a ToolBar on top of my form. The property Dock is set to Top. Beneath that I have a Panel as have the same Dock setting set to Top. The panel is Beneath the ToolBar because the ToolBar was inserted to my form as the first of the two controls. How can I change the position of these controls after the design is made? I would prefer not to set the Dock property to none, because it effects the docking of controls...
4
5001
by: Enrique | last post by:
hi all, i'd like to know how i could do a docking menu and docking toolbar. i know it's not so easy y VS .NET 2002 and 2003. anything will help me: links, code, articles..... thanks a lot for your responses and i wish you a merry christmas :-)
3
3327
by: adebiasio | last post by:
Does anybody have any code samples that show me how to dock tabs around a form. I have found numerous controls out there that does the job, but I want to learn how to code it myself. Any sites that show how to code this. Thanks!
0
8557
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8205
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8380
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6983
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6047
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4007
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4066
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2519
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1638
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.