|
I'm trying to get an MDI window that contains a number of sub forms, one of which i would like to be an MDI.
I am looking for an effect similar to the one found in the relationships window of access. Where the Access window is the parent of the relationship window which in turn is the parent of a number of "table view" windows.
However, when i try and enable MDI container on a contained form... it crashes, as it says a MDIContainer cannot be both a child and a parent form.
As another note, the relationship window, while contained in the main Access view, also displays a window icon on the task bar below the table view. I'm not sure how this is implemented.
Are the "table view" windows actualy forms? Or simply objects that seem to behave like forms, but lack a lot of the functionality? In which case, how do i construct a form that handles them like child components, and is a child form itself?
I noticed that the access relationship window does not have the automatic scroll bars that MDI containers use, they are pre-placed, so it's a fixed size canvas and it does not implement MDI because the background colour is not MDI container. So how do the sub objects work?
Are they components? Or panels? Or some other object? I'm trying to figure out how to apply an adjustable border (re-size and move) to a selectable form component. Bit confused.
Cheers
Cata
|
|
|
|
|
The Catalyst wrote:
I'm trying to get an MDI window that contains a number of sub forms, one of which i would like to be an MDI.
Can't do that. An MDI Parent cannot be a child to another MDI Parent.
Access uses what looks like child windows in it's relationships window, but they are really controls that have the appearance and some behaviors of a real window.
RageInTheMachine9532
|
|
|
|
|
I figured that out. The relationship uses other features that a pure MDI window would not allow.
Do you know how to implement these controls? I played with custom controls, but there is no way to set the border on them, so i'm lost.
If i could build the object, i could manage them with an array easy enough, but i really need to find out how to implement the movable and resizable form style border.
Cata
|
|
|
|
|
I m making the add ins for application .Problem is this when i m making a button using following syntex ,Please Give me some help regarding ...
osButton=(_Office.CommandBarButton)oCommandBar.Controls.Add(_Office.MsoControlType.msoControlButton,oMissing,oMissing,oMissing,oMissing);
osButton.FaceId=57;
But when i m running the program button is appearing in addin but the icon is not displaying .if i use caption instead of FaceId it is working mean the caption is displaying but icon is not .what is the problem i m trying to find but still not getting where the problem is bkz no prob with syntex bkz this code is working in another computer .(my os Windows 2000 advance server)
Thanks if u tried to find the solution
|
|
|
|
|
Hey everyone,
I have a problem with seting and expanding nodes in a explorer clone program I am trying to make. The problems comes as when I am trying to open a folder in the right side of the explore bar (the right side is a TreeView and the left is a ListView). I can't find a method that will allow me to change the selected node in a treeView and also expand it.
Please help.
Part of my program's source code is here
private void lv_ItemActivate(object sender, System.EventArgs e)
{
ListView lv = (ListView)sender;
foreach (ListViewItem lvi in lv.SelectedItems)
{
string fullPath = tvw.SelectedNode.FullPath.ToString() + "\\" +lvi.Text.ToString();
MessageBox.Show(lvi.Text);
DirectoryInfo di = new DirectoryInfo(fullPath);
if ((di.Attributes & FileAttributes.Directory)!=0)
{
//here is what I have being attempting but to no avil because the selected node property is read only
tvw.SelectedNode = new TreeNode(lvi.Text);
tvw.SelectedNode.FullPath = fullPath;
tvw.SelectedNode.Expand();
return;
flow
PS: Thanks for the help in advance, I am new to the forum and I hope I can contribute and learn a lot in here.
|
|
|
|
|
The TreeView.SelectedNode property is NOT read-only, but TreeNode.FullPath is (which you're trying to set). All you need to do is recursively find your TreeNode (based on the path if you like) and then set TreeView.SelectedNode to it. If you want to expand it, call the Expand method on your TreeNode .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hey thanks for the help,
I have being thinking of using the Parent property to recurse through the tree node, but I what I don't understand is that after this I am still going to find a full path, and I wondering what to do with that.
Thanks for the help.
|
|
|
|
|
You don't recurse up using the Parent , you recurse through the children using the Nodes property. All children have only one parent, so there's not even a need to use recursion since a simple iterative loop will work just fine. To find a full path, just split the string on the separate character ("\" by default) and look for the TreeNode with the given text like so:
public TreeNode FindPath(string path)
{
if (path == null) throw new ArgumentNullException("path");
string[] names = path.Split(PathSeparator);
return FindPathHelper(Nodes, names, 0);
}
private TreeNode FindPathHelper(TreeNodeCollection nodes,
string[] names, int iteration)
{
if (nodes != null && names != null &&
iteration >= 0 && iteration < names.Length)
{
foreach (TreeNode node in nodes)
{
if (string.Compare(node.Text, names[iteration], true) == 0)
return node;
TreeNode child = FindPathHelper(node.Nodes, names, ++iteration);
if (child != null) return child;
}
}
return null;
}
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello Heath,
I know this thread over 5 years old and I hope you're still subscribing to it. I'm also trying to expand the path to a specific node in a treeview (i.e. a node that has just been added by a user).
I almost understand your code example. However my question is, where did you get the TreeNodeCollection for the "Nodes" parameter in the initial FindPathHelper call (within the FindPath function)? I don't see it declared anywhere.
Thanks,
Sacha
|
|
|
|
|
As mentioned, "you recurse through the children using the Nodes property". The Nodes property is on TreeView class and on the TreeNode class (which is used to recurse into subnodes).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
i designed a form using datagrid to connect to database. It allow user to enter data but i can not validate the data that user provide.
Please help as posible as you can.
Thanks.
Mr Duc Linh Nguyen
|
|
|
|
|
There are many ways you can do this. One way is to handle the TextBox.Validating event (inherited from Control ) of the DataGridTextBoxColumn.TextBox property, which gets the TextBox that is hosted when the cell is in edit mode. If you wanted to validate input as they type, handle the KeyDown event of the TextBox as well.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Is anyone aware of a componant that allows the building of relational query between tables. Looking for something similar to Access or SQl server. I want to use this in a project I am building.
Thanks for any help.
Stephen
|
|
|
|
|
How can i drag the items in listview to a custom position
just like in windows explorer when you set a icon view and the autoarrange is off.....
please help me...
i set in the ListView the ListViewAlignment property to Default
and AutoArange to false but it has no effect...
again pls help!
helppppppppppp
|
|
|
|
|
Found this
article here on Code Project
|
|
|
|
|
Setting AutoArrange to false and setting ListView.Alignment to ListViewAlignment.Default only takes effect if the ListView.View is set to View.LargeIcon or View.SmallIcon . Is this the case as well?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
i have done this... but i think that i must resolve some events and i dont know which one
|
|
|
|
|
i have done that but still not working
|
|
|
|
|
how to grab a frame from webcam in c# ?
thanks...
|
|
|
|
|
You can use either the SDK for the WebCam, obtained from the manufacturer's website (http://developer.logitech.com[^] for Logitech cams) or try the Windows Image Acquisition API, docs are found here[^].
RageInTheMachine9532
|
|
|
|
|
How do you do anything useful with the Scroll event for a DataGrid ? I ned to take some action depending on which portion of the grid is visible, but there's no FirstVisibleRow property, although there is a FirstVisibleColumn .
I could do this with the scroll bars in an MFC ScrollView, but I can't see it in .NET.
|
|
|
|
|
Oh what, you're saying their example for the Scroll event in the SDK docs that pops up a MessageBox every time you scroll isn't practical?!
You could simulate a FirstVisibleRow of sorts (if you're extending DataGrid , it would definitely make a good read-only property) by calling DataGrid.HitTest with coordinates that would always be in the upper-left corner, like 1, 1 .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
But the Scroll event has a EventArgs not a MouseEventArgs so I can't do a hit test can I? If I could find the position of the slider (relative to top & bottom of the scrollbar) that would be enough.
|
|
|
|
|
For one, you can get the mouse position in screen coordinates at any time from the static Control.MousePosition property, but you didn't read my reply so this really doens't make a difference.
When you scroll, obviously a new row is displayed at the top of the DataGrid , right? All you need to do is call HitTest with the coordinates 1, 1 (or new Point(1, 1) and that will get you the row currently at the top of the DataGrid 's view. This is a very simple workaround.
If you want the slider position, simply P/Invoke the SendMessage API and send the SBM_GETPOS message to the DataGrid control using its Handle property (the HWND for the control). This will get you a value of between 0 and 100, so you'll need to take the row height into account and calculate everything, but the workaround above is so much simpler and doesn't require you to P/Invoke anything (making your code more portable).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I did read your reply but didn't know that HitTest could be used for anything other than a mouse position - that's what the help for HitTest suggests.
But I'm still not getting there...
DataGrid.HitTestInfo hti = valueGrid.HitTest(1,1);<br />
int row = hti.Row;<br />
if (row >=0)<br />
{.......<br />
but row always gives -1 no matter where the scroll position is.
I've also tried
DataGrid.HitTestInfo hti = valueGrid.HitTest(valueGrid.Location);
but no joy, and even tried checking the point in the middle of the top left cell, but again always row = -1.
Obviously I'm missing something very obvious!
|
|
|
|