|
Hi,
I use form.Hide() to hide a form, and use form.Show() to bring it back. However, I found that the form's position is changed. How did this happen? I didn't recreate this form, just hide and show again.
How can I keep it as where it was?
Thanks!
|
|
|
|
|
I found this from msdn about "Form.WindowState Property"
Before a form is displayed, the WindowState property is always set to FormWindowState.Normal, regardless of its initial setting. This is reflected in the Height, Left, Top, and Width property settings. If a form is hidden after it has been shown, these properties reflect the previous state until the form is shown again, regardless of any changes made to the WindowState property.
I think this is the reason, my form keeps changing position. But How can I keep it stay where it was?
Thanks in advance.
|
|
|
|
|
You could set some variables to the co-ordinaets of your form when you hide it, then when you show it, re-set the form's position to those variables.
i.e.
Point loc = this.Location;<br />
this.Hide();
//Showing
this.Show();<br />
this.Location = loc;
Not a great solution but would work till you can get a better one.
Kev
Robert E. Lee's Truce
Judgement comes from experience; experience comes from poor judgement.
|
|
|
|
|
|
can anyone tell me ho do i play and stop either a wma ...mp3...wav file....without using the media player ocx...
|
|
|
|
|
You might wanna try looking into DirectX 9 SDK.
The Microsoft.DirectX.DirectSound namespace (I think this is correct) has what you need.
Try searching MSDN for documentation.
Kev
Robert E. Lee's Truce
Judgement comes from experience; experience comes from poor judgement.
|
|
|
|
|
Do any one know what is the meaning of declaring a class with public access specifier?
|
|
|
|
|
Without it the class is not visible outside of the assembly.
|
|
|
|
|
|
hey...i have this big qustion...like...i have seen in quite a few application..whcih when u install them....they add theier own tabs buttons,controls,,etc to windows forms...like i installed an alarm software in x the other day and it added its own tab tothe form that pops up when you double clcik....the....system tray date time....how do i dow this.....
|
|
|
|
|
Mridang Agarwal wrote:
the....system tray date time....how do i dow this.....
It was a little hard to decipher your question, it wasn’t very clear but I assume you are talking about adding a notification icon to the systray. You need to look into the NotifyIcon Class[^].
- Nick Parker My Blog | My Articles
|
|
|
|
|
that not what i mean....u see....when u double clcik the date time(in win xp)...in the system tray a windows pops up....it has three tabs, namely....time.....timezone....and...syncronise time....now.....what i wanna do..is to add my own applications tab there...how dod i do that....
|
|
|
|
|
hello guys
i have implemented a collection which is derived from CollectionBase and create a control which has a Collection property like this:- eek:
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
EditorAttribute("typeof(CollectionEditor)","typeof(System.Drawing.Design.UITypeEditor)")]
public MyCollection ButtonList
{
get
{
return (MyCollection)myObject;
}
set
{
this.myObject= value;
}
}
eek:
but the prblem is when i add the property values using Collection Editor it sets the values for the control but when i rebuild the project it reset the control property null. how can i resolve this problem or is there any place where Collection Editor store their values please help me.
thanx:
|
|
|
|
|
I am adding a chacracter to a string depending on the length of the text in a text box. Unfortunately this move the cursor to the beggining of the text in the text box, how do i move the cursor back to the end??
Kev
Robert E. Lee's Truce
Judgement comes from experience; experience comes from poor judgement.
|
|
|
|
|
TextBox tb = new TextBox();
tb.SelectionStart = tb.Text.Length;
|
|
|
|
|
Works great, thanks
Kev
Robert E. Lee's Truce
Judgement comes from experience; experience comes from poor judgement.
|
|
|
|
|
I added my entire C# project to source control (CVS in this case) and am now realising that there are probably files in the project tree that shouldn't be checked in, since their generated locally (such as user settings, or build temp files)
Can anyone give me a list of all the files that shouldn't be in source control?
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
I always put in my cvs repository only the source files. I never put project files and debug files. This way I am able to use another IDE to keep progamming when I dont have visual studio or csharpdevelop.
You can put, source files, image files, resource files, and database file (once you use access ou dbf as database).
That is it, sorry my poor english.
Thiago - Brazil.
|
|
|
|
|
Hi!
I implement IOleCommandTarget in a .net COM server.
Here's my code. I'm trying to implement an object that can be used as a
COM object for a button in IE. I get a System.ExecutionEngineException when hitting the button (.
---------------------------------implement------------------------------------------
// Import IOleCommandTarget interface
[StructLayout(LayoutKind.Sequential,CharSet=CharSet.Unicode)]
public struct OLECMDTEXT
{
public uint cmdtextf;
public uint cwActual;
public uint cwBuf;
[MarshalAs(UnmanagedType.ByValTStr,SizeConst=100)]public char rgwz;
}
[StructLayout(LayoutKind.Sequential)]
public struct OLECMD
{
public uint cmdID;
public uint cmdf;
}
// Interop definition for IOleCommandTarget.
[ComImport,
Guid("b722bccb-4e68-101b-a2bc-00aa00404770"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IOleCommandTarget
{
void QueryStatus(ref Guid pguidCmdGroup, UInt32 cCmds,
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex=1)] OLECMD[] prgCmds, ref OLECMDTEXT CmdText);
void Exec(ref Guid pguidCmdGroup, uint nCmdId, uint nCmdExecOpt, ref object pvaIn, ref object pvaOut);
}
-----------------------------------implement----------------------------------------
-----------------------------------using----------------------------------------
[ClassInterfaceAttribute(ClassInterfaceType.None)]
[GuidAttribute("81AC67A9-1511-4104-93AC-BD8BFEC93F71")]
[ProgIdAttribute("MyDll.dll")]
public class GetURL: IObjectWithSite, IOleCommandTarget
{
protected SHDocVw.IWebBrowser2
m_pIWebBrowser2; // the browser class object
public GetURL()
{
}
public void SetSite(object pUnkSite)
{
// MessageBox.Show("SetSite");
if (m_pIWebBrowser2!=null)
Release();
if (pUnkSite==null)
return;
IServiceProvider isp = (IServiceProvider)pUnkSite;
try
{
//!!!!!получаем указатель на SHDocVw.IWebBrowser2 через IServiceProvider а не QueryInterface
Guid g1 = typeof(SHDocVw.IWebBrowserApp).GUID;
Guid g2 = typeof(SHDocVw.IWebBrowser2).GUID;
object obj;
//isp.RemoteQueryService( ref g1, ref g2, out m_pIWebBrowser2 );
isp.QueryService( ref g1, ref g2, out obj );
//получили объект и преобразуем его к SHDocVw.IWebBrowser2
m_pIWebBrowser2 = (SHDocVw.IWebBrowser2)obj;
}
catch(System.Runtime.InteropServices.COMException ex)
{
//
}
MessageBox.Show(m_pIWebBrowser2.ToString());
}
public void GetSite(ref System.Guid riid, out object ppvSite)
{
ppvSite = m_pIWebBrowser2;
try
{
//
}
catch(Exception ex)
{
MessageBox.Show(ex.Message + " GetSite");
}
}
public void QueryStatus(ref Guid pguidCmdGroup, UInt32 cCmds, OLECMD[] prgCmds, ref OLECMDTEXT CmdText)
{
MessageBox.Show ("Query status");
}
public void Exec(ref Guid pguidCmdGroup, uint nCmdId, uint nCmdExecOpt, ref object pvaIn, ref object pvaOut)
{
MessageBox.Show ("Execing");
}
}
-----------------------------------using----------------------------------------
In what a mistake? Help! Plz!!
|
|
|
|
|
I have two webforms in the same Project, and both have the lines
System.Drawing.Image.GetThumbNailImageAbort myCallback;
These two forms have the same using directives but the weird thing is, one form compiles fine, but the other barfs up the error:
The type or namespace name 'GetThumbNailImageAbort' does not exist in the class or namespace 'System.Drawing.Image' (are you missing an assembly reference?)
Is this a bug? Has anyone seen this before? Or am I just missing something?
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
|
|
|
|
|
Nick Seng wrote:
Is this a bug? Has anyone seen this before? Or am I just missing something?
You not only need to make sure your code uses a using statement to reference the assembly but you also have to make sure the compiler references the appropriate assembly as well. If you are using Visual Studio .NET you can simply add a reference to System.Drawing.dll, but if you are compiling using the command line compiler you will need to add it to the /reference switch.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Nope, the references are correct and I am using VS.NET.
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
|
|
|
|
|
How can I disable the Add and Remove buttons in the standard CollectionEditor? I already implemented my own Editor Class but how can I access the buttons because I don't want to create my own form which should look like the standard form. Or do I have to derive a class from CollectionForm and how could I do that? And I really want to disable the buttons and I don't want to display an error message.
Claudia
|
|
|
|
|
Hello,
I want to create a Table in my Smart Device Application which contains a few links which forwared to another form in my Smart Device Application. Has anybody an idea how i can do that?
thx
regards
patrick
|
|
|
|
|
Hi , ive been trying to figure out how ambient properties in .net work.
i know its possible to do something like this:
<br />
private Color blah;<br />
public Color Blah<br />
{<br />
get<br />
{<br />
if (blah == Color.Empty)<br />
{<br />
return this.Parent.Blah;<br />
}<br />
else<br />
{<br />
return blah;<br />
}<br />
}<br />
set<br />
{<br />
if (value == this.Parent.Blah)<br />
{<br />
blah=Color.Empty;<br />
}<br />
else<br />
{<br />
blah = value;<br />
}<br />
}<br />
}
this works fine in runtime but it doesnt behave as the color and font properties of a control in designtime since the ambient value is not treated as the default value.
(the ambient value is always bold in the prop browser and always persisted to the initialize code)
ive used reflector to see how the control class does it and i cant see anything different in their code (except for some offtopic activex compatabillity)
how can i specify a behaviour similair to the "[DefaultValue(..)]" dynamicly ???
i know its possible since the controls does it and they do not even specify the defaultvalue , so it must be some typeconverter related thing , right?
//Roger
|
|
|
|