|
Hia!
I need to hide the border of a win button keeping at the same time the text of it. I think tha the best way to solve my problem is to asign the Form color to the button´s border but there is the problem:
It´s possible to change the border color of a Win Button without changing at the same time the color of the text shown?
By now i´ve only found 2 variables to manage that stuff (ForeColor & BackColor), the ForeColor manage both tge text and the border.
Can somebody help me?
Thanx in advance.
|
|
|
|
|
Why don't you just set Button.FlatStyle to FlatStyle.Flat ?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks Heath, but the flat style include the border too.
The problem is that the border color and the text color are controlled by the same property, no matter the FlatStyle selected.
I think that i need to override a Paint method or something similar.
Cheers!
|
|
|
|
|
I'm trying to run the GetDisplayName method of a folder (in this case, the desktop folder). It all executes perfectly as far as I can see, until it reaches the StrRetToStr method, where it crashes with a null pointer error.
I'm slightly confused as its practicaly identical to the tutorial on this site, and all values forwarded are allocated succesfuly by previous functions.
The code follows:
IntPtr desktopPIDL = new IntPtr();<br />
<br />
COMStuff.SHGetDesktopFolder(out desktopPIDL);<br />
<br />
Type shellType = typeof(IShellFolder);<br />
<br />
IShellFolder shellFolder = (IShellFolder)<br />
Marshal.GetTypedObjectForIUnknown(desktopPIDL, shellType);<br />
<br />
<br />
IntPtr interfacePtr = new IntPtr();<br />
IntPtr relativePIDL = new IntPtr();<br />
<br />
Guid myGUID = Marshal.GenerateGuidForType(shellType);<br />
<br />
result = COMStuff.SHBindToParent(desktopPIDL,<br />
myGUID,
out interfacePtr,<br />
out relativePIDL);<br />
<br />
IShellFolder myShellFolder = (IShellFolder)Marshal.GetTypedObjectForIUnknown(interfacePtr,shellType);<br />
<br />
mySTRRET = new STRRET();<br />
result = myShellFolder.GetDisplayNameOf(relativePIDL,SHGDN_Flags.SHGDN_NORMAL | SHGDN_Flags.SHGDN_FORPARSING<br />
,ref mySTRRET);<br />
<br />
<br />
myFileName = new string(' ',128);<br />
<br />
result = COMStuff.StrRetToStr(mySTRRET, relativePIDL, out myFileName);
The calling code above gets to the last line before crashing.. STRRET has all it's values set to the same PIDL, which is expected, as the type is identifiened by the type value. However, the type value remains 0 regardless of the flags on the STRRET structure returned by the GetDisplayName of.
The STRRET struct and the StrRetToStr method are declared as follows:
<br />
[StructLayout(LayoutKind.Explicit, CharSet = CharSet.Auto)]<br />
public struct STRRET<br />
{<br />
[FieldOffset(0)]<br />
public uint uType;
<br />
[FieldOffset(4)]<br />
public IntPtr pOleStr;
<br />
[FieldOffset(4)]<br />
public UInt32 uOffset;
<br />
[FieldOffset(4)]<br />
public IntPtr cStr;
<br />
}<br />
<br />
<br />
<br />
[DllImport("shlwapi.dll", CharSet=CharSet.Auto)]<br />
public static extern int StrRetToStr(<br />
ref STRRET pstr,<br />
IntPtr pidl,<br />
[MarshalAs(UnmanagedType.BStr)]<br />
out string pbstring);<br />
I'm certain that the error lies in either the declaration of my STRRET structure, or the implementation of StrRetToStr.
I'm going to experiment with the alternative method as well, StrRetToBuf, but I susspect a similar problem will occur.
If anyone could shed some light on this subject, it would be most grateful.
regards
Cata
|
|
|
|
|
You're not calling StrRetToStr with a ref . A struct - like I've said to you many times - is a value type. StrRetToStr requires it's address, so either use ref when declaring AND PASSING the parameter, or use GCHandle to get the address and free it when finished.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
My bad, I copied and pasted some code i had beed playing with and edited the ref out of, I am actualy calling it as a Ref. Like this:
result = myShellFolder.GetDisplayNameOf(relativePIDL,SHGDN_Flags.SHGDN_NORMAL | SHGDN_Flags.SHGDN_FORPARSING<br />
,ref mySTRRET);<br />
<br />
<br />
myFileName = new string(' ',128);<br />
<br />
result = COMStuff.StrRetToStr(ref mySTRRET, relativePIDL, out myFileName);
And it's still not working, the object is assigned a value to the union members, but it's type value remains 0. I'm not sure, if this is a problem with the strucure or the GetDisplayNameOf method.
Cata
|
|
|
|
|
Don't use out for the last parameter. A String is already a reference type. Also, when alloc'ing your myFileName variable, use '\0' (null) instead of a space. This makes sure that everything is properly null-terminated in case StrRetToStr does something differently.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I see, thanks Heath, it's running without incident now. However, my string is still unasigned after the StrRet call. The STRRET still comes out of the getName function with a type value of 0, and i'm sure that's wrong.
I played around with setting it manualy, but for values 1 and 2, it crashes, and for 3 I get a null string. I didn't think it would work, but had to try.
I can only think it would be the GetName method that's not working properly....
What are your thoughts?
Cata
|
|
|
|
|
Is there an easy way to draw a text on a path? Specifically if I have a curve and I want this text to go along that curve, how can I do that?
Thanks.
|
|
|
|
|
Werdna wrote:
Is there an easy way to draw a text on a path?
No. Lots of calculations and direct font manipulation (if you want to scew fonts) is required. Otherwise, you must trace along the path perpendicular to the normal and draw your fonts with the correct width (of each character, which requires quite a bit of calculations) and space between characters.
It's not as easy as it sounds (if you think this sounds easy). Photoshop CS just added text path support. It hadn't had it previously and there were only a few plugins available that provided such functionality. Just as an example.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks. That's what I thought. I got it to work on drawing on ellipse by using some math. It was a pain. Had to brush up on my trig.
|
|
|
|
|
I am designing an html redirector page now since the ip of my computer keeps on changing i developed an application to detect whenever there is a change in my computers ip address this ip address is stored in a variable in my application now i want to put this variable in html redirector page is it possible.
|
|
|
|
|
VIJAYPAPUPAGER wrote:
I am designing an html redirector page now since the ip of my computer keeps on changing i developed an application to detect whenever there is a change in my computers ip address this ip address is stored in a variable in my application now i want to put this variable in html redirector page is it possible.
If you are writing an application that requires a static IP then you should pay the extra money and get it, DHCP shouldn't be used when a static IP is required. That said, I suppose you could write a quick app that would poll your system for its IP address and store it in a hard file, whatever style you want, be it HTML, XML or your own flavor. It just doesn't appear to be a sound solution to your problem though.
- Nick Parker My Blog
|
|
|
|
|
In addition to what Nick said, you don't need to tell the ASP.NET application what your IP address is. It already knows. From with your page or control, just call Page.Request.ServerVariables["SERVER_NAME"] . This gets the hostname or IP address. There's other ways to get this, too, like Page.Request.Url.Host . If you like, the best place to store this would be in the Page.Application property - kind of like a session variables only they apply to the whole application so that the application can query the variables (like Page.Application["IPAddress"] ) and get the same thing everywhere.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
i want to distribute my C# app to a win98 platform... i installed the framework 1.1 redist on it and ran that app and this is what i get...
" ...some exception... cannot be handled.....[some process value]...[some thread value]..."
whats the conventional way of compiling an app to distribute?
isnt it simply , setting the mode to release instead of debug and then compile?
|
|
|
|
|
You can distribute a debug assembly. You just shouldn't. You compile like you normally would. C# compiles to Intermediate Language, which all .NET languages compile to. This is JIT'd into native code and executed on the machine, essentially like Java does. This is a fundamental concept of .NET.
Your error message helps none. Changes are you're using a class that only works on Windows NT. If you actually read the documentation as you develop (now there's a concept), the docs state which operating systems are supported. If you can't give us the full details to try to help you, then please don't post. This is as informative as something stupid like, "It doesn't work".
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
ok ok chill
my app cant be specific for NT(or for that matter any other) , coz its just a normal beginner c# app. i have used simple basic XML functions and general GUI stuff, so its nothing complex. but sorry for not informing you.
the err goes like ,
application has generated an exception that cannot be handled..
pid = 0xc70(3184) tid = 0xc78(3192),
|
|
|
|
|
Don't tell me to chill. When you post such an uninformative question, expect a uninformative answer. And yes, even some basic things (or things a beginning might think are basic) can be NT-only, like Opacity. You should understand what types you're using and members your calling. You'd be surprised at how much isn't supported on Windows.
This application exception looks more like a win32 exception, which means the .NET Framework isn't installed right. Was your application bult in VS.NET 2002 or 2003? 2002 only compiles for .NET 1.0, and 2003 only compiles for .NET 1.1. If you used the command-line compiler, which version did you use. While the .NET Framework is typically backward- and forward-compatible, it is not always.
Did you reboot after installing the framework? Is your app running locally or from across the network? There's code access security to take into account in those cases, although in Windows NT at least the message is different.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
.NET ent architect 2k2
i tried this out on systems running .NET 1.1 and 1.037, same err on both !
|
|
|
|
|
VS.NET 2002 builds for .NET 1.0, so make sure that .NET 1.0 (v1.0.3705) is installed. Since you said you did that, make sure you have the same service pack installed as you do on your system (you should have 1.0 sp2 installed). .NET 1.0 has not be released with sp2 included.
Finally, since it's Windows you must reboot. Even a few features in .NET require a reboot on Windows NT. It is a system-level component.
One other thing you can do (as opposed to using MessageBox , which is not a viable form of debugging and can't show you near enough) is to install the .NET Framework SDK on the machine and use cordbg.exe to step through a debug build of your application. Heck, for that matter, you can even try compiling your source using csc.exe that comes with the Framework (not the SDK). It will still compile whether certain Types or members are NT-only, but it could help determine if there are other errors when trying to compile your code (not necessarily with your code).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Ashwin C wrote:
" ...some exception... cannot be handled.....[some process value]...[some thread value]..."
whats the conventional way of compiling an app to distribute?
These errors are a pain in the ass to sort. First, I'd recommend building a default C# wizard generated application. See if that works. At least then you know that .NET is installed correctly on the Win98 machine.
If the basic app works, start commenting out code until your's starts working. (Alternativly, put a few MessageBox statements into your code flow and see how far it is getting)
You might want to try a Windows update and see if the 98 machine is missing any important updates.
Michael
But you know when the truth is told,
That you can get what you want or you can just get old,
Your're going to kick off before you even get halfway through.
When will you realise... Vienna waits for you? - "The Stranger," Billy Joel
|
|
|
|
|
Welcome to the .NET world.
I have personally dismissed .NET at all for the time being. From the many blocking issues I have had with deployment, I claim that .NET is not ready for prime time.
Deal with it.
If you want frightening weblog posts from CLR guys, let me know.
RSS feed
|
|
|
|
|
I have a developers control that I need to build that will do the following:
Uses FileDialog to let the developer point to a DLL.
Exposes all classes defined within that dll (not working yet)
Then exposes all methods defined within the selected class (not started yet)
I tried creating an AssemblyInfo and getting its' members but that did not work. I tried doing a Reflection.LoadFile and all I got was that my member was typeof(AssemblyInfo) (arg)
What is the sequence of reflection commands that I use to expose the classes of a given assembly??? I am assuming that once I get down the a specific class, I can use Type.GetMethods() of that class to get its' public/static methods.
Thanks in advance!
_____________________________________________
Of all the senses I could possibly lose, It is most often the one called 'common' that gets lost.
|
|
|
|
|
theRealCondor wrote:
I have a developers control that I need to build that will do the following
Reflector[^] has already been written, it's a great tool and you can even use it to see how he has done what you are asking for.
- Nick Parker My Blog
|
|
|
|
|
Nick,
Thanks for the response, but I have used Reflector for a long time but that is not what I need. I am exposing an object configuration editor for our proprietary web engine. I am trying to create an editor that is launched from the propertyGrid in my application so that when a developer wants to define a new object to our engine, they do not have to type all of the XML by hand and run the risk of errors.
Thus, I need them to point me at the DLL. Then I can expose the classes. And when they choose the class I can issue a System.Type.GetMethods() to let them choose which method to execute. Then, when all of the information is selected via dropdown boxes, I can format the proprietary XML file to define this object to our web engine.
_____________________________________________
Of all the senses I could possibly lose, It is most often the one called 'common' that gets lost.
|
|
|
|
|