|
How does one detect the current control the mouse cursor is over when one does a mouse button down and move? It appears that the control when the move started repeatedly fires its mouse move event but other controls are ignored. Do i have to do some kind of hit test? What is typically done in C#?
|
|
|
|
|
Greetings,
I'm in .NET 2.0
I'm working on an app where the Main Form contains a webBrowser Control. I do not want to show the Main Form until the document has completed loading in the web browser control or until 60 seconds has passed...in which case, I will then load an offline version.
The webBrowser control has a DocumentCompleted event. So that I know if it has finished loading. The problem is, I need to Load the url for the webBrowser control on a separate thread, and then loop for 60 seconds on the GUI Thread, or Until Ive been notified that the document has loaded. I have tried something like this....but I think the problem is that the webBrowser Control belongs to the GUI Thread.
public frmMain()
{
ThreadStart ts = new ThreadStart(DoWork);
Thread thread = new Thread(ts);
thread.Start();
for (int i = 0;i<60;i++)
{ if (m_documentLoaded)
{
i = 60;
}
else
{
System.Threading.Thread.Sleep(1000);
}
}
}
public void DoWork()
{
System.Uri url = new System.Uri("http://myDomain.com/default.aspx/");
webBrowser1.Url = url;
}
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
m_documentLoaded = true;
}
I know what I want to Do...just not sure exactly how to carry it out...
Thanks for any input
|
|
|
|
|
Create a timer on your form with interval set to 60 seconds. Load the browser page on the UI thread, start the timer. When the timer tick event has been raised, check if m_documentLoaded is true, and if not, load the offline version.
|
|
|
|
|
Excellent.... once again...I was overthinking.
Thanks
|
|
|
|
|
Hi, I am using recursion to search for a folder in searchPath and if a subfolder or the searchfolder is the same as saveFolder(the
folder to copy the files to), it skips searching file in the saveFolder. Other than that, it keeps searching the file recursively and calls the
method this.SearchFile(..)
This obiviously fails to build because I didn't assign anyting to 'string folderName' and breaks the logic.
Can anyone please correct this method?
saveFolder path is at saveTextbox.Text
public void GetsubFolders(ref string searchPath, string fileName)
{
string[] folder = Directory.GetDirectories(searchPath);
string folderName;
int index = 0;
if (folder.Length !=0)
{
if (String.Compare(folder[index].ToString(), saveTextbox.Text.ToString()) == 0)
{
index++;
if (folder.Length == index)
{
return;
}
else
{
for (; index < folder.Length; index++)
{
folderName = Convert.ToString(folder[index]);
GetsubFolders(ref folderName, fileName);
}
}
}
else
{
for (; index < folder.Length; index++)
{
folderName = Convert.ToString(folder[index]);
GetsubFolders(ref folderName, fileName);
}
}
}
this.SearchFile(folderName, fileName);
}
|
|
|
|
|
How can I send a struct/class from client to server by using tcp/ip in c# ?
|
|
|
|
|
Hi TJVictor
Have a look at .Net remoting. I think that's the technology you're looking for.
For example:
http://www.codeproject.com/csharp/DotNetRemotingBasicTutor.asp[^]
Kind regards - Jakob
*********************************************
Three kinds of people in the world:
- Those who can count..
- Those who can't!
10 kinds of people in the world:
- Those who understand binary
- Those who don't
|
|
|
|
|
I have read a lot of books on C#, but what I am ultimately looking for I have yet to find. 1st I would like a book on explaining good practice of creating classes and explains inheritence. Next, I would like a desk reference, with good explanations and examples ( unlike MS Documentation ) for C#.
Thanx in advance
Jude
|
|
|
|
|
I am dynamically connecting to an unmanaged C++ COM interface using GetTypeFromProgID, but I must get a secondary IDispatch interface by calling the "GetBasicCallInfoIDisp" function of that interface. Using this secondary interface, I am trying to get a simple property.
The JavaScript is very rudimentary:
var winoperdoc = new ActiveXObject("WinOper.Document");<br />
var winoper = winoperdoc.GetBasicCallInfoIDisp();<br />
window.alert(winoper.SeizureID);<br />
The C# version I have looks like this:
Type objWinOper = Type.GetTypeFromProgID("WinOper.Document");<br />
<br />
object objWinOperLateBound = objWinOper.InvokeMember("GetBasicCallInfoIDisp",<br />
BindingFlags.CreateInstance,<br />
null, <br />
objWinOper, <br />
new object[]{});<br />
<br />
int SeizureID = (int) objWinOper.InvokeMember("SeizureID",<br />
BindingFlags.Default | BindingFlags.GetProperty, <br />
null, <br />
objWinOperLateBound,<br />
new object[]{});<br />
This compiles, but I get an "Unknown Name" when I try to get the value from a member property.
Any help is appreciated.
Cheers,
Daaron
|
|
|
|
|
- how I can add more image in pictureBox ?
- how I can move image in pictureBox with mouse ?
|
|
|
|
|
You cannot add more than one image to a picture box. You can, however, add multiple picture boxes to another control such as a panel.
The picture box control doesn't contain any functionality for moving pictures within it. You can do this yourself by watching for when the user drags the mouse, then move the picture box itself.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Is Jesus the Jewish Messiah?
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
hi
codeproject is best .
i want to embedd one or more exe files in my app as resource and use it programmatically ..
how to do that ?
|
|
|
|
|
|
|
Boo! Do your own homework. The only way to become a good developer is by solving problems on your own. Do you know what companies do with people who don't do their own work...they promote them! But that's beside the point...
Josh
|
|
|
|
|
Josh Smith wrote: Do you know what companies do with people who don't do their own work...they promote them!
Oh god he is telling the truth...Take my 5
|
|
|
|
|
http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.2
|
|
|
|
|
Is it possible to open Shared Memory in a C# Windows application? specifically, Shared Memory created in a C++ app using the CreateFile, CreateFileMapping API.
(& if it is possible, can I get a hint where to start looking for the "instructions"?)
|
|
|
|
|
|
I used the flwing code to focus a control. But i got nothing. why?
private void button1_Click(object sender, EventArgs e)
{
if (lst1.Items.Count > 0)
{
lst2.Items.Add(lst1.SelectedItem);
lst1.Items.Remove(lst1.SelectedItem);
}
if (lst1.CanFocus)
{
lst1.Focus();
}
}
rgds,
stephen myint
|
|
|
|
|
There is an design paradox here: To have this event, you need to click the buttom which forces the focus onto the button. If it was anywhere else, you wouldn't be able to click the button.
You don't want things stealing focus while doing various operations (like clicking, drag-and-drop, etc) anyway. You should consider another UI design instead of trying to have focus jump around on the form while performing user input.
|
|
|
|
|
Use the form's Select() method or ActiveControl property instead.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
U can use Javascript client side scripting for setting focus
"Aim to go where U have never been B4 and Strive to achieve it"
http://groups.yahoo.com/subscribe/dotnetforfreshers
http://himabinduvejella.blogspot.com
|
|
|
|
|
Hello,
I want to add names coming from my database to be coupled to the Text of buttons.
The number of names is variabel (depending on grade of filtering).
So I wanted to build a loop for adding the names to the Text of the buttons.
<br />
for(i = 0; i < total; i++)
buttoni.Text = "corresponding name from tabel";<br />
The "corresponding name from tabel" is no problem, but I want the i from the for-loop to be used in the variabel name for the assignement of the text. (which you see very hard-coded in the code)
But I always get errors, no matter what i try ..
Can somebody help?
Allready thanks!
-- modified at 11:07 Wednesday 3rd May, 2006
|
|
|
|
|
What errors do you get?
Please read this
--------------------------------------------------------
My portfolio & development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|