|
Right now your loop doesn't take any time into account and depends upon the speed of your machine. You need to control the opacity. Right now, the loop would probably run so fast that it would appear to jump from 0.0 to 0.5 (or whatever it was) immediately. You need to control the duration. When you're talking about 10 ms or so, the naked eye typically won't catch it. Just think of movies you watch. In the use, it's only 29.97 fps (NTSC) where in other parts of the world it's like 30 fps (PAL) or something. Do you notice each individual frame? if you need 10 iterations and use Thread.Sleep(50) to sleep for 50 ms between each iteration, your fade effect will take only 500 ms like you mentioned a desire for in your first post.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath Stewart wrote:
Just think of movies you watch. In the use, it's only 29.97 fps (NTSC) where in other parts of the world it's like 30 fps (PAL) or something.
Movies are usually 24fps, while PAL is 25fps. Animations like Simpsons are tradionally 15fps, but I suspect that was before CG and computer animation came into play.
top secret xacc-ide 0.0.1
|
|
|
|
|
|
Heath Stewart wrote:
you had one right
Sorry, with movies, I meant film as in the theater, thats 24fps, NTSC (never the same color) is 29.97fps
top secret xacc-ide 0.0.1
|
|
|
|
|
It would, but that would make the fade more 'realistic'. Also call Application.DoEvents() after each call, so the UI seem to 'respond'.
top secret xacc-ide 0.0.1
|
|
|
|
|
You could handle this using a timer in your form. Handle its elapsed event and make gradual changes with each tick, stopping the counter when the opacity reached its min or max. I have done this and it produces no flicker.
Happy Programming and God Bless!
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
I'm looking for a .NET control that implements a "sideways" tab strip or tab control. Basically, like the tab control in Windows Forms, but on the side of the form rather than at the top or bottom. Ideally, text orientation and colors, fonts, styles, etc. should be flexibile.
Anyone know of any such control (free or commercial)?
--Tim
|
|
|
|
|
|
Carlos H. Perez wrote:
Here are some screen shots.
The website is not very friendly for people running on 17" monitors or less.
top secret xacc-ide 0.0.1
|
|
|
|
|
Yes, it is true. The web site will be rewritten in a couple of months.
Carlos.
|
|
|
|
|
How can I make the Combo Box Show all items by code in the Compact Framework?
|
|
|
|
|
when i use telnet to send mail, it occurs error like that
"553 sorry, you have to authenticat first to be able to use this smtp server".
please help me to slove this problem.
thanks...
|
|
|
|
|
Send the proper command to authorize the client, just as the server indicates. If you say EHLO instead of HELO to the SMTP server when you connect, it gives you a list of support authentication modes. You must support one of those and authorize yourself as requested.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
Hi..
I have a listview control on a form..For this i added 3 ColumnHeader's..Later i added few items to this class..When i try to resize these columnheaders all the items in the listview are also getting resized properly..
But my question is when i try to resize any columnheader in the listview control, i want an event to be raised in my code..so are there any default listview events which are raised for this..if not how can i do this..
Thanks in advance..
-Sudhakar
|
|
|
|
|
|
I'm trying to get office automation working, and most things work except working with the Find object. For some reason, every time I try to access the Find object (both through Selection or Range) I find that the Find object is a null reference. If I try to add a watch to my Document and debug, when I expand the Selection then the Find object, my debugger crashes. I am running Office 2000. Trying similar code in VB.NET yields similar results.
The following is a simple Console app that I created to test this. It only requires that the "C:\TestFindReplace\TestDoc.doc" is a valid path with a word doc that contains the text ":FULLNAME:" somewhere. Of course, you can change the filename and path to whatever if you want to test this code. Also, you will need to add a reference to the Microsoft Word 9.0 COM object.
<br />
[STAThread] static void Main(string[] args)<br />
{<br />
Console.Write("Enter the person's name: ");<br />
string fullName = Console.ReadLine();<br />
Console.WriteLine();<br />
FindReplace(fullName);<br />
}<br />
static private void FindReplace(string fullName)<br />
{<br />
object oFileName = @"C:\TestFindReplace\TestDoc.doc";<br />
object oNewFileName = @"C:\TestFindReplace\" + fullName + ".doc";<br />
object oFalse = false;<br />
object oMissing = Type.Missing;<br />
object oReplaceAll = Word.WdReplace.wdReplaceAll;<br />
<br />
Word.Application WordApp = new Word.ApplicationClass();<br />
Word.Document myDoc = WordApp.Documents.Open(ref oFileName,<br />
ref oMissing, ref oFalse, ref oMissing, ref oMissing,<br />
ref oMissing, ref oMissing, ref oMissing, ref oMissing,<br />
ref oMissing, ref oMissing, ref oFalse);<br />
try<br />
{<br />
myDoc.Application.Selection.Find.Text = ":FULLNAME:";<br />
myDoc.Application.Selection.Find.Replacement.Text = fullName; <br />
myDoc.Application.Selection.Find.Execute(ref oMissing,<br />
ref oMissing, ref oMissing, ref oMissing,<br />
ref oMissing, ref oMissing, ref oMissing,<br />
ref oMissing, ref oMissing, ref oMissing,<br />
ref oReplaceAll, ref oMissing, ref oMissing,<br />
ref oMissing, ref oMissing);<br />
myDoc.SaveAs(ref oNewFileName, ref oMissing, ref oMissing, ref oMissing,<br />
ref oMissing, ref oMissing, ref oMissing, ref oMissing,<br />
ref oMissing, ref oMissing, ref oMissing);<br />
}<br />
finally<br />
{<br />
WordApp.Quit(ref oMissing, ref oMissing, ref oMissing);<br />
}<br />
}<br />
Is anyone getting behavior like this? Does this code work for anyone else?
|
|
|
|
|
That's because the Find object isn't part of a Document object (at leat in Word 2003). It should look more like this:
object oFileName = @"C:\TestFindReplace\TestDoc.doc";
object oNewFileName = @"C:\TestFindReplace\" + fullName + ".doc";
object oFalse = false;
object oMissing = Type.Missing;
object oReplaceAll = Word.WdReplace.wdReplaceAll;
Word.Application WordApp = New Word.ApplicationClass();
Word.Document myDoc = WordApp.Documents.Open(ref oFileName,
ref oMissing, ref oFalse, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oFalse);
try
{
Word.Find fnd = WordApp.Selection.Find;
fnd.Text = ":FULLNAME:";
fnd.Replacement.Text = fullName;
fnd.Execute(ref oMissing,
ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing,
ref oReplaceAll, ref oMissing, ref oMissing,
ref oMissing, ref oMissing);
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Unfortunately, I get the same error. I'm using Office 2000 and I suspect that it might be a problem with this version of office. I had a co-worker with the same PC configuration run this app and he got the same error.
I'm leaving for two weeks of vacation tomorrow, so I'll have to put this issue on hold until I'm back. Thanks for your help!
|
|
|
|
|
Hi
We have a system which is written in C++/MFC but I have just written a support tool in C#/.NET.
This is all new to me and we need to be able to show an already running copy of the app from the C++ system.
We were going to use FindWindow() from MFC, but would prefer to set the class name rather than just rely on the window caption. However I cannot find any equivalent to RegisterClass() in .NET and if I set CreateParams.className the .NET app blows up with an 'Invalid Windows class name' exception.
Does anyone know how to set/register the class name so we can uniquely identify our support app?
|
|
|
|
|
Every control is already given a class name. Use Spy++ from the Platform SDK (installed with Visual Studio in default installs) to determine what that class name is.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks for the quick reply.
I have tried Spy++, but every .NET app I have written seems to have the following class name "WindowsForms10.Window.8.app1".
Is it possible to override the automatically generated name or supply some string which will be used as part of the automatically generated name?
|
|
|
|
|
If you examine the child windows, you might notice a pattern: WindowsForms10.ClassName[.8].appN . You can change the class name for a window but you have to register it first, which means you must P/Invoke RegisterClass , which of course means you have to define the WNDCLASS struct in managed code (with proper byte alignment and marshaling). You could then use this window class in your override to CreateParams .
[DllImport("user32.dll")]
private static extern ushort RegisterClass(ref WNDCLASS lpwcx);
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
private struct WNDCLASS
{
public UIntPtr style;
public WndProc lpfnWndProc;
public IntPtr cbClsExtra;
public IntPtr cbWndExtra;
public IntPtr hInstance;
public IntPtr hIcon;
public IntPtr hCursor;
public IntPtr hbrBackground;
public string lpszMenuName;
public string lpszClassName;
}
private delegate IntPtr WndProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam); Of course, you must provide it with all the data necessary. The WndProc delegate should point to Control.WndProc , and the other data you can marshal from various properties of the Form or any other Control derivative. Use the Marshal class for assistance if necessary.
Once you've done that, the final window class would most likely be WindowsForms10.YourClassName.appN .
Another option you could consider is using global memory.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi to all,
I am trying to change a boolean field in an Access database table.
<code>
DataRow[] selectRows = dscurr1.Tables["currlist"].Select("curr='true'");
foreach (DataRow myRow in selectRows)
{
idx = Convert.ToInt32(myRow["notableID"]);
}
</code>
This locates the index to the row that has the only boolean True row in this small table, but now I need to change it to False and realize I need to use an indexer to the DataRow but am lost as to how it should be laid out syntacically.
Regards,
Bill Antonacchio
|
|
|
|
|
Just use myRow["curr"] = false . If this isn't what you're asking about, please rephrase your question.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|