|
Hi,
I am Serializing an Object by using XmlSerializer but when XML file is created it is including the Namespace details like xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" in the Element.
But I dont want that Namespace details in the XML file.
Is there any way to do this.
Thanks for your help in advance.
Zaheer
|
|
|
|
|
|
i'm trying to make programme bout matrix,i have square matrix 4*4, please tell me how to choose first column and second row ([1][2]) of the matrix
pleeeaaaseee help me
thank you
|
|
|
|
|
Try using a multi-dimensional array. For example, for a 4*4 matrix of integers, use the following 2-dimensional array:
int [ , ] myMatrix = new int [4, 4];
To access a particular element of the matrix (say the first row and second column of the matrix, which is the 0,1 element on the 0-based array), do as under:
myMatrix[0, 1] = 5;
int i = myMatrix[0, 1];
|
|
|
|
|
Hi,
Is it possible to open a form in Modal mode to a Form which is Child to another Form.
I have 3 Forms - AppWindow, ChildWindow and DialogWindow. OnClicking a button in the AppWindow(Application), a ChildWindow is shown with AppWindow as its owner. again a DialogWindow is opened from the ChildWindow Form by using ShowDialog method. Now I need this DialogWindow to be Modal only to the ChildWindow which initialized it and not to AppWindow or any other ChildWindow's.
Can anyone tell me how it is done.
Please excuse my english
Thanks & Regards
Thejus
|
|
|
|
|
A modal dialog is likely to be modal to the application. Perhaps you can simulate modal behaviour for the one form, by keeping the DialogWindow as a variable, and checking if it's visible before accepting any input ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Just like Christian suggested, but try disabling the ChildWindow when the DialogWindow is displayed. There's nothing in Windows or .NET that will allow the behaviour you want, you'll have to simulate it.
Actually modal dialog boxes work by disabling the parent window, and then executing another message loop (that's why the call to ShowDialog blocks.)
I would suggest changing your approach, because the problem is that there is only one message loop for the entire application, so, to achieve what you want, you'd need to display the form as modeless, and disable the ChildWindow so it doesn't accept any input while the DialogWindow is displayed. That might work, but still I don't know how intuitive that would be to your users, since I don't remember any other application in Windows working that way.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
I agree with you. ShowDialog blocks the messageloop until processing of the dialog is complete. but, the ShowDialog method also has a parameter overload to set the parent, cant this be of any help to achieve the behaviour.
If not can you please suggest me how I could simulate the behavior.
Thanks & Regards
Thejusks
|
|
|
|
|
thejusks wrote:
the ShowDialog method also has a parameter overload to set the parent
It's not the parent, but the owner, and it's not exactly the same thing.
thejusks wrote:
how I could simulate the behavior
Both Christian and I suggested already: disable ChildWindow or set a flag, and don't react to input if the DialogWindow is visible.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Hello,
I have my Toolbar control in my base MDI child form. Autosize is true , ButtonSize is 22,22 and Wrappable is false . And in every deriverd form it appears fine.
But I have one rebel form that has a ToolbarButton with style set to DropDownButton (an arrow to the right with a drop down menu.) In this form, the Toolbar is about 6 pixels taller, and no matter what I change, I can't make it the same size as the others (or the others taller.) If I remove the drop down button, everything comes out fine.
In the designer, with drop down button, the toolbar looks the regular height, but once I run the app, it appears taller.
I'm using XP styles.
Has anyone had this problem? any ideas?
-- LuisR
P.S. BTW, in IE there are both types of buttons - the CP toolbar has taller buttons for a 16x16 image, while the Google toolbar has regular-height buttons for the same 16x16 image.
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
I wonder whether the following would explain the reason (at least partially):
I tried to dig inside the disassembler for the System.Windows.Forms.dll file with ildasm. Also tried through a simple project. I started with a button size of 22,22. After clicking on the buttons collection property, in the ToolBarButton Collection Editor, what one notices is that the non-editable value of the Rectangle property for the first button is 0,0,23,22 (meaning that the size is 23,22) if the Style property is "PushButton". However, the moment one chooses the Style property as "DropDownButton", the said Rectangle property immediately becomes 0,0,36,22 (meaning that the size property is 36,22). Thus, a change of Style from PushButton to DropDownButton change the Height of Button from 23 to 36. It appears to be a read-only internal setting, though I am not very sure. I wonder whether this is a partial explanation.
After a slightly deeper research in the disassembler of toolbar class in the said dll file, for example, one notices that in the ToolBar::get_ButtonSize method, the button size is automatically set to either 39,36 or 23,22 depending upon the "Underneath" or "Right" values (respectively) of the TextAlign property of the button. Apparently, something similar is taking place in the internal coding of the said class when the Style property is being changed. Though, I must admit that I could not reach at the proper code after my limited research in the disassembled class structure. Perhaps some more study will reveal the secret of this behaviour.
I really do not know of what help, if at all, the above discussion would be to you...!
|
|
|
|
|
Just as I was finishing the reply, there was a power failure and I lost it all!
So, here's again in a more summarized way:
I also looked at the dissasembly using .NET Reflector, and indeed found the same you did: that the ToolBar.ButtonSize property always returns a fixed size, depending on TextAlign . And neither I could find where the height is changed for a DropDownButton .
Sometime ago I asked here about setting the width of the buttons to be just enough for the text, and not always the same. Looking at the disassembly, there's a ToolBar.ForceButtonWidths internal method that doesn't let the user do that. But also, each ToolBarButton has a Width internal property that returns the calculated minimum width for the button.
This article[^] in MSDN says that all the toolbar buttons must be the same size, but there's the TB_SETBUTTONWIDTH[^] message which lets you set the minimum and maximum width of a button.
Additionaly, the TB_SETUBUTTONINFO[^] message appears to let you set the width through the cx field of the TBBUTTONINFO strucrure (which the .NET ToolBar control uses extensively.) But there's nothing to set the height (maybe TB_SETBUTTONSIZE before adding any buttons could work).
Well, I guess this would make for a great CP article. I'll look into it when I have some free time. For now I should better get back to work.
Thanks for your time!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Hello,
I am trying to find a faster, better way to know when something on the desktop changes. Could be application focus, text being typed, time in the systems tray changes..anything.
Instead of using a screenshot and figuring out the difference. Isnt there a way to tap into the desktop update events? Kinda like you hook into the mouse and keyboard events?
I know there are some custom video drivers out there that vnc uses. But I dont think thats something that can be used in C# affectivly.
Any suggestions or comments?
thanks
Steve
|
|
|
|
|
|
There are many different "events", as you call them, that get "fired" when something on the desktop changes. They're really window messages, but there so many different ones depending on what's going on, that you'll really find it difficult to capture all these changes.
What's the goal here? What are you really trying to accomplish?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks for the replys.
My main goal is to find a faster process to grab screen changes. Instead of using the whole take 2 bitmaps and compare method.
Going through tightVNC's code, they are hooking that video driver then checking the messages for an update, grabbing the region and sending it..genius.
Now if only I could tap into that somehow, my cpu would go down and my process time would be faster.
Steve Welborn
Software Architect
|
|
|
|
|
I have an application that connects to a Web Service.
When I clicked a button to open a form "A", at the same time I stopped the Web Service in IIS - this stopping action raised an event - this event will close all opening forms by calling Dispose() method of each form.
Because the form "A" was processing CreateHanlde() method when it was disposed, it threw following exception:
"An unhandled exception of type 'System.InvalidOperationException' occurred in system.windows.forms.dll
Additional information: Cannot call Dispose() while doing CreateHandle()."
==> How do I solve this problem ?
Giang Nam
|
|
|
|
|
Why is your WebService firing an event to trigger forms to close?
Why are you creating a form only to have it be killed off by this event? Wouldn't it be easier to create the form AFTER the WebService is shutdown? What does this form have to do with the WebService?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
- That's a Chat application.
- Every period of time, I call a method of Web Service to get messages sent to me. This is done by a Timer.
- When the Timer ticks, my application call that method but 'cause the IIS has been stopped, it throws an Exception.
- I catch this Exception and raise an ServerError event, this event will close all opening windows and ask User if he want to relogin.
==> Because, this event disposes all windows while one of them is calling CreateHandle() method, it throws above Exception.
==> That's my problem, thanks for answering me.
|
|
|
|
|
Hi, i want to get the file properties dialog of multiple files to show up in c#; same as if you were to select multiple files in explorer and hit properties. If someone could point me in the right direction id be thankful.
|
|
|
|
|
|
I've had no problem, so far, constructing object and structures that have constructors, however, from past experience, I have encountered struct objects (usualy COM) that do not have constructors.
All their values are initialised to zero, null, etc, by default, and their values are set individualy in public fields.
How would I create a new object of this type via reflection?
With code, i would simply declare a variable of that type and set the values, but this is an entirely different situation.
Cheers
Cata
|
|
|
|
|
Every object has a default constructor, unless it's explicitly made private, in which case, it's designed to be created by a factory method. You'll need to find the method and call it, I'd have thought.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Have a look at RSAParameters in .Net Reflector. The entire struct is just made up of public field members.
No constructors, methods, or properties.
There are a number of these objects that are in the .net library, and i'd like to know how to create an instance. From tinkering with COM i gather most objects of this type are used in marshaling.
And while i'm at it, what about int16/32/64 etc? I know I can parse them from a string but is there anyway to create an instance directly of a particular value?
Cata
|
|
|
|
|
Can anyone suggest how I can capture any packet that is sent from a host? The idea is to not let the packet out into the network, but to capture it, generate our own reply and send it back to the host. If I have the packet, I know how to strip it into the various layers and make a new one to send back. The problem is actually getting the initial packet.
I've looked at sniffer source code but that seems only to look what packets are on the line and not physically take them. Someone said that I should use a NIC in promiscuous mode? As far as I know, a NIC in promiscuous mode will listen to any packets on the network, not just ones destined for its own interface. I only want to capture the packets from the host that the application is running on and not from any other machine on the network. To try make this clearer, when the application is running, the host will not be able to communicate over the network but instead will only be able to communicate to the application.
Any help or pointers in any direction will be greatly appreciated!
Thanks!
|
|
|
|
|