|
In my "Drag Enter" method, how can I get the path of the file I dragged? Is it in the IDataObject somewhere or what?
/\ |_ E X E GG
|
|
|
|
|
AFAIK path and name are the dragged String data:
<br />
private void control_DragEnter(object sender, System.Windows.Forms.DragEventArgs e) {<br />
String droppedItem = (String)e.Data.GetData(typeof(String));<br />
}<br />
|
|
|
|
|
Dosn't seem to work.....
/\ |_ E X E GG
|
|
|
|
|
Hello,
I am creating a custom schedule control similar to the way Outlook behaves.
I am having some difficulty trying to graphically/visually resolve conflicting appointments on a schedule.
Anyone have some ideas or a pointer or two to help me out?
Thanks,
Eric
|
|
|
|
|
i want, form another form, and at a specified condition, to create an object from a certain control and add it to the first form, like :
namespace Win
{
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1 = new Button();
private System.Windows.Forms.Button button2 = new Button();
public System.Windows.Forms.Panel panel1;
public Form1()
{
InitializeComponent();
}
static void Main()
{
Application.Run(new Form1());
}
private void button1_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void button2_Click(object sender, System.EventArgs e)
{
Form2 f2 = new Form2();
f2.Show();
}
}
public class Form2 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1 = new Button() ;
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, System.EventArgs e)
{
Button b = new Button();
b.Text = "Hello" ;
Form1 f1 = new Form1();
f1.panel1.Controls.Add(b);
}
}
}
this code does not work. What is the wrong here ?
thanks
|
|
|
|
|
In Form2.button1_Click you're creating a new instance of Form1 , adding a Button to its panel1 control and... well, that's it. f1 is going the way of the dodo bird when the method exits.
What I think you're trying to do is add the Button to the instance of Form1 that called Form2.Show in the first place. You'll need a reference to that object in Form2 . You can pass it in Form2 's constructor or as a property. Here's an example:
public class Form2 : Form
{
Form1 _form1;
public Form2(Form1 form1)
{
_form1 = form1;
}
private void button1_Click(object sender, EventArgs e)
{
_form1.panel1.Controls.Add(b);
}
}
public class Form1 : Form
{
private void button2_Click(object sender, System.EventArgs e)
{
Form2 f2 = new Form2(this);
f2.Show();
}
}
Charlie
if(!curlies){ return; }
|
|
|
|
|
ImanMahmoud wrote:
public Form1() { InitializeComponent(); }
I don't see the method InitializeComponent. Either create it, or get rid of this line
"Every rule in a world of bits and bytes can be bend or eventually be broken"
|
|
|
|
|
The project I'm developing is an Explorer bar which loads and saves files. Because it's an Explorer bar, the target output is a DLL (C# assembly). When the saved files are double-clicked, I would like to launch the Explorer bar.
Is it possible to setup an open handler within the DLL, rather than writing a helper EXE that will launch the Explorer bar, etc.? I like the idea of keeping the open-file handler bundled with the Explorer bar in the same DLL. In the mean time, until I hear from someone, I'll work on a helper EXE.
Thanks!
Arun
|
|
|
|
|
I am not sure about this one:
What about rundll32.exe ?
You, IMHO, should be able to associate an extension not only with an executable, but also with an executable with custom parameters.
If I am right here, you could then simply associate your extension with
"rundll32.exe mydll.dll MyExplorerBarStarter" or something like that.
I am not sure it will work with .NET-DLLs though
Cheers
Sebs
|
|
|
|
|
Hello all,
I have a simple custom control I use to draw an ellipse. The code is shown below. The problem is that if one ellipse is drawn INSIDE the area of another, the larger of the two always gets displayed in the foreground despite the z-order of the smaller ellipse. In fact, I can call BringToFront() on the smaller ellipse all day and the larger ellipse still gets displayed in the foreground.
I really don't understand why this is. Could someone more versed in painting custom controls help me out?
Thank you,
-dotbomb
~~~~~~~~~~~~~~~~ BEGIN CUSTOM CONTROL CODE SNIPPET ~~~~~~~~~~~~~~~~~~~~
public class ellipseControl : System.Windows.Forms.UserControl
{
private System.ComponentModel.Container components = null;
public Color backgroundColor;
protected override CreateParams CreateParams
{
get
{
CreateParams cp=base.CreateParams;
cp.ExStyle|=0x00000020; //WS_EX_TRANSPARENT
return cp;
}
}
protected void InvalidateEx()
{
if(Parent==null)
return;
Rectangle rc=new Rectangle(this.Location,this.Size);
Parent.Invalidate(rc,true);
}
protected override void OnPaintBackground(PaintEventArgs pevent)
{
//do not allow the background to be painted
}
protected override void OnPaint(PaintEventArgs e)
{
Graphics graphics = e.Graphics;
int penWidth = 1;
Pen pen = new Pen(Color.Black, penWidth);
SolidBrush brush = new SolidBrush(backgroundColor);
graphics.DrawEllipse(pen, 0, 0, (Width - 2), (Height - 2));
graphics.FillEllipse(brush, 1, 1, (Width - 4), (Height - 4));
brush.Dispose();
pen.Dispose();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
}
~~~~~~~~~~~~~~~~~~~~~ END CUSTOM CONTROL CODE SNIPPET ~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
Unbelievable. I'm sitting here studying for my MCSD C# exam, and I decided to check this thread. If you are right, I just wasted 12 hrs. writing code that determines if an ellipse has been stacked on, in front of, or somewhere in the area of another ellipse. The code then draws the overlapping ellipse region on the ellipse considered to be backward in the z-order. All great but this post would have saved me tons of time. I must have accidentally deleted the CodeProject email regarding your response amidst all the spam I normally receive.
Well, I'll let you know ... thanks for the post leppie. BTW, xacc-ide looks sweet! I can't wait to test my C# insertion sort dll in mono, it's gonna be my first mono project.
-dotBomb
|
|
|
|
|
Leppie, you are a master of custom control drawing. In fact, you may just be THE master. Thank you!!!
-dotBomb
|
|
|
|
|
Eeeek Mon!,
I'm trying to use the following function from the WinInet API in order to read an "Internet Settings" setting (IE) for "Check for newer versions of stored pages"
BOOL InternetQueryOption( HINTERNET hInternet,
DWORD dwOption,
LPVOID lpBuffer,
LPDWORD lpdwBufferLength
);
So I try dis in c#...
[DllImport("Wininet.dll")]
public static extern int InternetQueryOption (IntPtr hInternet, int dwOption, char[] lpBuffer, int lpdwBufferLength );
public static char[] getInfo2(){
char[] buffer=null;
int iLen = 0;
int iRet = InternetQueryOption (IntPtr.Zero,INTERNET_OPTION_END_BROWSER_SESSION, null, iLen);
buffer= new char[iLen];
int iRet2 = InternetQueryOption(IntPtr.Zero,INTERNET_OPTION_END_BROWSER_SESSION, buffer, iLen);
return buffer;
}
}
Calling it 1st time for size and 2nd time to fill in 'buffer');
It compiles/runs but gives me back nothing.
Help mi mon!
Yo help appreciated mon!
|
|
|
|
|
Should it be defined as:
[DllImport("Wininet.dll")]
public static extern int InternetQueryOption (IntPtr hInternet, int dwOption, IntPtr buffer, ref int dwBufferLength );
store your internet favourites online - www.my-faves.co.uk
|
|
|
|
|
But then how do I use IntPtr to get a value back? I need the value of buffer.
|
|
|
|
|
Hello
I'm trying to create a 2D game with Managed Direct3D 9.
I've got Sprite and Texture variables, and I set the screen to full screen mode with 800*600 resolution.
I was trying to put a background image, and for some reason- it changes the size of the image I load!
I wanted to put a 800*600 image, and it wasn't shown right.
I made the program print it's size, and it was 1024*1024!
How is that possible? why did it happen?
And how can I fix it..?
thanks
|
|
|
|
|
I don't know, but I am finishing development of a Jukebox program using DX9, and I can tell you that the audio video playback component of managed DX is a total shambles. Sounds like the disease is spreading.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
That's just great... :\
Thanks for the information.
I've heard somewhere that textures' size have to be 2 power x (4, 16, 32, 64 etc.. in case I dodn't write it correctly), and that's why it happens..
Does anyone know how can I display pictures using Direct3D without using textures?
thanks ..
|
|
|
|
|
Actually, I might be able to help there. A DirectX9 video object will happily read an image file, so I presume that playing it will display the image. A video object shows the last frame of a video until it gets changed or hidden, and they can definately be used to show video as a texture, so perhaps that will solve the problem ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Thanks!
This sounds pretty good; though in order to make it work as a game, I have to show several images at the same time, some of them above others, and all of that in full screen mode.
Can it be done with video objects?
|
|
|
|
|
As far as I am aware, the video is used as a texture, there's no difference to any other texture.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Hey did you finish your article about this? I've used AudioVideoPlayback for some music and noticed some serious bugs (random crashing if Audio.Ending event is setup, not hearing any sound on certain 320kbps mp3 files, just to name a few), so I'm curious to know what other issues may be lurking for me.
Judah Himango
|
|
|
|
|
I'm working on it. I found that if you use the ending method as well of setting up your own, you can get crashes deep in DX if you change the object, and then the event fires. If you don't use the Ending event, I've found it to be pretty solid. I'm a bit worried about the no sound bug though, I've not seen that one.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Yeah I ended up using a timer and doing a manual "ending" event, seems to work pretty well.
About the 320kbps no sound problem...no sound plays unless I skip ahead or backward and then continue playing. I can duplicate it consistently by playing one particular 320kbps song (though I see it with many others), you might wanna try it on your machine using AudioVideoPlayback, you can download the song from here.
Judah Himango
|
|
|
|