|
Well, this happens because the form, normally, won't show itself until the Load event is completed.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have a program that has a form1.cs which calls and starts each thread in the workerthreaded.cs file. While the program is running it fully freezes until it stops. How can you make this so it always runs and the interface can still be used while the code is still running?
|
|
|
|
|
the code is:
<br />
Application.DoEvents();<br />
You can write it before the thread starts...
I hope it helps
Enrico
|
|
|
|
|
|
I have opened a Word Document and done a compare to another document, setting WdCompareTarget to New. Where I am stuck is saving the new document without user interaction.
Here is the code that compares the documents:
WordDoc1.Activate();
WordDoc1.TrackRevisions = true;
WordDoc1.ShowRevisions = true;
WordDoc1.PrintRevisions = true;
object CompareTarget = Word.WdCompareTarget.wdCompareTargetNew;
WordDoc1.Compare(
secondfile,
ref missing,
ref CompareTarget,
ref missing,
ref missing,
ref missing,
ref missing,
ref missing
);
If I do:
object SaveChanges = true;
WordApp.Documents.Close(
ref SaveChanges,
ref missing,
ref missing
);
then the Word Close box comes up and I can specify a name, but I'd like to save to a file specified in a variable. How do I get a reference to the new document?
Thanks ...
|
|
|
|
|
Word.ApplicationClass WordApp;
WordApp = new Word.ApplicationClass();
Word.Document WordDoc2;
Then, after the compare:
WordDoc2 = WordApp.ActiveDocument;
|
|
|
|
|
The program I'm creating allows a user to scroll through a waveform consisting of 10,000+ data points. As the user scrolls through the waveform, a magnified portion of it is displayed on another area of the screen. The magnified portion can plot anywhere from 0 to the entire length of the waveform's points.
Right now I'm having a major refresh slow down when the number of data points for the magnified portion is too large. To plot all of the points I'm using the Graphics.DrawLines() method. To help the performance I also added a Timer (50ms) to limit the number of Invalidate()'s when the user is scrolling, which helps a little bit.
I tried drawing the magnified portion with an offscreen memory bitmap, but it didn't really me.
Can direct draw help me with this in any way?
|
|
|
|
|
Well, you can only plot as many points as the width of your display window for this graph, which is what? 1024 points at most? If you show all 10,000 points, your overdrawing the same column of pixels 10 times before moving to the next one. Figure out how wide your client window is, this will be the number of datapoints you can show. Then do a little math to figure out how many datapoints to skip between adjacent pixels. For example, you'll only look at every 25th datapoint when plotting your graph.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
The magnified portion is plotting a lissajous signal, so the display width isn't a factor. I thought about "skipping" datapoints, but wouldn't that misinterpret the data being displayed?
Thanks for the reply
|
|
|
|
|
I am writing two programs, one in c++ and one in c#. These programs are using windows messaging to talk to each other. In the c++ program, I used this line of code to register the message to send...
UINT MSG_TAKEPICTURE = RegisterWindowMessage("CMD_TAKEPICTURE");
In the c# program I also needed to register the message. I did that with this line of code...
private const int CMD_TAKEPICTURE = 49855;
I got the number from stepping through the c++ code to find what number MSG_TAKEPICTURE was being assigned with. The message transfers worked fine. But when I rebooted the computer, this number changed. Is there a wildcard variable that I need to put in place of the number in the c# code?
Thanks,
Roy K
|
|
|
|
|
From the documentation:
The RegisterWindowMessage function defines a new window message that is guaranteed to be unique throughout the system. So, we're guaranteed a unique UINT , just not the same UINT .
Here's what you can do. In your C# source, include the following code in the appropriate places:
[DllImport( "user32.dll", SetLastError=true, CharSet=CharSet.Auto )]
static extern uint RegisterWindowMessage( string lpString );
CMD_TAKEPICTURE = RegisterWindowMessage( "CMD_TAKEPICTURE" ); Now, your C# and C++ code will have the same value associated with the message name.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
-- modified at 19:42 Friday 25th November, 2005
|
|
|
|
|
Prefect, worked like a charm. This is the second time I have used these boards for a problem that I have had, and the second time a solution surfaced. Many thanks for the fast reply.
Roy K
|
|
|
|
|
Glad to hear that. Happy coding.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
I am currently working on a digramming tool. I have used picture box as the container and have made a control called as the BoxControl...now i wish to make a control that can join teo box control by a line as we do it in Visio..I am drawing a diagram below to elucidate the problem
|||||||||| |||||||||
|BoxCtrl |==========|BoxCtrl| The link shown between the two blocks is what ia m looking 4
|||||||||| |||||||||
It would be great if someone could send a samplecode__otherwise the logic is fine.
Thanks in advance
RaHuL
|
|
|
|
|
I'm looking for a tutorial/primer that will explain the very basics of using Visual Studio, C#, and SQL Express to build applications. I've not worked with databases and c# before - so I'm new to this.
Anyone know of a good place to find this information?
I've been looking, but haven't found anything good. Thanks.
|
|
|
|
|
Let me rephrase that. I work constantly with C#, and I've worked with SQL databases, just not both together. I have a very simple understanding of ADO.NET. I'm most interested in finding out the correct way to use "data sources" via the VS IDE's interface as connections to databases.
I hope that makes sense. Thanks again.
|
|
|
|
|
Hi,
I was wondering.......why so many calls are made to OnPaint method of the Form when ClientRectangle of the button needs to be invalidated.
I was testing some of the vs2005 features and i run a simple test which involved label, button and a call to OnPaint method.
This was done on XP Pro system.
The result was that each time the buttons ClientRectangle needs to be invalidated the Forms OnPaint method gets called. - just moving the mouse, on and off the button would call the Forms OnPaint method.
This happened only when button's style was set to Standard or System, otherwise everything works as expected.
(I used "label.text" to display #of calls to OnPaint( ) )
I've tried other standard vs2005 controls and this intensive (strange) calling of Forms OnPaint( ) manifested itself only with the button.
What am i missing here? Should this be happening?
Seems like a waste of resources.......
-- modified at 16:51 Friday 25th November, 2005
|
|
|
|
|
is there a way i can 'create a new desktop and switch to it' like in the 'winlock' program at http://www.codeproject.com/win32/AntonioWinLock.asp - i dont want to use a dll. is there anything in c# that can do this?
thanks,
sam kline
|
|
|
|
|
C# is just a language. It, and others, like VB or C++, don't have anything that can do any of this. On the other hand, they all have the ability to call the Win32 Library functions needed to pull this off. All you have to do is call (P/Invoke in the .NET world) the necessary functions just like described in the article. If you want more detail, you'll have to dig into his .DLL code to see how it's done, then rewrite that code in C#.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello all.
When I developed apps in C# with Visual Studio 7, and if I wanted to create a connection to a table within a form, I simply used to drag such table from the "Server explorer" window into my form. It created then a SqlConnection and a SqlDataAdapter objects and life was easier.
Now I'm working with Visual Studio 8, and it won't let me drag a table from the "server explorer" window. Does this mean that I will have to code myself the SqlDataAdapters? Is there any possible way of doing what I used to do with VS7? Why Microsoft changed such a good feature?
Thanks a lot,
KK.
One day you'll find
that I have gone,
for tomorrow may rain, so
I'll follow the sun...
|
|
|
|
|
Hello:
Anyone knows how to encrypt a username and password in C#.Net ?
Thanks and appreciate it
|
|
|
|
|
Hello,
How can I encrypt a username and password in C#.net ?
Thanks
|
|
|
|
|
|
Hi Dears!
I need ur help to tackle the following scenario.
I have total two win forms. F1,F2
F1 contains control,Timer,DateTimePicker ,Some text lable
and A pictureBox, all are private.
F2 inherits F1 ( F2:F1) when i call show methed for F2 with its instance all the controls of form F1 are visible on F2 hat i want to keep some of the controls invisble(not inherted and not visble) in inherited form F2.
For Example i want the pictureBox control in F1 to be
(public/private)static and not inhertable ,non visble on form F2. How to do
this?
Thnx in Advance!
|
|
|
|
|
When you inherit a class all your base private members ar hidden. You can not inherit only certain memberber...
Here are some possible resolutions for your problem :
1) make a base constuctor that allows you to specify the hiding of certain controls. Let's say you have a form (F1) with a button. The form which inherits F1 can call a base constuctor to specify this :
public class F1 : ... {
...
System.Windows.Forms.Button button1 = new System.Windows.Form.Button();
...
public F1() {
...
...
}
public F1(bool hideButton) : this() {
button1.Visible = hideButton;
}
...
}
public class F2 : F1 {
...
public F2 : base(true) {
}
...
}
2) Build in the base class an accesor that let's you change the state of certain controls (ie. the visible property of a button as in the previous example)
public class F1 : ... {
...
System.Windows.Forms.Button button1 = new System.Windows.Form.Button();
...
public SetButtonVisibility {
get {
return button1.Visible;
}
set {
button1.Visile = value;
}
}
public F1() {
...
...
}
...
}
public class F2 : F1 {
...
public F2 : base(true) {
SetButtonVisibility = false;
}
...
}
I hope you understand...because is a rough world out there...
|
|
|
|