|
I want to contruct a tree view ... but instead of vertical expansion, I want it to expand out horizontally. The intent is to present a navigation view going left to right. Has anyone seen a control like this?
Thanks
_____________________________________________
The world is a dangerous place. Not because of those that do evil, but because of those who look on and do nothing.
|
|
|
|
|
What kind of application would use this kind of control, wouldn't it give uneasy feeling to the user, because most controls only do a vertical scroll and horizontal scroll only when things could not be shown on the fullscreen.
Kannan
|
|
|
|
|
Kannan,
I stated the application in my post: it is a Navigation view. And moving left to right is more natural than an expanding tree that moves up and down. As to scroll bars....I never said anything about scroll bars in my question.
_____________________________________________
The world is a dangerous place. Not because of those that do evil, but because of those who look on and do nothing.
|
|
|
|
|
Does anyone know how I can insert a macro into Excel from C#?
I tried
fExcel.RecordMacro(macro, System.Reflection.Missing.Value);
but that seems to do nothing.
I can find no other way... or even a clue...
Help would be appreciated.
Thanks.
Michel van Meijer.
|
|
|
|
|
Hi,
I just can't figure out how to obtain logical drive information. What I need is the volume label, capacity, etc. I guess by now I know all System.IO classes by heart. Can somebody kick me into the right direction please.
I'm loosing hair over this one...
Matthias
In theory, there is no difference between theory and practice. In practice, however, there is.
(unknown author)
|
|
|
|
|
Did you have a look around System.Management ?
Cheers,
Kannan
|
|
|
|
|
I've looked everywhere for functions like the ones you are interested in (and many others), but I suppose some Win32 calls were never ported to the CLR. I have found Environment.GetLogicalDrives(), which is similar to GetLogicalDriveStrings() in the Win32 API. Well, maybe someone else has found others, but I just use the PInvoke/DllImport stuff. Here's some code from one of my projects:
public class Volume {
[DllImport("kernel32.dll", EntryPoint="GetVolumeInformation", CharSet=CharSet.Auto)]
public extern static int
GetVolumeInfo(string sRootPathName,
StringBuilder sbVolumeNameBuffer,
int nVolumeNameSize,
out uint uVolumeSerialNumber,
out uint uMaximumComponentLength,
out uint uFileSystemFlags,
StringBuilder sbFileSystemNameBuffer,
int nFileSystemNameSize);
[DllImport("kernel32.dll", EntryPoint="GetDriveType", CharSet=CharSet.Auto)]
public extern static uint
GetDriveType(string sRootPathName);
[DllImport("kernel32.dll", EntryPoint="GetDiskFreeSpaceEx", CharSet=CharSet.Auto)]
public extern static int
GetDiskFreeSpaceEx(string sAnyPath,
out ulong ulFreeBytesAvailable,
out ulong ulTotalNumberOfBytes,
out ulong ulTotalNumberOfFreeBytes);
}
uint uSerialNum, uMaxEntryLen, uFileSysFlags;
StringBuilder sbLabelBuf = new StringBuilder(260);
StringBuilder sbFileSysTypeBuf = new StringBuilder(260);
int iSuccess =
Volume.GetVolumeInfo("C:\\", sbLabelBuf, sbLabelBuf.Capacity,
out uSerialNum, out uMaxEntryLen, out uFileSysFlags,
sbFileSysTypeBuf, sbFileSysTypeBuf.Capacity);
FWIW, I'm amazed I have any hair left at all
Matthias Steinbart wrote:
In theory, there is no difference between theory and practice. In practice, however, there is.
Love that one.
Cheers
|
|
|
|
|
|
|
I’ve a WinForm application and a TreeView control on it. I’m creating another thread to add data to the control. So far I’m able to achieve this behavior, but sometimes secondary thread is not destroyed. I know it is not recommended, but I’d like to know more about my options and why I should not do this.
Thanks
|
|
|
|
|
You should be able to do this, but you can't do the actual update from the second thread. At least not reliably.
You'll need to use Control.Invoke() on the treeview control. Create a function that does the add on the control, create a delegate to it, and pass the delegate and the parameters to Invoke(). It will then get called on the main UI thread.
|
|
|
|
|
i have a simple network of two computer (xp prof installed on both).i have created a user on both machine with same name and password and both are members of admin.. group.
i have created a service in c# i am running it in local system account.
but i could not access any file on the network of another computer in my service of c#?
could any body help me in this regard?
r00d0034@yahoo.com
|
|
|
|
|
I have an MDI app that opens a child window and the child window performs a long database operation in the Load event. I have added the standard cursor code:
Cursor cursor = this.Cursor;<br />
this.Cursor = Cursors.WaitCursor;<br />
...<br />
this.Cursor = cursor;
However, the form does not immediately display so the cursor does not change until the operation is done... and then only briefly. So, I get smart and say:
this.Show();<br />
Application.DoEvents();<br />
Cursor cursor = this.Cursor;<br />
this.Cursor = Cursors.WaitCursor;<br />
...<br />
this.Cursor = cursor;
But this does nothing to affect the problem.
--
If it starts to make sense, you're in a cult.
|
|
|
|
|
Try putting the
<br />
Cursor cursor = this.Cursor;<br />
this.Cursor = Cursors.WaitCursor;<br />
just before showing the child window.
You wont want to use a local to hold a reference to the previous cursor (like above), but could use a form level public field so it could be addressed by either child or parent.
Some ideas are so stupid that only an intellectual could have thought of them - George Orwell
|
|
|
|
|
What you are seing is the cursor getting reset to the cursor defined for the control that is currently under the cursor! This happens during DoEvents(). As yet I have not found a good way to solve the problem.
Joel
VssConnect - Remote SourceSafe(r) Access http://www.voxcode.com[^]
|
|
|
|
|
What about getting the form to display while the database operation is taking place? I can't even get the form to show up until the end of the Load event.
VB6 had a concept of Screen.MousePointer which set the cursor for the whole application. Does anything like that exist in .NET?
--
If it starts to make sense, you're in a cult.
|
|
|
|
|
|
One method that I use is to subscribe to Application.Idle then in your idle event handler, unsubscribe from the idle event and then do your long operation. This should allow your form to display before the long operation. There are probably other ways to do this also. You could also take a good look at Win Forms FAQ[^].
Joel
VssConnect - Remote SourceSafe(r) Access http://www.voxcode.com[^]
|
|
|
|
|
I am given 2 ArrayLists - arOriginal and arNow. I am supposed to populate ArrayLists arNew and arMissing. arNew is the ArrayList of items in arNow that are not in arOriginal. arMissing is the ArrayList of items in arOriginal but not in arNow. I also need to surmise that each ArrayList (arOriginal and arNow) can contain up to 2 million items. What is the fastest way to do the searching? I am almost ruling out doing a linear search using Contains().
|
|
|
|
|
copy the elements of arNow to a b-tree (not in .Net Framework Classes, will need to port something from Java word). tese for missing against the b-tree, since in a log2n search in the b-tree. If you leave them in a simple arraylist, you're pretty much stuck with a linear search...
Some ideas are so stupid that only an intellectual could have thought of them - George Orwell
|
|
|
|
|
I'd also consider using a hashtable for this. The creation cost of the hashtable is likely to be a fair bit lower than the b-tree would be, and the lookup cost will likely b less (or tunable to less if you're willing to have a low enough packing factor).
|
|
|
|
|
I have an extender that adds some common properties to all controls on my form. Everything works fine in the IDE. The problem is that I've got a property grid on my form to allow users to edit these properties, except they don't appear at run-time
You can access the properties through code so the extender is working at run-time but they do not appear in the Property Grid!
Help! Otherwise I'm gonna have to write a wrapper class for each control
|
|
|
|
|
hi friends,
i want to add an image to commandbarbutton in C#.
i have added appropriate code but im getting an error saying that "object reference not set to an instance of an object" when im trying to assign an picture to commanbarbutton.Picture property.
here is my sample code:
CommandBars objCommandBars;
CommandBar objCommandBar;
object str = "MyToolBar";
objCommandBars = (CommandBars)applicationObject.GetType().InvokeMember("CommandBars", BindingFlags.GetProperty , null, applicationObject ,null);
objCommandBars["MyToolBar"].Delete();
objCommandBars.Add(str,omissing,omissing,omissing);
objCommandBars["MyToolBar"].Position = MsoBarPosition.msoBarFloating;
cmdOpenI = (CommandBarButton)objCommandBar.Controls.Add(1,omissing,omissing,omissing,omissing);
cmdOpenI.Caption = "Test";
cmdOpenI.Tag = "Test";
String strFile = "F:\\a1.bmp";
Object lpDisp = null;
try
{
OleLoadPictureFile((Object) strFile, out lpDisp); //API relevant to LoadPicture in VB
stdole.StdPicture pic = (stdole.StdPicture)lpDisp;
if (pic != null)
{
cmdOpenI.Style = MsoButtonStyle.msoButtonIconAndCaption;
cmdOpenI.Picture = (stdole.IPictureDisp)pic;// here only im getting an error "object reference not set to an instance of an object"
}
}
catch(Exception exp)
{
System.Windows.Forms.MessageBox.Show(exp.Message);
}
cmdOpenI.Visible = true;
cmdOpenI.Click += new Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(OpenIntranet_Click);
objCommandBars = null;
objCommandBar = null;
if i set the commandbutton type as 2,3 otherthan button type 1 im not getting an error. but i want the button type to be 1.
can anybody help me to achieve the task.
Thanks in advance
regards,
sns
|
|
|
|
|
Just a guess here, but since the code fails only when a picture is absolutely required (type 1 is strictly icon, whereas other two use text and thus don't require a picture to be shown), maybe the error is saying that pic's underlying image is always invalid, and that only matters when one is absolutely needed. In other words, although pic is not null, it may not contain a reference to a valid StdPicture.
Since StdPicture is a COM object, it is possible that it is non-null, yet its Handle property may be invalid. COM objects can be that way. Could you try verifying if pic.Handle is valid rather than if pic overall is non-null?
|
|
|
|
|
an error. am i correct?
if so im getting 8 digit +ve number when i read the handle.
im not able to locate still whats an error.
regards,
sns
|
|
|
|