|
I need to show dialog box sliding from beneath the title bar or a toolbar if there is any, in the form. I have searched in this website and saw dialogs sliding from the edges(top or bottom) of the form. How do I provide the same effect by making the dialog slide from below the title bar. How can I make the upper portion( that is yet to be shown by sliding) invisible in this case. Any ideas would be greately appreciated.
Thanks,
|
|
|
|
|
Perhaps you can try using a collapsible splitter as suggested in this article:
http://www.codeproject.com/cs/miscctrl/collapsiblesplitter.asp
|
|
|
|
|
Hai ekynox,
Thank you for the idea. I will try and see if that works for me.
VPMahank.
|
|
|
|
|
Does anybody have any telnet protocol in csharp other than what I found here. I would like to see more examples of telnet protocol.
|
|
|
|
|
I am trying to send serial data at a very high rate (18 bytes every 5 msec). I am using a multimedia timer to get the 5msec and the built in Serial port object in the .NET 2.0 framework. I am using the begin and end write calls to do asyncronous writes in order to keep up. This seems to be working, but when I look at the memory usage for my program it is gradually going up and when I run for over 5 hrs I use all of the system memory and my program crashes. Does anyone know if there are known issues with the Serial Port object or of any way to do this without causing the memory to go up? Any help with this would be great, thanks.
|
|
|
|
|
my bet would be more on your code design with the Async calls than a flaw in the framework. Make sure you arent starting multiple async receives for the same operation and you are accepting all your callbacks.
c#guy
|
|
|
|
|
Thanks for the response, I will look into it.
|
|
|
|
|
I am still not able to fix this problem. Here is the call to write the data to the serial port
serialPorts[3].BaseStream.BeginWrite(attArray, 0, 18,new AsyncCallback (myWriteCallBack),serialPorts[3].BaseStream);
myWriteCallBack is declared as
public static void myWriteCallBack(IAsyncResult ar)
{
System.IO.Stream mySerialStream = (System.IO.Stream)ar.AsyncState;
mySerialStream.EndWrite(ar);
}
Any help would be great! Thanks.
|
|
|
|
|
I have recently started to used Microsofts FxCop to validate code:
http://www.gotdotnet.com/team/fxcop/[^]
If you havent come across this application before, it is a code analysis tool that validates assemblies for conformance to Microsofts .NET Framework design guidelines.
So far prooved itself to be incredibly useful and in some situation informative. That being said there is one item is raises alerts on that I dont necessarily agree with.
If Ref/Out parameters are used FxCop raises the following alert:
"Using out parameters might indicate a design flaw. Although there are legitimate times to use out parameters, their use frequently indicates a design that does not conform to the design guidelines for managed code."
http://www.gotdotnet.com/team/fxcop/docs/rules.aspx?version=1.32&url=/Design/AvoidOutParameters.html[^]
Each alert has an associated webpage (link above) which seems to inidcate that the main problem is that usage of ref and out is not widely understood and should therefore be avoided. Reading between this lines this says to me that if somebody working with the code is unlikely to understand usage then it should be avoided. IMHO if somebody is working on the code and is unlikely to understand then they should learn.
Anyway, I should step away from that rant, what is your opinion of using ref/out parameters?
|
|
|
|
|
They're useful when you want to return more than one result, and where the results are of different types. Using output parameters in this situation is the only way to keep strongly typed return values.
Ref parameter are useful if you want to modify a value type or modify the object referred to in the argument. I find the latter sometimes difficult to keep your mind wrapped around, so I try to avoid situations where I need to pass a ref to a reference type.
It seems to me there are some FxCop rules that are little more than generalized suggestions, and need to be taken with a grain of salt. It seems this rules is a good example; rule is probably the wrong word in this case, after all, there are many places in the framework class library where ref & out are used.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Bought a House!
Judah Himango
|
|
|
|
|
Judah Himango wrote: It seems to me there are some FxCop rules that are little more than generalized suggestions, and need to be taken with a grain of salt. It seems this rules is a good example; rule is probably the wrong word in this case, after all, there are many places in the framework class library where ref & out are used.
Some great examples of this are
<br />
bool Int32.TryParse(string value, out int parsedValue)<br />
bool Dictionary<Key,Value>.TryGet(Key key, out Value value)<br />
These exist for performance reasons and are IMHO completely valid and intuitive to use. I can understand why users find the idea of out/ref params to be confusing but the wording of this rule could be a little bit better.
Jared Parsons
jaredp@beanseed.org
http://spaces.msn.com/members/jaredp/
|
|
|
|
|
One of the reasons why out parameters are bad is that they are often a variation of the "primitive obssession" anti-pattern. If it occurs often, it's a symptom that a class is missing on your design.
From the Churchdown Parish Magazine: "Would the Congregation please note that the bowl at the back of the Church, labelled 'For The Sick,' is for monetary donations only."
|
|
|
|
|
FxCop generally gives good advice, so also in this case. There is very seldom any need for out or ref parameters. When they are used it's sometimes for performance reasons but mostly out of laziness.
The ones that don't understand why FxCop alerts on this, is the ones that are most likely to misuse out or ref parameters. If you don't know why you shouldn't use it, you can't tell when it would be acceptable.
MrEyes wrote: IMHO if somebody is working on the code and is unlikely to understand then they should learn.
Thankfully the framework is not designed under that philosophy.
---
b { font-weight: normal; }
|
|
|
|
|
Hi all !
I've got a problem : I created a custom control, which contains a textbox. At runtime, when I click inside the textbox, the "GotFocus" event of my customcontrol is not fired. So, I would like to add method to handle the textbox's GotFocus event, and then fire the GotFocus event of my Custom Control, so it can be handled in the application that use it ...
Or, the GotFocus event is inherited from the Control class, and I can't find the evenhandler to call ... How can I achieve this ?
Thanks !
Stéphane
|
|
|
|
|
hi!
you can add an eventhandler for gotfocus event on your textbox then on that handler, you can call the OnGotFocus protected method of your custom control.This will trigger the GotFocus event of your custom control.
<br />
private void textbox_gotfocus(object sender, EventArgs e)<br />
{<br />
OnGotFocus(e);<br />
}<br />
Or instead of calling the protected method, you can shadow the event then manually trigger it on the eventhandler of your textbox.
<br />
public new event EventHandler GotFocus<br />
<br />
<br />
private void textbox_gotfocus(object sender, EventArgs e)<br />
{<br />
if (GotFocus != null)<br />
{<br />
GotFocus(this, e);<br />
}<br />
}<br />
<br />
hope this helps!
|
|
|
|
|
This works so fine ! Thank you so much !
|
|
|
|
|
okidoki! No problemo!
|
|
|
|
|
hi,
what is an UNREACHABLE object?
thnx.
|
|
|
|
|
An object that cannot be reached.
eg, you may have a return statement before a call to new MyObject() - in which case the instance of MyObject could be considered "Unreachable"
|
|
|
|
|
An instance that cannot be accessed on any code path. Basically, an object that has no references to it or has fallen out of scope.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I'm using System.Net.WebClient to download HTML from Google's translation page. However, when I do that, the text downloaded is losing international/accented characters. I tried all of the various Encodings. UTF8 is the most promising of all. Unicode only has garbled characters.
System.Net.WebClient wc = new System.Net.WebClient();<br />
string url = "http://translate.google.com/translate_t?text=Hello World&langpair=en%7Czh-CN";<br />
byte[] bytes = wc.DownloadData(url);<br />
string data= System.Text.Encoding.UTF8.GetString(bytes);
The same code works (e.g. all the characters are preserved) if I substitute "en%7Czh-CN" (English to Chinese) with "en%7Cfr" (English to French).
I also tried the solution from http://www.eggheadcafe.com/articles/20050725.asp[^] but even that has the same results.
I'm displaying my string data in a multi-line textbox with Arial Unicode MS font -- which does support displaying of these characters. The textbox shows the text properly if I manually copy and paste the Chinese characters from Google's webpage into my program.
Any suggestions / tips?
Thanks much.
- Malhar
|
|
|
|
|
Hi,
I have a datagrid, and when I click on a cell, the backcolor and forecolor change while the mouse is still down. When I release the button, it turns back to normal. Is there any way to avoid the color change?
Thanks!
Mel
|
|
|
|
|
hi melanieab!
what do you want to avoid, changing its color when the mouse is down? if ever, i suggest that you just make the selectionbackcolor and selectionforecolor same as the backgroundcolor and forecolor properties.
hope this solve your problem!
-- modified at 22:58 Monday 19th December, 2005
|
|
|
|
|
Hi!
The problem is, I do have selectionforecolor and selectionbackcolor the same as forecolor and backcolor. When I let go of the mouse, the selected row is how I want it to be, it's just during the mousedown where the background and text turn what look like some default colors (control). And it's only the first time that I click on the cell that this happens. If I continue to click on it (without clicking on another cell in the meantime) the colors are just the way I want them to be.
Any ideas??? At the moment, I'm trying to make a whole new custom datagrid in the hopes that it won't have this issue. But it's going slowly, and I don't even know if it will work.
Mel
|
|
|
|
|
Currently, I am working on an OCR solution where a camera push video frames into the application. One task is template matching where I try to find a bitmap within a bitmap.
1)Is template matching worth the work related to performance (Resolution 1024x768 - 24 Bit)?
2)Are there any information or resources for this subject on the web? Google show only rare information about it.
thx
|
|
|
|