Perhaps you could use the NativeWindow class, passing a CreateParams structure with its Parent property set to the Handle property of the right handle Panel. Then, display the form and use the SetParent PInvoke call to make it a child window of the parent
NativeWindow wnd = new NativeWindow(new CreateParams()
Parent = rightHandPanel.Handle,
Height = rightHandPanel.Height,
Width = rightHandPanel.Width,
X = Y = 0
Form display = formYouWantToDisplay;
display.Show(wnd); //This works because NativeWindow implements IWin32Window
This would require quite a bit of research to work properly I think. Are you sure you don't just want to have an MDI parent, and dock a panel containing a treeview to the left hand side?
For any one interest in this
Here I publish my solution
Object in Form1
tabControl1 (in the right panel of the splitContainer1)
The tabControl does not have any page on design.
The left panel I intent to put a treeView, but for this code, there is a button
button1 (in the left panel of the splitContainer1)
Becaus Microsoft does not provide the Tab control we all use in the IDE, that allow to close a tabpage with an X in the upper right corner, I have no alternative and just use a normal tabControl
Now, in order to destroy the tabpage when closing the form created on each page.
In Form2 I add a button, and the followin code.( this close the form and destroy the tab page.
To make your application run when Windows starts, put it into the Startup folder. I think there are registry keys you can add it to. To make the tray icon, use the NotifyIcon component, and simply show the form with the calendar upon the double click of the aforementioned component. You can actually find a calendar-like component in the .Net Framework - I think it's something like DateTimePicker. Inherit from that, link it to a collection of dates, and you have your calendar. To make the form display on the right hand side of the desktop, set the Dock property of the form to Right
I see. You could theoretically put some code in the Resize event handler to adjust the size and location of the form. Use these equations:
Form.X = Screen.Width - Form.Width
Form.Y = 0
Form.Height = Screen.Height
Form.Width can be anything you want it to be. This will look best if you set the BorderStyle to None
But i want to bound the calender application object added to Windows Desktop Object in such a way that it behave like icons on desktop. so that when all applications in Taskbar are minimized my application still will be visible on desktop
Basic thing i want is access to desktop and put my calender object into that.
Then what you may want is to create a gadget for the Sidebar. This will limit your options to Vista. Alternatively, you could look into shell integration (perhaps a knowledge of COM would help you here) or the ShowInTaskbar property of a form
You can save in one setting entry only one value. From what you are doing, you are trying to save 3 different locations to one setting entry(SavedSetting3) which is wrong. In each loop execution you are overwriting the last set value and hence, the value which is last written (button3 I guess) is the one which is saved. You will need to create 3 different setting's entry to save each of the buttons location.
Your problem lies with the File.Create method. It returns a FileStream instantiation. Until you close the FileStream, you cannot read the file without requesting different access to it. Try something like this
Stream bookStream = new FileStream("books.txt", FileMode.OpenOrCreate);
using(StreamReader booksReader = new StreamReader(bookStream))
//Do what you want with booksReader here, the using block will automatically close the streams to avoid memory leaks
The trick here is creating a new FileStream with FileMode.OpenOrCreate. If the file exists, it is opened; if it doesn't exist, it is created and then opened. If you want to check whether the file is empty (it's pointless reading from an empty file), check whether bookStream.Length is equal to zero. This will also tell you if the file is newly created because the newly created file will be empty
I have written code for client server communication using Tcp and Udp..It works well...I have created a function for the client and called the function from the form1.cs in VS.NET...Now this acts as the client and the server is a separate code..
Now i want both the client and server to communicate...
With a button click i want the message from the client to be sent to the server...So i used a ListBox control in the form...with a button click im able to send message to the server through the socket connection..
Server runs in the console...I am able to send message from the tool i.e client to the console...Once the server the receives the message i require the server to send a message back to the client as an acknowledgement (i.e. the message must be displayed to the listbox control in the form) How do i do this?Please help me out with this.thanks for any help in advance..