|
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?
|
|
|
|
|
Thanks for the answer. It doesn't seem that simple to me. Actually I dont really have a clue what you are talking about. I am storing data into a database that the windows service uses so there is no need for the passing of arguments through the command line. I do not want to "create username/passwords". I want the user to provide his or her windows username, password, and a directory in "Program1.exe" which stores the information in a database. Then "Service1.exe" reads the database finds the username, password, and a directory and then is able to use Directory.Exists() to see if that directory does infact exist. The problem is the specified directory does exist but Directory.Exists() returns false.
|
|
|
|
|
You gotta be kidding.
Geeze, well, wherever NumberOfUnits is declared I have no idea, but it must be your number of rows... and what you are doing is iterating the rows and assigning the value of tb[i].Text.ToString() to the row.
What the hell did you expect to happen?
|
|
|
|
|
I expected exactly what in fact did happen BUT I wasn't seeing what was happening.
The problem was elsewhere - the actual textboxes were bound to the datatable incorrectly SO my code was fine.
The short answer - there was nothing wrong with the code
Glen Harvy
|
|
|
|
|
I guess so, if that was what you intended. But your question "seemed" to suggest you were trying to analyze why that had happened.
Good job, even if you couldn't see what was happening.
Actually, you have to be careful with how you connect things in visual development environments. Visual configuration errors can sometimes be pretty difficult to interpret.
I still don't understand why the array of text boxes... but no matter.
I hope you forgive me. No offense intended.
|
|
|
|
|
No worries mate
Your right - I was trying to analyze it.
Cheers.
Glen Harvy
|
|
|
|
|
I'm trying to open a file pragmatically with an application that is not the default and with out setting it as a default.
For example: I have a myfile.bmp. My default photo viewer is Microsoft Fax Viewer, but I want to open it with Microsoft Paint with out setting Microsoft Paint as the new default.
I've been playing with Process.Start("myfile.bmp") but can't seem to get anything to work.
Any help would be appreciated
Best Regards
-Chris
|
|
|
|
|
You can change file Associations by Shift Right Click. You get a OpenWith in whose target dialog a new association can be saved.
|
|
|
|
|
It's done also with the Process.Start method but with an overload form of it. Basically you must start the application you desire(in your case mspaint.exe) and specify the name of the file you wish to open as a runtime parameter for mspaint.exe.
I've done this once. If I find the code snippet, I'll post it later.
|
|
|
|
|
I posted a question earlier re. genarics for .net 2.0 and seems that what I'm trying to do is unfeasible.
So here's my last (I think it's last) question on generics:
Is it possible to reference "current class" instead of hard-coding the class name in the code?
E.g.
abstract class BaseClass
{
static void GenericStaticMethod < T > (args)
{
...
}
void Foo()
{
GenericStaticMethod <CurrentClass>.(args);
}
}
class C1 : BaseClass
{
...
}
class C2 : BaseClass
{
...
}
when calling C1.Foo() , it should in turn call GenericStaticMethod < C1 > (...) or calling C2.Foo(), it should in turn call GenericStaticMethod < C2 > (...) ?
- Malhar
|
|
|
|
|
I don't think so. The best way to accomplish what you're trying to do is to make Foo() virtual, then override Foo in the base classes to do call GenericStaticMethod<t> using the current class type.
|
|
|
|
|
that's what i was afraid of! i wanted to use generics to the fullest. i wonder why microsoft couldn't have anticipated need for such.
- Malhar
|
|
|
|
|
GenericStaticMethod <this.GetType()>.(args);
Does not work?
/M
|
|
|
|
|
|
I want to display some values like Windows Task Manager - Performance:
Commit Charge (K) -- Peak
Physical Memory (K) -- Total, System Cache
How can I get this values using PerformanceCounter ?
Thanks.
|
|
|
|
|
That would be quite a trick. You would have to descend from PerformanceCounter to build a composite class that got that information for you from the class(es) you should be getting that information from directly. That would sort of be the long way around the problem kinda sorta wouldn't it?
Search your documentation and find the class(es) that do what you need to do. Call their methods or read their properties, and you won't have to design a class that uses that class to find out you can use that class directly.
BTW, here is what your documentation says about PerformanceCounter (I checked, just not to embarrass myself to horribly):
http://msdn2.microsoft.com/en-us/system.diagnostics.performancecounter(VS.71).aspx
If you don't find an appropriate member, your class search has just begun.
|
|
|
|