|
i was looking through the new file dialog on vs.net, and noticed a userconol class, so i onpened one, and found the base class was userControl, so i was wondering what the difference was, and if it was best to derive from Control or userControl.
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
I think usercontrol provides extra designer support and acts like a form really (without borders), but i could be wrong...
From MSDN:
By extending ContainerControl, UserControl inherits all the standard positioning and mnemonic-handling code that is necessary in a user control.
AND...I was meant to say Form also extends ContainerControl. Thus the similarity
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
Typically you use Control for controls made from scratch and you use UserControl to create composite controls (a control that contains other controls).
James
"And we are all men; apart from the females." - Colin Davies
|
|
|
|
|
Hi NG,
I've got a Class derived from component.
[Browsable(true)]
public Form Parent
{
get
set
{
this.parent = value;
this.parent.Load += new EventHandler(......
}
}
the desinger generates now this code if i drag my component on a form
void InitalizeComponents()
{<br />
mYCom = new MyComp();<br />
mYCom.Parent = this;<br />
}
Now the designer does not show any form derived from this form, the error is "Object is ....", there's only a white blank page.
Now if i remove the add eventhandler code in my set property, everything works fine.
How do i have to code this, i would like to set the parent of the component, attach a event.
.:Greets from Jerry Maguire:.
|
|
|
|
|
Try wrapping the addition of the event handler with a check to see if you are in design mode.
if( !DesignMode )<br />
this.parent.Load += new EventHandler(......);
James
"And we are all men; apart from the females." - Colin Davies
|
|
|
|
|
The Problem is that this property is set while the Form is in InitializeComponent Method, now the Flag DesignMode is always false. It seems to be to early for this flag, i guess this flag is set after this Method is passed, in Form.Load Event we can use this flag.
.:Greets from Jerry Maguire:.
|
|
|
|
|
if i have hwndle (Intptr)of parent window and hwndle of child window then how to get the point and rectangle of child window with respect to its parent window ?
how to convert HWND into intptr?
r00d0034@yahoo.com
|
|
|
|
|
Question 1 :
In C++, that was,
POINT pt;
::ClientToScreen(hwndchild,pt);
::ScreenToClient(hwndparent,pt);
In C# it is,
Point pt;
Control.FromHandle(hWndchild).PointToScreen(pt);
Control.FromHandle(hWndparent).ScreenToClient(pt);
Question 2 : IntPtr hWnd = (IntPtr) h; // where h is a HWND
And I swallow a small raisin.
|
|
|
|
|
thanks for your help
i have one more problem and that is
please read that code and solve mine problem
tmpProcess = new Process();
tmpProcess.WaitForInputIdle();
tmpProcess.StartInfo.FileName="f:\\mirc59t";
try{
tmpProcess.Start();
while(! tmpProcess.Responding)System.Windows.Forms.Application.DoEvents();
}catch{}
tmpProcess.WaitForInputIdle();
IntPtr hWnd=tmpProcess.MainWindowHandle;
///////////////////////////////////////////////////////////
Control parent = Control.FromHandle(hWnd);
//////////////////////////////////////////////////////////
//Control parent = Control.FromChildHandle(hWnd);
if(parent!=null)
MessageBox.Show("parant not null");
/*foreach(Control child in parent.Controls)
{
IntPtr childHandle = child.Handle;
}*/
///////////////////////////////////////////////////////////
parent variable recive null that's why remaining code could not run.
it should not recive null because the process main window
contain two button and four Static members.
can any body tell why it recive null?
and what i have to do that it should not recive null?
i will be very thank full to u.
r00d0034@yahoo.com
|
|
|
|
|
Looks obvious to me, you are starting a process and assume that you get the handle of the main window of the attached process, first error, and then you assume you can get your hands on the main Form instance of a process, second error.
First error : do not assume a process has a window attached it. A process is anything like a .exe, and does not necessarily have a window attached. You must do something like if (!hWnd.Equals(IntPtr.zero)) { ... }
Second error : window handles can be manipulated by any process running on the OS, there is no security problem here because a window handle is nothing. But the instance of the control attached to it is something which lives in the address space of the process, something you don't have your hands on. You have to do some form of messaging (such like the typical WIN32 ::SendMessage, or the more .Net-like Windows.Messaging) to get it between your process, and the one you have started.
And I swallow a small raisin.
|
|
|
|
|
hi there,
subject says it all. i have a listview with LabelEdit set to True - so clicking a label when it is already selected lets the user edit the label's text within the listview.
now i want to start the labeledit-thing by a key (F2) - so i wrote a KeyUp-handler, made the usual switch (e.KeyCode) and now i'm stuck. how should i tell the listview that the user wants to edit the currently selected label? maybe i raise a BeginLabelEdit-event by hand, but how is that done? other ideas?
thx in advance.
:wq
|
|
|
|
|
i have a form app and i put a background image on my form. then set the TransparencyKey to white and select 'None' for FormBorderStyle in order to see a transparent view when app starts.
Everything seems Ok, But my problem is that i can't move my transparent form anywhere. What should i do to move my form without a border?
Any help will be appreciated...
Thanks,
Atilla Selem
just listening to you...
|
|
|
|
|
I am afraid you have to provide the same feature than the one from a standard full-fledged windows app : in the system menu in the caption, there is a "move" command for this purpose,
And I swallow a small raisin.
|
|
|
|
|
Alternatively, capture the MouseDown event when clicked on the whole surface of the form (a picture in your case), then capture the MouseMove event to relocate and finally the MouseUp event to set the new position.
Hope this helps
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
|
You know what, just as I finish my nice Winamp 2.xx Control class, they go and release Winamp 3 which works totally different other than that and the still uncompleted Download class, its still pretty much the same....
BUT, to solve the Winamp (sound really) , I have started working on a managed sound library wrapper for an existing multipurpose soundlib dll. It supports various sound formats including mp3, wav, mod, xm, s3m and CD and more! The existing soundlib is actually more orientated for game development (and includes 3D sound positioning as well as 3D listener positioning) than just a player, so it has many possibilities. In fact it is the same sound library used in EA's F1 2002 . It is based on the DirectSound interface.
At the moment it is about 80% complete and all the C++ is driving me nuts .
I will up it as soon as I'm done as it shows (well, according to me anyways) how to wrap an unmanaged dll in a managed assembly. My goal is though to implement it fully and not just what I need.
BTW, did u sort out your problem?
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
leppie wrote:
BTW, did u sort out your problem?
no - ill get back to it though - its on my TODO list.
i just thought of another thing to have a crack at, so im gonna do that now.
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
Hi Guys,
How to Access the Registry of Remote System? Code snippets or links would be of great help.
Thanks in advance,
sarith sutha
|
|
|
|
|
is it possible to open MS Word in MDI form as a child with limited functionalities (probably no menus and toolbar)and C# controls all file opening, printing, editing and close option in word?
any help will be appriciated.
thanks
|
|
|
|
|
How can i get the Pixel color in a Graphic ?
Thanks
|
|
|
|
|
Bitmap myPicture;
.
.
.
System.Drawing.Color pixelColor = myPicture.GetPixel(x, y);
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
hi all,
im making a status bar that can host any type on control inside it. i wanted to make the status bar class itself handle the sizing of the controls to fit in the panels, but am having a little difficulty, as the actual visible size of the control will vary, depending on whether or not it has a border, but i cannt check this, because not all controls allow to change the border style.
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
I think i had a similar problem a while back.
My solution:
As mycontrol was derived from control it had the Size property. So instead of Drawing the border on the outside, I drew it in the inside so the Size property stays constant. That is what I needed.
In your case, you might want to override the Size property. eg.
public override Size Size
{
get
{
if (bordertype =! BorderType.None)
{
return new Size(base.Size.X + borderwidth*2, base.Size.Y + borderwidth*2);
} else return base.Size;
}
set {....same as get, just in reverse...}
}
Hope this helps
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
Hi all
I am in the process for creating an in house WEB control that can bind to a DataSource - but I can't work out how to. I've deduced that it must be something to do with the TypeConvertor attribute.
I've found this http://morganskinner.dnsalias.net/Articles/DataSource_DataMember.htm [^]which sort of shows what to do but it sort of works but my property doesn't persist properly - but I think that is to do with the example being for a Windows Form control rather than a web control.
Anybody point me in the right direction.
thanks
Stupidity dies.
The end of future offspring.
Evolution wins.
- A Darwin Awards Haiku
|
|
|
|
|
I'll also need to bind to the DataMember and the DataFields (5 of em) once I have managed to do the above.
Stupidity dies.
The end of future offspring.
Evolution wins.
- A Darwin Awards Haiku
|
|
|
|