|
can i know how to use StartCap and EndCap members of Brush class.i need to use LineCap or nt?can i have some sample code of how to create.thank you.can i do it like this way.
m_PenToDrawWith = new Pen(Color.Red);
m_PenToDrawWith.EndCap=System.Drawing.Drawing2D.LineCap.DiamondAnchor;
|
|
|
|
|
Is it possible to convert a string to an int in C#?
Thanks!
- monrobot13
|
|
|
|
|
There is an Int32.Parse(string) function, but it will throw an exception if the string is not an integer.
|
|
|
|
|
Convert.ToInt32(string str); as well
MyDUMeter: a .NET DUMeter clone "Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of."
|
|
|
|
|
Here's the deal - I have two programs. One is a utility program used to create objects and serialize them to disk. The second program is the real application which, in time, will be able to deserialize these objects and use them.
When I serialize and deserialize within the utility program, I have no problems. However, when I try to deserialize within the main program, I get an error that looks like:
"Type is not resolved for member MyNameSpace.MyClass, MyNameSpace."
I was getting a different error earlier, but I was able to make it further by setting the assembly names to be the same in each program. Is that necesarry and the correct thing to do?
Storing code, roughly:
<br />
Stream myStream = File.OpenWrite(m_sFileName);<br />
if (myStream != null)<br />
{<br />
BinaryFormatter formatter = new BinaryFormatter();<br />
formatter.Serialize(myStream, m_object);<br />
}<br />
Loading code for both programs, roughly:
<br />
if (myStream != null)<br />
{<br />
BinaryFormatter formatter = new BinaryFormatter();<br />
m_object = (MyObject)formatter.Deserialize(myStream);<br />
myStream.Close();<br />
}<br />
Any help is appreciated!
Marcus Spitzmiller
"Why must life be so hard? Why must I fail at every attempt at masonry?" - Homer
|
|
|
|
|
Try to use the Binder property of the formatter. This interface can be used to search for types of different assemblies. Another solution is to put all the assemblies in the GAC.
|
|
|
|
|
Thanks Davide - I will try this out and get back to you.
Marcus Spitzmiller
"Why must life be so hard? Why must I fail at every attempt at masonry?" - Homer
|
|
|
|
|
Davide - I managed to work this out. Thanks for the help, but it turns out that I'm just not very familiar with the IDE yet. I had some references messed up, and once I straightened it out, it serialized with no problems, and no customizations.
Thanks again
Marcus Spitzmiller
"Why must life be so hard? Why must I fail at every attempt at masonry?" - Homer
|
|
|
|
|
Probably a dumb question, but does anyone know if it is possible to issue HLT instructions using C# ?
|
|
|
|
|
Please help...
I am trying to do something in a loop while letting the user press the keyboard when he/she sees something I put on screen. So I decided to time his/her response time using Form1_KeyDown.
But the problem is: when the user hits the key, the event seems to be queued or buffered. And I never got to the Form1_KeyDown code until the for loop is over.
Could anybody help?
Thanks
private void menuLoop_Click(object sender, System.EventArgs e)
{
for (int i=0; i< 100; i++)
{
//do something here
Console.WriteLine("Loop #{0}", i);
}
}
private void Form1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
long tick;
Win32.QueryPerformanceCounter(out tick);
Console.WriteLine("Current tick: {0}", tick);
}
|
|
|
|
|
private void menuLoop_Click(object sender, System.EventArgs e)
{
for (int i=0; i< 100; i++)
{
//do something here
Console.WriteLine("Loop #{0}", i);
Application.DoEvents();
}
}
Paul
And you run and you run to catch up with the sun, but it's sinking Racing around to come up behind you again The sun is the same in a relative way, but you're older Shorter of breath, one day closer to death - Pink Floyd, Time
|
|
|
|
|
Hello everyone,
The problem is simple:
in my class I obtained a type using reflection GetType.
Type t = Type.GetType(my_StringT);
NOW: how should I cast a variable to type obtained???
simple cast doesn't work...
Object my_NewType = (t) my_OldType; -> here the compiler told that
type or namespace 't' could not be found.
So, how should I use obtained type to cast my variable????
Thanks,
Don Miguel.
|
|
|
|
|
Don Miguel wrote:
So, how should I use obtained type to cast my variable????
You dont. This has riddled my mind a few times, but I have realise this is NEVER necessary.
MyDUMeter: a .NET DUMeter clone "Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of."
|
|
|
|
|
leppie wrote:
You dont.
Is this impossible??
leppie wrote:
this is NEVER necessary.
how is that???? I don't understand.
|
|
|
|
|
Don Miguel wrote:
how is that???? I don't understand
What exactly is the point of this code?
Type t = Type.GetType(my_StringT);
Object my_NewType = (t) my_OldType;
Line 1: You are getting a Type object called my_StringT. Fair.
Line 2: Now this line screams of errors! lets start right to left.
- what is my_OldType? OK, the compiler cant assume, but I can. Is it a Type object or an instance of that Type? See?
- (t) . You can only cast to a type. Is t a type? No, it is a Type object. A class name is a type.
- Object my_NewType: Why are you casting in the first place? All objects downcast automatically to their parent types, iow object.Just like most OO languages, everything is an object of type Object (the root/parent/mother class).
Now think again what your are trying to do, and if in fact it is necessary. You get what I am saying? Feel free to ask some more questions.
Cheers
MyDUMeter: a .NET DUMeter clone "Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of."
|
|
|
|
|
Thanks for your patience with me, until now.
leppie wrote:
Is t a type? No, it is a Type object. A class name is a type.
With above, you pointed me in right direction. I was really confused,
finally I realise what I intent to do.
Was a mess in my mind
Don Miguel
|
|
|
|
|
Don Miguel wrote:
Thanks for your patience with me, until now.
Hey, I never stop being patient...
Don Miguel wrote:
I realise what I intent to do.
Was a mess in my mind
That was what I was hoping you would see
MyDUMeter: a .NET DUMeter clone "Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of."
|
|
|
|
|
I want to display 3 additional property tabs when a particular object in my project is selected. However, I cannot associate more than one tab with my class because the PropertyTabAttribute doesnt allow multiple instances (AttributeUsage.AllowMulltiple = false ).
This is especially confusing since the PropertyTabAttribute class clearly supports the addition of multiple tabs as is evident by its help page.
Can anyone tell me some other way of doing it?
Regards,
Umair Ahmad
|
|
|
|
|
I want to use IHtmlPainter,IElementBehavior,IElementBehaviorFactory with C# to draw grid in web browser like visual studio .net IDE's Web Form Designer.
guangxu qin
|
|
|
|
|
Hi all -
I have a problem I hope one of you can help me with.
I have created an addin to VS.NET - the addin worked perfectly fine during the time I developed it. Today I finalized the installer and began final testing - then suddenly I couldn't execute any of my commands. I get the error: "Command "Namespace.Class.Name" is not available."
I have tried whatever I could think of but nothing works. Any of you have any idea of what could be the problem?
I have come across something about the commands or the addin should be registered in the registry - but I lack more info about that.
Thanks in advance -
----
Edit:
5 min. after I posted this thread I found the problem.
Somehow I must have deleted the last part of this line:
public class Connect : Object, Extensibility.IDTExtensibility2, IDTCommandTarget
So it read:
public class Connect : Object, Extensibility.IDTExtensibility2
I know - stupid me. Sorry to have bothered you all with this post.
|
|
|
|
|
thanx for your tips but i still cannot move the shape from one position to another.i want to ask i have a lot of rectangle in the form how can i know which rectangle i have select to move and can i remain the size of the rectangle when i move and can i see the effect of the move when i move the rectangle.thank you for help me answer the question.
|
|
|
|
|
I'm trying my best to decipher your question, forgive me if I've understood it wrong
By the sounds of it, what you need to do is create a custom control that inherits from System.Windows.Forms.Control, create an OnPaint override to draw your rectangle image, and override the MouseDown, MouseUp and MouseMove events to implement drag-and-drop style moving on your Form surface.
|
|
|
|
|
how can i delete a specific amount of bytes (say 10) from a certian area of a open file (in this case location 0)...or if that cant be done..how can i open a file from a special point (say 10 bytes ahead of the start) FileStream.Read(bytelength,offset,totallengthtoread) ??
thanks alot
Jesse M
The Code Project Is Your Friend...
|
|
|
|
|
The only way to delete bytes from a file would be to copy it to another file, skipping the bytes you don't want. For what you want to do, try this:
FileStream fs = File.OpenRead(filename);<br />
fs.Seek(10, SeekOrigin.Begin);<br />
|
|
|
|
|
thanks alot for the help furty =)....still lookin for a way to embedd the salt bytes.....i can do it with the above code snip. thanks alot for all the help furty.......
Jesse M.
The Code Project Is Your Friend...
|
|
|
|