|
KingTermite wrote:
Now....what HTML are you talking about?
Any aspx page is has a .aspx file and a .cs file. The cs file is your code behind, the aspx file is your page, containing all your HTML, including the asp: tags that denote controls. When you're in the form designer, at the bottom of the page is a 'html' tab, if you click on it, you can hand edit the files. This is definately the way to go, and you should set up your preferences to always go here instead of the designer, for the reasons I mentioned.
And if it were me, I'd create a new control in a project, then copy and paste the html and C# code into it, then change the namespace of the class to match the project, and try to use the control in a page. Unless it's a server control, that's just a cs file, but I'd do the same with that. Not least is the fact that you could then set break points and step through the constructors, etc. to figure out what is going wrong.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Christian Graus wrote:
Any aspx page is has a .aspx file and a .cs file. The cs file is your code behind, the aspx file is your page, containing all your HTML, including the asp: tags that denote controls. When you're in the form designer, at the bottom of the page is a 'html' tab, if you click on it, you can hand edit the files. This is definately the way to go, and you should set up your preferences to always go here instead of the designer, for the reasons I mentioned.
I'll look into what you guys are talking about. Right now I don't see it...I don't see an HTML tab and there are not aspx file (there are some resx files though...maybe that's it?).
Anyway...I think I figured out my problem. There are two controls that I ported (with the exception of using the form designer, I did it exactly as you described for me to do it, Christian). The control that I kept trying (thinking they were all basic controls) was actually a control that contained another control or two within it...since there was nothing there, it was throwing the null exception.
I tried the other control (name didn't sound right to me for what I wanted), but actually turned out to be the control I wanted and was a basic control thus yielded no errors.
There are only 10 types of people in this world....those that understand binary, and those that do not.
|
|
|
|
|
Glad it worked out, I've worked out something too. I'm in the C# forum, not the ASP.NET forum. You therefore are probably working on a GUI app and you have no aspx files, no HTML. Sorry, my bad.
Just out of curiosity, is this app for internal use only ? If not, why are you using C#, does your target audience all have the .NET runtime, or will you only distribute on CD, or do you consider the business lost to people unwilling to download the runtime to be negligible ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Christian Graus wrote:
Glad it worked out, I've worked out something too. I'm in the C# forum, not the ASP.NET forum. You therefore are probably working on a GUI app and you have no aspx files, no HTML. Sorry, my bad.
Yes, its a C# app....I guess that is why no aspx files.
Christian Graus wrote:
Just out of curiosity, is this app for internal use only ? If not, why are you using C#, does your target audience all have the .NET runtime, or will you only distribute on CD, or do you consider the business lost to people unwilling to download the runtime to be negligible ?
This will be an internally used app, so distributing the .Net runtime will not be an issue in this case. If the computers don't already have it, the runtime will be included with the install eventually.
Our company does primarily embedded software and test software for host computers to test that embedded software. So we don't have mass produced PC software....so that's never been an issue for us. We sell the entire test sets, computer and all....so if we develop something in .Net, then the software, framework and all will already be on the computer when it is sold to the customer as a "test set".
This allows us to develop, as long as customer has not dictated something special, in whatever environment/language we want (although 90% is currently in C/C++ right now). We have just a few groups that are trying to get a little more cutting edge and trying to bring some new technologies into the arena.
There are only 10 types of people in this world....those that understand binary, and those that do not.
|
|
|
|
|
How can i use the ping utility in my program.
I need to ping a particular IP address and display the result.
|
|
|
|
|
There's two options:
1. Run the ping program by launching it. There's LOTS of examples out there on how to launch a console program and redirect its stdout and stderr back to you.
2. Figure out the ping protocol and write some socket code to do it yourself.
I'm guessing #2 wouldn't be that hard to do, but I've never looked at ping myself.
I, for one, do not think the problem was that the band was down. I think that the problem may have been that there was a Stonehenge monument on the stage that was in danger of being crushed by a dwarf.
-David St. Hubbins
|
|
|
|
|
Written a GDI package; But now need to:
1.Develop Code which allows shape objects to be dragged (moved) and resized by implementing grab handles. Write a key handler such as when the delete key is pushed the shape dissapears.
Difficult as my shapes arnt saved in array!
2.Add advanced features such as current co-ordinate position of the mouse.
I think this would involve mouse_move and some text boxes
If you can help, i'll send you a zip of my project.
email2miles@yahoo.com
|
|
|
|
|
Miles Roberts wrote:
1.Develop Code which allows shape objects to be dragged (moved) and resized by implementing grab handles. Write a key handler such as when the delete key is pushed the shape dissapears.
In order to do this, each shape will have to be an object so that you can individually manage it. In your MouseDown event, determine if a shape exists under the mouse and begin tracking that shape (perhaps a private field that represents the currently dragging shape). In the handler for MouseMove determine if the mouse is down and if an object is being dragged. If so, shift the coordinates of the object be dragged and call Refresh to invalidate your form and repaint those regions (it would actually be better to invalidate the region previously occupied to the whole form doesn't have to repaint). In your MouseUp handler set he new position of the shape and clear the field that tracks the currently dragging shape.
Miles Roberts wrote:
2.Add advanced features such as current co-ordinate position of the mouse.
Actually, this is pretty easy. The MouseEventHandler passed to you in the handler for the MouseMove event contains the X and Y coordinates of the mouse in the coordinate space of the control that raised the event (such as a Form or Panel onto which you're painting your custom shapes). Just use those and display them in a StatusBar or something:
private void myForm_MouseMove(object sender, MouseEventArgs e)
{
this.statusBar.Text = string.Format("X={0}, Y={1}", e.X, e.Y);
}
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I suggest if you dont have a plan, that you sit down and make a proper design ASAP. Probably most of the stuff can be stored in a GraphicsPath object.
2. Not advanced, but look at Control.MousePostion
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
Received in private email (less attachment nogals):
"The attached file is my working project, if u have any time free, could u implement some grab handles in there? I really havent got time to do this, its due tommorrow.
I think i can get the co-ordinate task done.
Miles"
The answer is NO NO NO, do it yourself. If you cant do it, why the hell are you doing IT in the 1st place.
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
Dear code gurus,
i'm trying to create a non-rectangular window using a bitmap as background image and setting its transparency key. This works fine, however msdn claims that non-rectangular windows wont work on graphics cards currently displaying more than 24-bit colour, which is true.
My question is, how is MS Media Player doing it anyway if my card is displaying 32-bits?
cheers
|
|
|
|
|
Windows Layers. See SetLayeredWindowsAttributes in the Platform SDK at http://msdn.microsoft.com/library[^].
Odd. Both the Form.TransparencyKey and Form.Opacity use Windows Layers (see SetLayeredWindowsAttributes in the Platform SDK at http://msdn.microsoft.com/library[^]) with either the LWA_COLORKEY or LWA_ALPHA flag, respectively. For transparency keys, a COLORREF is used, which is a typedef for a DWORD , a 32-bit unsigned integer. The COLORREF documentation states that the high-order byte must be zero (the normal alpha byte) but as long as it is zero, I don't see why a graphics card in 32-bit mode would cause problems. Perhaps driver problems?
In any case, you can use the old way: window regions. You must override painting (override OnPaint in your form) and set the Graphic.Clip property to a region (use GraphicsPath to create an odd region) that determines which region is valid for painting. Everything else is not painted and, hence, shows what's behind it. This was really the only way to do it before Window Layers, which is only supported in Windows 2000 and higher.
The thing that puzzles me is that Windows Media Player skins use a color mask. Logically, that color would be the transparency color used with Windows Layers. Perhaps they are only using that color to designate a clipped region.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
nibmike wrote:
This works fine, however msdn claims that non-rectangular windows wont work on graphics cards currently displaying more than 24-bit colour, which is true.
Isnt that 24-bit and less? True transparency only works on 32-bit ARGB and indexed palleted formats like GIF.
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
Folks,
For bizarre reasons, I need to be able to generate random strings that will be matched by a given regex.
i.e. given [a-z][a-z1-9][qrst]
I want an algorithm that will generate
abs
z9q
dvt
et cetera...
Anyone hear of anything similar? Or maybe you know a simple regex parser that I cannibalize?
(C# preferable, or a C related language)
Thanks,
Brett
DTrent
|
|
|
|
|
It's obviously pretty easy to code one for each individual regular expression by hand, but something that generates a random string for ANY given regular expression seems like it would be fairly complicated. I'm pretty sure there's nothing in the base classes for this. It would definitely have to understand the regular expression syntax you're using.
How would you handle something like:
[a-z]*
That means zero to "infinite" lower case letters basically. Would your random generator have an upper limit on cases like that? Would you want zero's to occur more often than other numbers?
I wish I could help more, but I've never heard of anyone doing this (haven't really searched or anything though). Let me know how it turns out.
I, for one, do not think the problem was that the band was down. I think that the problem may have been that there was a Stonehenge monument on the stage that was in danger of being crushed by a dwarf.
-David St. Hubbins
|
|
|
|
|
I have a simple C# Regex lib designed for a lexer, rather than normal RE. I'll send you the code and if you can use it, i would dearly love to have it Obviously you would be credited (just place a gpl on your source).
Reply to this message so I grab your email
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
Thanks,
That might help a lot!
DTrent
|
|
|
|
|
I am using a the Microsft Animation Control to play a status animation and would like to know if there is a .NET version of this control or something like it that someone has made because COM is Butt-Slow.
Or if someone has a better way todo this using anything please tell me.
TIA
|
|
|
|
|
|
FYI, most controls in the .NET Base Class Library (BCL) are just wrappers for the Windows Common Controls or - in some cases (like with the WebBrowser control in .NET 2.0) - are just out-of-the-box COM interop classes. You could try searching CodeProject or google the 'net for examples, but most likely these will just encapsulate native functionality anyway. The beauty of .NET is that you don't have to create everything from scratch.
You might also check out the Managed DirectX class at http://msdn.microsoft.com/directx[^]. Implementing this is non-trivial so be sure to read the documentation. There's also a couple articles here on CP, though the ones I've seen don't deal with animation besides sprites (sequence of static images).
If you need the status animation to play immediately, one alternative might be to instantiate the control and load the animation when the class that uses it is initialized, making sure that the animation is in the stopped state. When you need to show it, make the control visible and start the animation. When finished, stop the animation and hide the control and don't dispose it if you'll need it again. You'll get a faster response this way and the user will see immediately that something is going on. Of course, don't forget to set the wait cursor for further affect (and to stop processing mouse messages) using Cursor.Current = Cursors.WaitCursor . Don't forget to set it to the default again when done. Just my $0.02 to add to the user experience.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks for the hefty answer, I'll try all that
------------------
I'm naked under my clothes...
|
|
|
|
|
Hi,
I have inherited from the DirectX class to play audio files.
public class MyAudio : Microsoft.DirectX.AudioVideoPlayback.Audio
{
public string MyFile;
public MyAudio(string str) : base(str)
{ }
public MyAudio(string str, bool bln) : base(str, bln)
{ }
}
In my code:
MyAudio newAudio = (MyAudio) MyAudio.FromUrl("http://web.com/46.mp3", false);
When I run this app it gives an error on the above line:
"Specified cast is not valid" !
The declaration of FromUrl func is :
public static Microsoft.DirectX.AudioVideoPlayback.Audio FromUrl ( System.String address , System.Boolean autorun )
How can I fix this problem ? I need to inherit from this class as I want to save the name of the file this object is playing !
Thanks,
Paul
|
|
|
|
|
Why are you trying to cast a reference type of MyAudio to MyAudio.
That is in effect saying "This green cup is green"(Absolutely Pointless).
Or is there some specific reason it needs to be there.
If it doesn't that might be your problem.
|
|
|
|
|
If you see the definition of FromUrl:
public static Microsoft.DirectX.AudioVideoPlayback.Audio FromUrl ( System.String address , System.Boolean autorun )
it returns a Microsoft.DirectX.AudioVideoPlayback.Audio object. So if I don't typecast it to MyAudio, it gives a compilation error.
Paul
|
|
|
|
|
In this function:
public static Microsoft.DirectX.AudioVideoPlayback.Audio FromUrl ( System.String address , System.Boolean autorun )
the signature states it returns an instance of the "Audio" class. You can't convert "Audio" to "MyAudio" because "Audio" doesn't derive from "MyAudio" (the reverse is true). If the function returned a "MyAudio", you could convert it to "Audio", but the other way around would never work.
If I understand what you're trying to do, you should consider creating a constructor for your "MyAudio" class that takes an "Audio" instance as a parameter.
I, for one, do not think the problem was that the band was down. I think that the problem may have been that there was a Stonehenge monument on the stage that was in danger of being crushed by a dwarf.
-David St. Hubbins
|
|
|
|
|