|
Why should a MenuItem derive from Control ? A MenuItem simply encapsulates an HMENU (menu handle) and the related Windows APIs - it is not a control nor does it even act like the control. There's no good reason that it should derive from a control.
Read the Platform SDK for more details.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
i am working on n tier application and got 3 projects on my soloution.
in the end i just supply dll file.
the upper layer is a test one and its not part of the dll that i have to supply. i want to use the App.config file and i dont want him to be at the test layer(because its not part of my dll), i want to create the app.config file at the middle layer(which is my Data access layer).
The problem is that when i am creating the App.config file at a project that is not set as startUpProject i cant read from him or write.
the only way i can read from the App.config is when i am creating him under the StartUpProject.
How can i use an App.config file for my entire Project(3 projects) and not to put him under the StartUpProject and after all i will be able to use it ofcoures
thanks
Dudi
Be Good...
Dudi
|
|
|
|
|
Only .exe's and ASP.NET web applications automatically read from a .config file. The app.config file has to be in the same directory and named the same (plus .config at the end) as the executable file. DLLs do not automatically have their own .config files unless you create your own executable loader (not an easy thing) or create a new AppDomain with a separate .config file just for a DLL.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hey,
So i'm working on this form that fades in and out depending on when it's active or not. Essentially it's a for loop that just iterates the opacity value of the form up to the desired value.
for(float f = 0.0f; f < 0.5f; f += 0.05f)
{
this.Opacity = f;
}
The problem is, this is really slow and flickery. I'm hoping to get something around the speed of the fading in and out of Winamp 5, if you all have seen that. something along the lines of 100-500ms, or even < 1s, but still have it look smoothe and not flicker so much. Any suggestions? I mean will DirectDraw do what I want? Thanks.
-- Adam
"If you can't beat your computer in chess, try kickboxing"
|
|
|
|
|
Through a Thread.Sleep in the loop taking into account the duration of the effect and the number of iterations required.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Wouldn't that make the fade longer?
-- Adam
"If you can't beat your computer in chess, try kickboxing"
|
|
|
|
|
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!
|
|
|
|
|