|
i think you are talking about mdi child and parent, then in child closing event you can call this.mdiparent.dispose(); to close both forms.
Regards
Shajeel
|
|
|
|
|
this code closes the mdi parent and child , but it doesn't call the closing function of the child form(which i am using).
now how do i get over this problem??
|
|
|
|
|
you should be calling this function after doing every thing you want to do in closing event like
private void Form2_Closing(object sender, System.ComponentModel.CancelEventArgs e) { //all your code this.MdiParent.Dispose(); }
Regards
Shajeel
|
|
|
|
|
:->
thanks dude
Regards
Saira
|
|
|
|
|
Here's the trilemma that I'm in: I want to XML serialize an object tree. Some properties have getters only, so there are a few options to serialize those (note that this is in a web service scenario, so the schemas are required too):
- Go the easy way, add setters to the properties. This degrades the class design somewhat, but might be acceptable.
- Go the hard way, implement IXmlSerializable and hand code the serialization (note that the schema must be created too, using the XmlSchemaProviderAttribute). This option doesn't degrade the class design, but at a considerable cost. I have explored some in this direction, using the XmlReflectionImporter class some short cuts might be taken in creating the schema, but I haven't successfully combined this technique with a hand written implementation of XmlSchemaProviderAttribute (see here[^] for more details for those interested).
- Try something really groovy, uncharted territory, and thus potentially more risky. I was thinking about writing a reflection based serializer/deserializer/schema creator myself. How hard can it be? It's just a bunch of properties, and collections. I'd add the ability to serialize a property with only a getter. That's the only issue with the default xml serializers. Basically the behaviour would be the same as serializing collections, those can have a getter only too.
So, which option would be the wisest? Am I overlooking any options that I don't know of or didn't think of?
Wout
|
|
|
|
|
Hi!
Could any one suggest me how I can display tooltips for a disabled controls! It was fairly easy to implement the same in MFC but em not able to find a solution in C#
Thanks in advance!
<bold>- Nilesh
<italics>"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
place another control behind the disabled control so that only when your control is disabled then mouse events go to that control, in that control's mouse move event call tooltip.settooltip for the control that is behind.
Regards
Shajeel
|
|
|
|
|
Thanks!
But my application is having too many controls, and having duplicate control underneath each really blots it up
- Nilesh
|
|
|
|
|
Hi
You can add hidden control (HTML or asp:hiddenfield) as this will not disturb your UI.
Harini
|
|
|
|
|
i think a better solution will to created user controls for all controls you use, but it will be time consuming and you will have to replace all your control in your application with custom controls.
Regards
Shajeel
|
|
|
|
|
but again custom controls would also face the same problem! won't they?
|
|
|
|
|
Yes, it should be (considered) forbidden to frivolously use resources.
Documentation tells us that tootips are never displayed for disabled controls. That means the behavior is not supported by the tooltip class. You would have to write your own tooltip-like class to detect mouse-over and so forth if you wanted to override this behavior, but that would be a steep price to pay to provide a tooltip for something that isn't functional at the moment in the first place.
|
|
|
|
|
Was wondering if there was any workaround,
similar problem is seen with MFC controls as well but there you have the pretranslatemessage which allows you to handle it by sending explict messages to tooltip controler.
Is it possible to implement something similar here too
<bold>- Nilesh
<italics>"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
I really can't tell you that, but it's a good question, particularly as the disabled state itself could be an obstruction. I mean of course, that whenever someone discovers such a workaround, there's a good chance they walked down a few difficult dead ends (as successfully as possible) to find it -- so it's a good idea to ask in case someone might have the pattern handy. If so, it might be a long shot that such a person might see your post.
Still, I think I'd lean away from this. Your post in fact first gave me the idea I might try a workaround to provide an additional capacity in a control I'm working on, but then I thought no, it's not often (if ever possibly) very logical to provide tooltips to disabled controls... so (for me at least, as far as I can see), I decided to accept the default functionality, particularly considering how much effort and resource overhead might be wasted to deliver the behavior you are asking for.
That said, if you want pointed in the initial directions that strike me, what you might try that might not increase resource reliance too disproportionately, is detecting the parent of your control and setting the region of your control on the parent to take a mouse hit test, sampling the mouse state to raise your own hint possibly from the parent. That even may be too wild an idea or technically challenging a project.
|
|
|
|
|
Thanks for the pointer,
I too was thinking on the same line. To capture region of disabled object and set required tooltip for parent, let me give a shot at it.
Thanks again!
Nilesh
|
|
|
|
|
Well, good luck on that.
Just one other thing. If your control is composite/aggregate of course, you should be able to pull this off without too much difficulty. Otherwise, it certainly would be a boon to be able to have an inside look at the ToolTip class. Some people say some of that kind of source can be found. If you can dig it up, the behavior you want may be no more difficult than overriding a method, possibly only to eliminate the logic fork that refrains from tooltip display when controls are disabled.
Personally, I think Microsoft would benefit the development community tremendously by exposing selected source (like this) to us. Instead of our present far-reaching discussion without much tangible to present to each other, dozens of people could recommend just how to override whatever method. That's how it was in Delphi and C++Builder a few years back, before Borland management made the mistake of letting .Net blow them out of the water.
|
|
|
|
|
Can you give me any detail or any url where I can find about how to create chm files programmatically using C#??
Thanks in Advance
Praveen
|
|
|
|
|
|
Good day,
I have a form, i've set the BackColor to Black and also the transparency to Black.
then on the form a UserControl which has a gradient backcolor.
Inside the UserControl i've put two basic controls(Label1 and Button1).
I've set the BackColor of Label1 and Button1 to Transparent. What happened is
that the Label1 and Button1 transparency goes through the form itself. See Link Below:
http://www.geocities.com/fritzjeran/Sample.JPG
What I really wanted is that when i set the BackColor of the Label1 and Button1
to transparent, I goes through ONLY up to the UserControl (i.e what should appear
is the gradient color of usercontrol on the area that is overlapped by label1 and Button1).
How should I fix this?
Here is the code of my Usercontrol:
public partial class BaseControl : UserControl
{
public BaseControl()
{
InitializeComponent();
SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.EnableNotifyMessage, true);
}
protected override void OnPaint(PaintEventArgs e)
{
if (this.BackgroundImage == null)
{
Rectangle rect = new Rectangle(0, 0, Width, Height);
LinearGradientBrush b = new LinearGradientBrush(rect, Color.White, Color.Blue, 90);
GraphicsPath path = GraphicsPathUtility.GetRoundRectPath(rect, 10);
e.Graphics.FillPath(b, path);
}
base.OnPaint(e);
}
}
#region Utility Classes
public class GraphicsPathUtility
{
private GraphicsPathUtility()
{
}
public static GraphicsPath GetRoundRectPath(RectangleF rect, float radius)
{
return GetRoundRectPath(rect.X, rect.Y, rect.Width, rect.Height, radius);
}
public static GraphicsPath GetRoundRectPath(float X, float Y, float width, float height, float radius)
{
GraphicsPath gp = new GraphicsPath();
gp.AddLine(X + radius, Y, X + width - (radius * 2), Y);
gp.AddArc(X + width - (radius * 2), Y, radius * 2, radius * 2, 270, 90);
gp.AddLine(X + width, Y + radius, X + width, Y + height - (radius * 2));
gp.AddArc(X + width - (radius * 2), Y + height - (radius * 2), radius * 2, radius * 2, 0, 90);
gp.AddLine(X + width - (radius * 2), Y + height, X + radius, Y + height);
gp.AddArc(X, Y + height - (radius * 2), radius * 2, radius * 2, 90, 90);
gp.AddLine(X, Y + height - (radius * 2), X, Y + radius);
gp.AddArc(X, Y, radius * 2, radius * 2, 180, 90);
gp.CloseFigure();
return gp;
}
}
#endregion
I would like also to acknowledge those who previosly help me. Thanks.
|
|
|
|
|
I have a simple question. I would like to be able to test data conversions from string to other data types without throwing exceptions if it fails (throwing exceptions seems a bit sloppy). Here is a sample of what currently works, but I would like a cleaner version.
public bool IsInt(string sData)
{
bool bRtn = false;
try
{
int iTmp = Convert.ToInt32(sData);
bRtn = true;
}
catch (Exception) { }
return bRtn;
}
Any better ideas I'd love to hear them. This works but it will throw exceptions if the string cannot be converted to the correct data type (here int).
Thanks for your input.
Leo T. Smith
|
|
|
|
|
TryParse, types like bool, int and double expose a TryParse method which returns false if they fail
string s ="NotABool";
bool b;
if (!bool.TryParse(s, out b))
{
// not a bool.
}
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thanks, I'll try this in the morning.
Leo
Leo T. Smith
|
|
|
|
|
I want to write an app that piggie backs off of the Windows VPN connection. I can make it launch the connection and conect. But I am unable to restore the connection from the Windows status bar, i.e. System Tray i.e. Notification Icon Area.
Anyone have any ideas???
Thanks!
RABB17
"Nothing fancy needed, please just solve all our problems as quickly as possible."
|
|
|
|
|
I have a problem that should be simple to solve except I cant seem to find the answer anywhere.
I would like to be able to set the "Windows UserName and Windows Password" and then use Directory.Exists() inside a Windows Service (using Visual Studio 2005 .Net 2.0) to check to see if a particular directory exists. There can be a directory where UserName=Admin and Password=ABC needs to login first to see if that directory exists. There can be another directory that the user "Admin" CANT see but user "Tester" can. In that case UserName=Tester and Password=DEF needs to log in and then use the Directory.Exists().
I dont want to have to set the userid and password in the installer because only "I" the programmer can set that.....another words....I have to set the username and password BEFORE an installation package is created. That is why it will not work. I need different users to provide there windows login and password.
Any help would be great.
Chris
|
|
|
|
|
Have some commandline or preferably a small Cassini Websever to be served from EXE on a defined port. Authenticate the user and you can create username/passwords, which you can securely store. The master username and password can be one-time only and should be disposed off once the admin has started creating his account.
This should be fairly simple right?
|
|
|
|
|