|
|
Ok, I have a listview and a treeview. Gif's are being dragged from Listview and borught over to the treeview. I have managed to create a Ghost icon of the GIF when the user clicks on the picture, but the problem I have is that when drag starts, the ICON changes from the ghost icon to the default NO cursor. When it gets in the treeview, its the drag icon.
Can someone suggest as to where I may be going wrong. I can obviosuly post codes snippets, butI am not sure it will be of any help. Its something more basic as to the dragdrop effects that I am not setting.
I mean the drag drop works, the Ghost ICON, would be the icing on the cake.
Thanks for any input.
Sameer
|
|
|
|
|
Could it be because your ListView does not have the
AllowDrop<code> property set to true? In this case, Windows Forms would specify the NO_CURSOR because you can't drop there. <br />
<br />
"we must lose precision to make significant statements about complex systems."<br />
-deKorvin on uncertainty
|
|
|
|
|
I am having a problem with trying to get a series of wav files to play, I just want a simple button that when you press it, it will play a list of wav files, so far all that happen when I try and do this is it will play the last audio file stated in the code several times (the amount of other files I have tried to play.)
Any help that can be given will be much appreciated
Thank you
RoB
|
|
|
|
|
Since you didn't write a single line of code it's impossible to tell you what you did wrong.
Which environment are you using? .NET 1.1? 2.0?
What are you using to play your wave files? There's no built-in class to do this, so what are you doing?
Could it be that you're P/invoking sndPlaySound and specified the wrong flags?
mav
|
|
|
|
|
Thanks for your reply
I am using .net 1.1
The bits of code I have been using are shown below:-
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Threading;
using System.Runtime.InteropServices;
private string currentSoundFileName;
[DllImport("winmm.dll")] //load the sound libary
public static extern long PlaySound(String lpszName, long hModule, long dwFlags);
private Thread soundThread = null;
public void PlaySoundInThread(string wavefile)
{
currentSoundFileName = wavefile;
soundThread = new Thread(new ThreadStart(PlayASound));
soundThread.Start();
}
public void PlayASound()
{
if (currentSoundFileName.Length > 0)
{
PlaySound(Application.StartupPath + "\\" +currentSoundFileName, 0, 0);
}
currentSoundFileName = "";
soundThread.Abort();
}
Then I use the line below to play a wave file (i have stored the wav file in the debug directory)
PlaySoundInThread("1.wav");
This works with one wav file but when I have tried to play another wave file after this, I just replete the line of code with a different wav file entered, and that's where my problem is, it does not work.
Thanks
RoB
|
|
|
|
|
First, you've got the signature wrong. It's:
[DllImport("winmm.dll", SetLastError=true)]
static extern bool PlaySound(string pszSound, System.UIntPtr hmod, uint fdwSound);
your trying to pass two long 's (64-bit values!) in where the function is looking for two 32-bit numbers.
Second, you don't need to launch another thread to play the sound. Starting a thread is a VERY expensive process, taking forever and a day to start one. If you look at the docs for PlaySound on MSDN or PInvoke.net[^], you'll see that if you pass in the fdwSound parameter with the value 1, the function will start playing the sound asychronously, meaning it plays the sound without your code waiting for it to complete.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
GOT IT WORKING!
Thank you mav & dave.
the code i used is below:-
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices; // for PlaySound()
using Microsoft.Win32; // RegistryKey
namespace WindowsApplication2
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
[DllImport("winmm.dll", SetLastError=true)]
static extern bool PlaySound(string pszSound,
System.UIntPtr hmod, uint fdwSound);
[Flags]
public enum SoundFlags : int
{
SND_SYNC = 0x0000, // play synchronously (default)
SND_ASYNC = 0x0001, // play asynchronously
SND_NODEFAULT = 0x0002, // silence (!default) if sound not found
SND_MEMORY = 0x0004, // pszSound points to a memory file
SND_LOOP = 0x0008, // loop the sound until next sndPlaySound
SND_NOSTOP = 0x0010, // don't stop any currently playing sound
SND_NOWAIT = 0x00002000, // don't wait if the driver is busy
SND_ALIAS = 0x00010000, // name is a registry alias
SND_ALIAS_ID = 0x00110000, // alias is a predefined id
SND_FILENAME = 0x00020000, // name is file name
SND_RESOURCE = 0x00040004 // name is resource name or atom
}
private System.Windows.Forms.Button button1;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(48, 56);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(176, 72);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
public static void Play (string strFileName)
{
PlaySound (strFileName, UIntPtr.Zero, (uint)(SoundFlags.SND_FILENAME | SoundFlags.SND_SYNC));
}
private void button1_Click(object sender, System.EventArgs e)
{
string strFileName1 = "1.wav";
string strFileName2 = "2.wav";
Play(strFileName1);
Play(strFileName2);
}
}
}
|
|
|
|
|
I'm trying to use an ImageComboBox in my app. The control worked fine in a demo app, but the contructor throws a System.Resources.MissingManifestResourceException with the text:
"Could not find any resources appropriate for the specified culture (or the neutral culture) in the given assembly. Make sure \"TreeViewContainer.resources\" was correctly embedded or linked into assembly \"ImageComboBox\".\r\nbaseName: TreeViewContainer locationInfo: TSC.UserInterface.ExtendedComponents.ImageComboBox.TreeViewContainer resource file name: TreeViewContainer.resources assembly: ImageComboBox, Version=1.0.2153.16846, Culture=neutral, PublicKeyToken=null"
I commented out the few lines where I was changing the culture to geta different default timestamp format, and am using nuetral culture exclusively throughout my app so I'm not sure what the problem is. The only change I made to the control source was to change the namespace to put it in the same hierarchy as my other custom controls.
http://www.codeproject.com/cs/miscctrl/ImageComboBoxControl.asp#xx1245940xx
-- modified at 9:53 Wednesday 23rd November, 2005
Edit: I also changed the paths of the project build, but that should show up as a compile time error, not a runtime one I would assume.
|
|
|
|
|
On farther experimentation it seems that the moving of the source from solution\project\ to solution\project\src\ or the changing of the namespace from the provided default to one fitting our apps hierarchy that is causing the exception to be thrown.
|
|
|
|
|
Hi all!
Not a C# question, but the other groups don't fit, either...
In one of my VS 2003 deployment projects I've added a few merge modules to install some components I can use in my program.
Now I'm looking for a way to add a dialog to ask whether these components are to be installed. That's fairly easy, but I don't how to use the result of this dialog because merge modules don't have a Condition property like "regular" files in the setup have.
Any advice or useful links?
Thanks in advance,
mav
|
|
|
|
|
i want papers talks about user interface standards
|
|
|
|
|
designed for winxp docs
http://www.microsoft.com/winlogo/software/downloads.mspx
|
|
|
|
|
|
Hi:
If I have a button in my UI say "Run", how do I set it up so when the user enters Alt+R it is like clicking the Run button?
Also, how can I underline the "R" to inform the user the hot key is available?
Sorry if my terminology is wrong.
Regards, Sam
|
|
|
|
|
Replace the Text field with "&Run"
|
|
|
|
|
|
HiSam,
set a '&'-character just before the character 'R'.
For example:
btnRun.Text = "&Run";
Now you can use Alt+R and the R will have an unterline as well.
|
|
|
|
|
Uoops
There was already an answer!
|
|
|
|
|
I want to create a wysiwyg to generate XML. I use ASP.NET and javascript.
If someone knows how or has done something like it I will appreciate any help.
Thanks
Tony
|
|
|
|
|
Dim WithEvents p As CLAMXLib.ClamEngine
Private Sub Form_Load()
Set p = New ClamEngine
p.Database.Path = "E:\projects backup\ankitclam backup\Clamtest\database\"
End Sub
in vb code was written as above
now in C# i am writing my own function instead of using Form_Load()
and calling that from somewhere else
well i want to know conversion of line
Set p = New ClamEngine
how will we write this line in C#
i have written till now
CLAMXLib.ClamEngine p;
public void myfunction()
{// here i want that line
p.Database.Path="E:\\projects backup\\ankitclam backup\\Clamtest\\database\\";
}
Ankit Aneja
"Nothing is impossible. The word itself says - I M possible"
-- modified at 7:54 Wednesday 23rd November, 2005
|
|
|
|
|
ClamEngine p = new ClamEngine();
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
in vc++ like this
m_spIClamEngine.CreateInstance(__uuidof(ClamEngine));
when i write
ClamEngine p = new
i am not getting ClamEngine() at end
Ankit Aneja
"Nothing is impossible. The word itself says - I M possible"
|
|
|
|
|
p = new CLAMXLib.ClamEngine();
|
|
|
|
|
it is not showing ClamEngine(), after CLAMXLib.
p=new CLAMXLib.
and running fine in vb and vc++
Ankit Aneja
"Nothing is impossible. The word itself says - I M possible"
|
|
|
|