|
As Judah Himango Said:
Download managed DirectX 9 SDK.
Add a reference in your project to Microsoft.DirectX.AudioVideoPlayback.
Video.Play("someFile.mpg");
|
|
|
|
|
Hi Everyone,
I want to make a program in which multiple "same" taskbarnotifier(Image) appears at same time looks like MSN messager. When multiple user login on MSN Messager at a same time a pop window(Image) appears right hand side(On the window Screen) "one by one".
I have already created multiple different Image.
Can you help me out.
Thanks
|
|
|
|
|
How do you add HTML (and their corresponding image files) to a solution and code a browser control to open them? I've added a new folder to the solution and placed the html and image files into it, however, I don't know if this is the correct way to add these files to a solution or how to open the html in the browser once they are added. Any help would be much appreciated.
C.S.
|
|
|
|
|
I have to implement two controls - MyPicture (extends PictureBox) and MyLabel (extends Label). They both have the same additional properties and fields, and the properties do the exact same thing in both these classes. Each property calls Invalidate methods. Both classes have a constructor which puts some default values to the fields, and override the OnPaint method.
Now the problem is: how would you implement this hierarchy in C#? I'm quite new to C# and OOP and I am not fully accustomed to it. I know I can inherit from one class and implement many interfaces. But the additional properties cannot be an interface becouse it contains fields and I would have to write exactly the same code in both classes.
So my request is - how would yopu implement this hierarchy?
|
|
|
|
|
ICustomTypeDescriptor wrote:
Now the problem is: how would you implement this hierarchy in C#?
In C++, this might be a candidate for multiple inheritence. With C#, interfaces are a poor substitute, because as you say, you end up writing the same code in both classes.
However, you still may want to use an interface so that some other class can utilize your specialized class' methods and properties. So, to avoid duplicating the same code, you write a class that implements the functionality, and the classes that implement the interface instantiate the helper class and call its methods.
Does that help?
Marc
MyXaml
Advanced Unit Testing
YAPO
|
|
|
|
|
|
Well, I think I can't instantiate one of the classes and call its methods. So I have to double the code?
So I have another question - it happens to be a DLL, so is it possible to write the dll in Managed C++, using multiple inheritance, and then use it in C#?
|
|
|
|
|
I have a process that starts and runs MS Word for about 10 seconds. Sometimes Word seems to hang; it stays open for 'ever'. Is there an way that I can run a process2 independently of process that checks to see if Word is running and if it is, if it has been open for about a minute, and if it has, to stop it? Thanks in advance.
|
|
|
|
|
You can do the following. Run the follong code to see if MS Word is running and if it is it will kill the process.
using System.Diagnostics;
private Process[] WordProcessList;
.....
int index;
WordProcessList = Process.GetProcessesByName("WINWORD");
for( index = 0; index < WordProcessList.Length; index++)
{
WordProcessList[index].Kill();
}
|
|
|
|
|
How to develop a dropdown list like control from scratch.
|
|
|
|
|
Just atextbox and a flat button in the right and some other textbox without border to actlike the list.
|
|
|
|
|
yes, but when i tried to do that, the text box is not overlaping on to other controls on the form. and when i use the control inside a panel/group box the part of the textbox which is out of the panel is not visible?
is there anyway to avoid that??
|
|
|
|
|
Just try BringToFront(); method of this textbox
|
|
|
|
|
it doesn't help since the parent of the textbox used as a list is the control not the form! when BringToFront() is used it brings the textbox to the front of the control but not the form on which the contol is? currently i have a work around which changes the parent of the textbox and positions it so that it aligns with the rest of the control. it works.
the problem is i don't want to change the parent of the textbox just to draw it on top of the z-order
|
|
|
|
|
I downloaded a project in C# and would like to compile it. There is no project or solution file available, so, I created a new project and put everything there.
PROBLEM:
There are many files stored in different sub-directories (of the project directory). The files in each directory belong to the same namespace.
For example :
In Main.cs of the project directory contains:
using ABC.namespace1
using ABC.namespace2
and in the directory {project dir}/ABC/namespace1, there is a bunch of class files declaring as: namespace ABC.namespace1
MY QUESTION:
Do I need to copy all the files of the sub-directories to the project directory to compile it or there is a setting in Visual Studio that allows this. Right now, when I tried to compile it, I got the message:
"The type or namespace name 'namespace1' does not exist in the class or namespace ABC. Are you missing assembly references ?"
Thanks a lot for any help
|
|
|
|
|
It may be a .dll with it and then you may have a reference first to it.
|
|
|
|
|
i want to write to program for uploading file to webserver, but i don't know the mechanism of uploading file
Show me detail if you can
Thank you
|
|
|
|
|
You could use something simple like the following:
WebClient <code>Client</code> = new WebClient();
Client.UploadFile("http://www.MyWebsite.com/index.aspx", "C:\MyFile.aspx");
Note: You should also consider providing checkups for your upload mechanism (such as checking if the file does exist, or that its contentLength is greater zero).
Hope this helps
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
Hi,
Should I use TableLayoutPanel for my Form with FixedDialog style?
I can't understand when i need in TableLayoutPanel.
Best regards.
|
|
|
|
|
You should use TableLayoutPanel when you want your controls laid out in rows and columns.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Horrific Minnesota Radio
Judah Himango
|
|
|
|
|
Hi,
I want to ask how to execute a static function in a user created application domain. I am trying to run following sample code. But it seems that the method that I am trying to execute in my created domain always executed in the default created domain (caller domain).
public void ExitProcessTest()
{
string applicationTitle = "ApplicationToBeKilled";
Assembly asm1 = Assembly.GetAssembly(typeof(OSP.Forms.ErrorBox));
AppDomainSetup ads = new AppDomainSetup();
ads.ApplicationBase = @"file:///C:\Components.NET\Testing\TestProject\bin\Debug\";
ads.PrivateBinPath = AppDomain.CurrentDomain.BaseDirectory;
ads.ApplicationName = applicationTitle;
AppDomain newappDomain = AppDomain.CreateDomain(applicationTitle, null, ads);
Assembly asm = newappDomain.Load(asm1.FullName);
Type type = asm.GetType("OSP.Forms.ErrorBox");
type.InvokeMember("ExitProcess", BindingFlags.Public | BindingFlags.Static | BindingFlags.InvokeMethod, null, null, new object[] { applicationTitle });
Thread.Sleep(15000);
}
public static void ExitProcess(string applicationTitle)
{
//It's better to close the application, otherwise, could throw many other errors
try
{
ApplicationTitle = applicationTitle;
Thread exitThread = new Thread(new ThreadStart(ApplicationExitThread));
exitThread.Name = "ExitThread";
exitThread.Start();
}
catch (Exception exc) { ShowError(exc, "Osp.Shared", null, "script_error@etb.bel.alcatel.be"); }
}
private static string ApplicationTitle;
private static void ApplicationExitThread()
{
try
{
Form f = new Form();
f.TopMost = true;
f.Size = new Size(370, 60);
f.BackColor = Color.Red;
f.FormBorderStyle = FormBorderStyle.None;
Label lbl = new Label();
lbl.BorderStyle = BorderStyle.FixedSingle;
lbl.ForeColor = Color.White;
lbl.Font = new Font("Verdana", 10, FontStyle.Bold);
lbl.TextAlign = ContentAlignment.MiddleCenter;
lbl.Dock = DockStyle.Fill;
lbl.Text = "The " + ApplicationTitle + " will exit in few seconds.\nSorry for the inconvenience.";
f.Controls.Add(lbl);
f.StartPosition = FormStartPosition.CenterScreen;
f.Show();
f.TopMost = true;
f.Invalidate();
f.Update();
Thread.Sleep(1000);
for (int i = 5; i > 0; i--)
{
lbl.Text = "The " + ApplicationTitle + " will exit in " + i + " second" + (i > 1 ? "s" : "") + ".\nSorry for the inconvenient.";
lbl.Update();
Thread.Sleep(1000);//to ensure the error mail is sent!
}
//Process.GetCurrentProcess().Kill();
MessageBox.Show(AppDomain.CurrentDomain.FriendlyName);
}
catch (Exception exc) { ShowError(exc, "Osp.Shared", null, "script_error@etb.bel.alcatel.be"); }
}
|
|
|
|
|
Hey
I'm trying to find a way to get the name of a file in a FileInfo object.
I DO NOT mean this:
out of, c:\blabla.exe --GET--> blabla.exe
BUT this:
out of, c:\blabla.exe --GET--> blabla
anyone can help me with this???
|
|
|
|
|
|
Thanks!
that could really make my life easier!!! (I wrote this code in the hard way!)
|
|
|
|
|
I wrote my first own control, it derives from Windows.Forms.Control, and it's a simple ellipse label. The code for drawing:
<br />
protected override void OnPaint(PaintEventArgs pe) {<br />
Graphics g = pe.Graphics;<br />
Brush foreBrush = new SolidBrush(ForeColor);<br />
Brush backBrush = new SolidBrush(BackColor);<br />
g.FillEllipse(backBrush, ClientRectangle);<br />
<br />
StringFormat fmt = new StringFormat();<br />
fmt.Alignment = StringAlignment.Center;<br />
fmt.LineAlignment = StringAlignment.Center;<br />
g.DrawString(Text, Font, foreBrush, ClientRectangle, fmt);<br />
<br />
base.OnPaint(pe);<br />
}<br />
}<br />
The question - how to implement so that the label wraps text if it is to long to fit in a single line?
|
|
|
|