|
|
Hi,
I have a label and a tooltip associated with it.
If i hold the mouse over it and after a while the tooltip disappears.
string data = "hello world";
tip = new ToolTip();
tip.AutoPopDelay = 1500000;
tip.InitialDelay = 50;
tip.SetToolTip(this, data);
When i hold the mouse over the label again nothing is shown.
Is there a property or something to make it appear everytime i hold the mouse over
or shall i create the tooltip one more time?
Thanks!
|
|
|
|
|
I think u have not understand all its property. Try updating AutoPopDelay prty.This wil giv u the solution...
Regards
Chintan
www.visharadsoft.com
(I am thinking to change humans to computer, but unfortunately GOD will not give me the source code)
|
|
|
|
|
I've done some googling, but haven't turned up any answers to my questions - can anyone help?
1) My application reads comma delimited records from a file. The read and split is very fast indeed, but after they've been read I need to create objects out of the records, do some validation etc. etc. This can take a while to complete for large record sets. Aha, says I, multiple threads can speed this up.
My plan is to have one thread read the file and then place the returned string array in to a queue. Then as many worker threads as needed can dequeue an individual array in the queue and go off to do its work.
First up - is this a sensible approach, or is it a real stinker of an idea and are there better ways to achieve the same?
2) Is dequeuing thread safe, or could two threads attempt to dequeue the same item in the queue?
3) Are there any guidlines on the number of threads one should spawn for a given processor type? My PC has a Quad Core in it, which I assume means that things really can happen concurrently. My users, however, may well be limited to single core processors which I think will mean that the threads will share processor time - could too many threads in this situation lead to much slower performance as they all vie for time?
Thanks.
Me: Can you see the "up" arrow?
User:Errr...ummm....no.
Me: Can you see an arrow that points upwards?
User: Oh yes, I see it now!
-Excerpt from a support call taken by me, 08/31/2007
|
|
|
|
|
Martin - I'm going to point you towards the excellent SmartThreadPool[^] component here. It will help give you all the information you need to get started.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Magic - thanks Pete.
Me: Can you see the "up" arrow?
User:Errr...ummm....no.
Me: Can you see an arrow that points upwards?
User: Oh yes, I see it now!
-Excerpt from a support call taken by me, 08/31/2007
|
|
|
|
|
martin_hughes wrote: Aha, says I, multiple threads can speed this up.
Even under conditions where it would it might be insignificant.
martin_hughes wrote: could too many threads in this situation lead to much slower performance as they all vie for time?
There are many issues that come into play like overhead for context switching and cache misses etc. Actually two threads could cause that to happen and unless yours is the only process running on a multi processor/core computer (very unlikely it is the only one) it may not get access to more than one core and could also result in reduced performance.
Multi-threading in a single user application is mostly (not always) applicable to keeping the UI from freezing during a long running process like graphics manipulation or interprocess communications, etc. Otherwise threads are mostly useful in a multi-user environment.
|
|
|
|
|
Hi all,
I've written a program where part of it will print a selected file to a printer. This file has tabs in certain places that are crucial to the output not looking wonky.
The output looks wonky. However, if I print it up using something like Notepad, it looks just fine. I'm using a generic filestream/printer handler to do the job. Is there a way for the tabs to be preserved?
Thanks for your time,
Michael Fritzius
OpenFileDialog fdlg = new OpenFileDialog();<br />
fdlg.Title = "C# Corner Open File Dialog";<br />
fdlg.InitialDirectory = @"C:\ ";<br />
fdlg.Filter = "Text files (*.txt | .txt | All files (*.*) | *.*";<br />
fdlg.FilterIndex = 2;<br />
fdlg.RestoreDirectory = true;<br />
if (fdlg.ShowDialog() == DialogResult.OK)<br />
{<br />
textBox1.Text = fdlg.FileName;<br />
}<br />
string filename = textBox1.Text.ToString();<br />
reader = new StreamReader(filename);<br />
verdana10Font = new Font("Arial", 10);<br />
PrintDocument pd = new PrintDocument();<br />
pd.PrintPage += new PrintPageEventHandler(this.PrintTextFileHandler);<br />
pd.DefaultPageSettings.Landscape = true;<br />
<br />
pd.Print();<br />
if (reader != null)<br />
{<br />
reader.Close();<br />
}
-- modified at 14:41 Friday 21st September, 2007
|
|
|
|
|
Well - part of your problem is that you are using the Arial font (which is proportional) and Notepad uses a fixed width font.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Pete O`Hanlon wrote: Notepad uses a fixed width font
by default, but you can choose any available font ...
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I'm not sure if that's going to help, because I'm not wanting to even use Notepad to print up these files. The problem is whenever the file is printed, the tabs that would normally keep things spaced out evenly are replaced with whitespaces.
The printer handler I'm getting ready to show basically takes each line from a file and turns it into something that the printer can understand. It does it line by line but makes no provision for tabs. Can you show me how to modify this?
Thanks for your time,
Michael Fritzius
private void PrintTextFileHandler(object sender, PrintPageEventArgs ppeArgs)<br />
{<br />
Graphics g = ppeArgs.Graphics;<br />
float linesPerPage = 0;<br />
float yPos = 0;<br />
int count = 0;<br />
float leftMargin = ppeArgs.MarginBounds.Left;<br />
float topMargin = ppeArgs.MarginBounds.Top;<br />
string line = null;<br />
linesPerPage = ppeArgs.MarginBounds.Height / verdana10Font.GetHeight(g);<br />
while (count < linesPerPage &&<br />
((line = reader.ReadLine()) != null))<br />
{<br />
yPos = topMargin + (count *<br />
verdana10Font.GetHeight(g));<br />
g.DrawString(line, verdana10Font, Brushes.Black,<br />
leftMargin, yPos, new StringFormat());<br />
count++;<br />
}<br />
if (line != null)<br />
{<br />
ppeArgs.HasMorePages = true;<br />
}<br />
else<br />
{<br />
ppeArgs.HasMorePages = false;<br />
}<br />
}
|
|
|
|
|
I have two applications where appA relies on appB. AppB, I do not have the ability to change the source code on appB. What I need to do is make sure appA terminates before appB when the user shuts down the computer. Is there anyway to make sure this happens?
thanks.
|
|
|
|
|
... hmm, lemme check something...
-- modified at 12:26 Friday 21st September, 2007
Okay, to make sure appA closes before appB the easy way. Just make sure that appA opens before appB. Windows closes processes in the order that they were opened. Well, it seems to anyway.
|
|
|
|
|
A shutdown message is broadcast to the top level window of all applications at the same time. It does not shut them down in the order that they were launched. Actually, if there was any order to it at all, it would be the reverse of the launch order. Last launched would get shutdown first because of dependancies.
|
|
|
|
|
Well i don't know, i just had 2 different aplications show a messagebox in the onClosing event. And whichever one i started first, showed its messagebox first. Unless... if both messages appeared center screen, then the one that started first would have closed last, leaving its message on top... Still, I must admit even if it where the case, it is still unreliable.
|
|
|
|
|
There's no way to do that. The message to shutdown goes out to all applications at once, but there is no way to tell, let alone guarantee, appB will wait for your appA to shutdown before it does.
|
|
|
|
|
You might find a solution in SystemEvents.SessionEnding. I haven't played with it, but it seems like that might work, at least for knowing that log off/shutdown is happening.
It was my understanding that Windows shuts apps down in no guaranteed order, though I'm sure someone will chime in if there is a guaranteed order. It might be as the other reply stated, but I wouldn't necessarily rely upon that.
I'd be interested in what you find out.
Good Luck!
It isn't enough to do well in life.
One must do good when and where one can.
Otherwise, what's the point?
|
|
|
|
|
I need to make this DLL work Hopefully someone can help me.
The errors i'm getting are:
"Cannot find Entry Point.. "(unless I explicitly define the entry point as being #1)
If I explicitly define the entry point, I get the error:
"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Could it be because the function I'm calling calls other functions? If so, how do I fix that?
C++ DLL header..
<code>
extern "C" _declspec(dllexport) BOOL FindUser2(char *cpUserFile,
char *cpPassword,
char *cpUserName,
char *cpUserPriveledge,
char *cpUserID,
char *cpComments,
BOOL *bUserActive,
char *cpErrorReason);
</code>
C++ DLL implementation..
(BOOL is an int)
<code>
extern "C" BOOL FindUser2(char *cpUserFile,
char *cpPassword,
char *cpUserName,
char *cpUserPriveledge,
char *cpUserID,
char *cpComments,
BOOL *bUserActive,
char *cpErrorReason)
{
...
return TRUE;
}
</code>
C# definition
<code>
...
using System.Runtime.InteropServices;
namespace Material_OIT
{
public static class Authorize
{
[DllImport("WN_USER_SECURITY.dll", EntryPoint="#1")]
static public unsafe extern int FindUser2(ref char[] UserFile,
ref char[] Password,
out char[] UserName,
out char[] UserPrivilege,
out char[] userID,
out char[] Comments,
out int UserActive,
out char[] ErrorReason);
}
}
</code>
C# function call..
<code>
char[] UserFile = new char[256];
char[] Password = new char[256];
char[] UserName = new char[256];
char[] UserPriv = new char[256];
char[] UserID = new char[256];
char[] Comments = new char[256];
int UserActive = 0;
char[] ErrorReason = new char[256];
String userFile = @"C:\BSAH_WN\MATERIAL\CELL\FILES\CONFIG\USER_LIST.INF";
userFile.CopyTo(0, UserFile, 0, 51);
string password = "410572537";
password.CopyTo(0, Password, 0, 9);
Authorize.FindUser2(ref UserFile, ref Password, out UserName, out UserPriv, out UserID, out Comments, out UserActive,out ErrorReason);
</code>
-- modified at 13:46 Friday 21st September, 2007
|
|
|
|
|
What does the .dll's definition file, usually a .def file, say about the function?
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
; WN_USER_SECURITY.def : Declares the module parameters for the DLL.
LIBRARY "WN_USER_SECURITY"
DESCRIPTION 'WN_USER_SECURITY Windows Dynamic Link Library'
EXPORTS
FindUser2 @1
|
|
|
|
|
Dio22 wrote: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
I've run into this before and had to really play around with marshalling it. If I can find the code, I'll let you know how it was done.
"Try asking what you want to know, rather than asking a question whose answer you know." - Christian Graus
|
|
|
|
|
|
...if calling Dispose() results in an implicit call to Close(), why do people say that you shouldn't rely on Dispose to Close your connections? Take this code for example:
try
{
if (table != null)
{
using (OleDbConnection connection = new OleDbConnection())
{
connection.Open();
using (OleDbCommand command = connection.CreateCommand())
{
command.CommandText = "SELECT obj From " + table.Alias;
using (OleDbDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
container.Add(new Feature((xx)reader.Getxx(0)));
}
}
}
}
}
}
catch (Exception)
{
MessageBox.Show("There was a GPS Error");
}
What would have priority over a thrown exception such that it HAD to process before a catch was allowed to handle the Exception? Anything? Dispose?
-- modified at 10:54 Friday 21st September, 2007
|
|
|
|
|
It unwinds the stack. The stack is a standard mechanism in computing since the very early days.
So, in other words, it MUST tidy up everything created after the try before it can process the catch.
So the using statements will call Dispose before it gets to the catch block.
|
|
|
|
|
That's exactly what I thought. I was just trying to leave it as open a question as possible to promote other people to share their thoughts.
|
|
|
|
|