|
Hi , i am actually beginner with C#, so i have a simple question. I Have a form "Form1.cs" and "Form2.cs" so
when i press button , in "Form1.cs" , i want simply the Form2 dialog to show up.
And one more thing how can i programatically set font
of a textBox ??
Regards
m0n0
m0n0
|
|
|
|
|
1st question:
If you want to show a second window you hav 2 option - show it as dialog or as free window
here a sample to show it as dialog (the easier way):
Form2 f = new Form2();
f.ShowDialog();
2nd question:
you can change the font of a textbox in the following way (this is the visual studio auto generated code if you change it in the designer):
this.textBox1.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
|
|
|
Thanks hooray for attention.
Could you help me with one more problem ,
i want to save to text file(*.txt) what textBox contains
Thanks in advance
m0n0
|
|
|
|
|
you just have to open an streamwriter object (in the namespace System.IO) and then write the string to the file.
string str = textBox1.Text;
StreamWriter sw = new StreamWriter(@"1.txt");
sw.Write(str);
sw.Close();
|
|
|
|
|
Thanks!
i guess @ means that the file will be saved there from where the program is launched? and is there smth like @ but the file will be saved in windows folder.(like regedit has
%system%).
And i have problems setting oppacity programatically, i do following
this.Oppacity = 50;
but it does not work , i think it needs smth like Updatedata() ???
Best Regards.
m0n0
|
|
|
|
|
the @ means the special chars like '\' will not be interpreted.
for example:
@"c:\1.txt" == "c:\\1.txt"
(for me - I just getting used to use it as standard)
The Opacity could not be set to the value of 50. The Opacity is a float value - so if you like to reach 50% opacity you should set it to 0.5
|
|
|
|
|
|
hi,
i have a problem with the window_moved event of the internet explorer. i have an IWebBrowserApp object and get the events through a DWebBrowserEvents2_Event interface. i connect the browser object to the events with the following code:
member_WebBrowserEvents2 = member_IWebBrowserApp as SHDocVw.DWebBrowserEvents2_Event;
then i delegate the setLeft event handler to my function with the following code:
member_WebBrowserEvents2.WindowSetLeft += new SHDocVw.DWebBrowserEvents2_WindowSetLeftEventHandler(SetLeftFunction);
this doesn't work . all other events like e.g. TitleChange or OnQuit work. i need the event when the user moves or resizes the browser window. the WindowMove event listener of the SHDocVw.DWebBrowserEvents_Event interface doesn't work too. does anyone has a solution for this problem?
thanks for help
|
|
|
|
|
I have just completed a big C# project and have descoverd that i have to create a variable list, i was wondering if there is a way of automatically creating this in visual studio. or do i have to go through each line to manualy create it?
any help?
|
|
|
|
|
|
A list of the variable names for strings, int, char and arrays. it also can have object names like memory streams and networkstreams.
i hope thats cleard it up a bit
|
|
|
|
|
I don't think there's something like this in VS (well, intellisense and the member dropdowns use this info, but I don't think you can export it).
But using reflection you can build this functionality on your own.
Regards,
mav
|
|
|
|
|
hi
if i have the yaw,pitch,roll angels and the legnth of an obect (line for example) which is drawen for example from point 0,0,0 how can i calculate the coordinates of the end of line point (x,y,z)
thanks for help
|
|
|
|
|
First of all I have to say, that I really have some difficulties to understand what your problem is!
There seems to be a problem with your question!
When you have a line starting at one point, and you also got the 3 angles vor x, y and z, then you need to know the length of that line to calculate the end point!
Have a look at vector maths.
Don't try it, just do it!
|
|
|
|
|
hi
thanks for your reply
i already tried to make that using the matrixtransformation but the output is not correct :
x1=X*m.M11+Y*m.M21+Z*m.M31+1*m.M41;
y1=X*m.M12+Y*m.M22+Z*m.M32+1*m.M42;
z1=X*m.M13+Y*m.M23+Z*m.M33+1*m.M43;
where x1,y1,z1 is the new point of the old x,y,z point after the rotation Matrix m is applied which contains the yaw,pitch,roll rotations
so what is the problem ? any suggestions?
thanks
|
|
|
|
|
Hi there on CodeProject. This is my very first post here.
I need a quick an easy way of building a visual tree (n-ary with the root at the top) in C# using some sort of extra GUI graphics package. I have looked at the netron project website but i choose to create a thread here since i need a quick an painless solution - fast. I am new to C# but have a good understanding of OOP from experience with Java.
So if somebody know how to do this - please give some tips or better yet - some source code I know of the TreeView Class, but it do not like the way it is drawn. I need the tree with the nodes of the same level/height drawn adjacent to eachother.
You know - like this:
() (root)
/\
/ \
() ()
/\ \
/ \ \
() () ()
Please - I need this to work fast.
Intel4004
|
|
|
|
|
In this case you should create a UserControl and then override the OnPaint method.
After that you can start to draw this tree by your own.
As far as I know there is no easier way to do this and there is no way around to do the drawing by your own.
|
|
|
|
|
Hello,
I have written Client and Server applications in C-Sharp language. They are communication with each others using sockets. The problem is that when client connects to the server, and if i disable the network (disconnect the network cable) at client side, it does not give any notification at the Server side that client is abnormally disconnected. I have put the code in try...catch, where I am reading client stream and i expect that i get an exception at server side in this case... but i don't (Note: I do get exception here if my client and server are running on same machine).
Anybody has any idea how to handle such situation.
Thanks,
Kamran
|
|
|
|
|
You shuld implement somethink like a check, maybe every 3sec a ping or somethink.
|
|
|
|
|
You should check for such an exception constantly. I would place a timer with the try..catch block inside and set the interval to 1000 or something like that.
Polis.
Can you practice what you teach?
|
|
|
|
|
Hi !
I have a very large 2D matrice of double values (10000 x 10000 cells). How can I convert this matrice into an image so that I'll be able to plot the values ? looping over the cells and drawing with GDI is out of the question.
Thanks
|
|
|
|
|
I don't see how you're going to be able to plot anything without looping over the cells somehow. Also, plot the image on what? It's going to be 10,000 pixel by 10,000 pixels. The screen is out of the question to plot an image that big. It all depends on what and how you want this image to be displayed. If it's acceptable to show the entire image inside the screen dimensions, alot of detail will be lost, but you can shorten the time it takes by mapping pixel coord onto the matric and only return the values at those pixel coords.
For instance, 1024, 768 on the screen would map to 10000, 10000 in the matrix.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Dave,
Of course I'll have to loop over the cells and to loose information when displaying the smaller picture. The question is how am I displaying the picture ?. I can define a Bitmap object (smaller than the array) but how can I display the bitmap without saving it on H.D. ?
Thanks
|
|
|
|
|
Create a custom control, its the easiest.
override OnPaint(PainteventArgs pea)
{
Bitmap b = new Bitmap(10000,10000);
pea.Graphics.Transform = new Matrix(Width/10000f,0,0,Height/10000f,0,0);
pea.Graphics.DrawImage(b);
b.Dispose();
}
xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots
|
|
|
|
|
Hi,
can anyone suggest some source code to read XML files.
Any help would be much appreciated...
Cheers
|
|
|
|