|
hi,
i don't see why the code doesn't work??
i tried the code below and it worked fine.
you can use the save function to save the new image.
Bitmap bm = new Bitmap(@"c:\testimage.jpg");<br />
Graphics gr = Graphics.FromImage(bm);<br />
gr.DrawString("Hello Graphics", new Font("Verdana", 10),new SolidBrush(Color.Tomato), 1,40);<br />
gr.Dispose();<br />
bm.Save(@"c:\testimage2.jpg");
regards
|
|
|
|
|
Funny, it's working real fine now
Thank you so much 1119
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
you're still not cleaning up your resources.
using (Bitmap bm = Bitmap.FromFile(@"c:\Hamtaro.jpg")/* as Bitmap */)
{
using (Graphics gr = Graphics.FromImage(bm))
{
using (Font f = new Font("Verdana", 10))
{
gr.DrawString("HelloGraphics", f, Brushes.Red, 1, 40);
bm.Save(@"c:\Hamtaro.bmp");
}
}
}
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 )
|
|
|
|
|
It's working fine now, thanks Christian.. You are a good man
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
One more question Christian
Can you tell me how do I set the modified bitmap now to a picturebox control??
Thanks a bunch
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Just pass it to the control. mypicturebox.Image = bm;
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 again
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
This's C# not Excel.. You have all the tools, do it yourself
My small attempt...
|
|
|
|
|
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
I got resolution problems on computers that run my Windows C# Form application. For e.g. a Label are stretched in under its matching TextBox. The problem occurs on laptops with widescreen. What can be wrong?
_____________________________
...and justice for all
APe
|
|
|
|
|
You need to check the anchor property on your controls. If they are right, they will fit to any size screen.
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 )
|
|
|
|
|
Yes I use Anchor. It works perfect on most computers...
_____________________________
...and justice for all
APe
|
|
|
|
|
Have you checked out the dpi settings in the display properties? These are sometimes set to a non-default value on wide screens.
Standards are great! Everybody should have one!
|
|
|
|
|
I concur.
Check your screen resolution (calculate the number of pixels in the diagonal),
and measure the diagonal (in inches). Divide resolution/diagsize and then adjust
the DPI setting (which is a percentage of 96 dpi !!) with Display Properties/Settings/
Advanced.
Example:
Dell Inspiron 17" with 1920*1200 pixels
diagonal = SQRT(1920*1920 + 1200*1200) = 2264 pixels
diagonal = 16.6 inch (measured!)
hence 2264 / 16.6 * 100/96 = 142%
When you set this value, everything on the desktop will probably shrink;
your labels with fit their intended position and size; your desktop labels might
be too small for easy reading (you may want to enlarge it through Display Properties/
Appearance/Font Size).
On the other hand most objects now get their intended size (in inches, not in pixels)
which is fine; some things will become too small, typically some web pages that
for some reason dont follow the preferred text size ("Normal", "Larger", whatever),
but instead use a fixes font size (say 8 pt).
To cope with that, I developed a simple tray tool to temporarily switch screen resolution to a 30% lower value.
Hope this helps.
|
|
|
|
|
we have a "Solver" method in Excel.
can i use that thru my C# application.
i want to do the same which the solver doing, from the code
My small attempt...
|
|
|
|
|
sujithkumarsl wrote: we have a "Solver" method in Excel.
This's C# not Excel.. You have all the tools, do it yourself
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
if you dont know the answer,you are not suppose to reply
keep ur keep silence
My small attempt...
|
|
|
|
|
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
It's possible to import Office UI into C# using the Microsoft Office Toolkit, or something. That would be the way to do this.
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 )
|
|
|
|
|
i dont want to display that in the ui. i just want to call the solver with values as parameter and i am expecting the output.
can i use this as dll?
My small attempt...
|
|
|
|
|
How to create folder with c# for a active directory user in homedrive.
jayesh talsaniya
|
|
|
|
|
Environment.SpecialFolder.Personal;
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Thanx for reply.
Please, Can i have some more hint on how to create homedrive folder for a activedirectory user.
thank you.
jayesh
|
|
|
|
|
hi,
I've got this part of code
<br />
public delegate void DellagacjaVoid();<br />
<br />
public void pingowanie()<br />
{<br />
if (this.InvokeRequired)<br />
{<br />
DellagacjaVoid delegacja = new DellagacjaVoid(pingowanie);<br />
this.Invoke(delegacja);<br />
}<br />
<br />
string sciezka = "plik.txt";<br />
if (File.Exists(sciezka))<br />
{ <br />
FileStream fs = new FileStream(sciezka, FileMode.Open, FileAccess.Read);<br />
StreamReader reader = new StreamReader(fs);<br />
string linia = reader.ReadLine();<br />
linia = null;<br />
while ((linia=reader.ReadLine()) != null)<br />
{<br />
try<br />
{ <br />
richTextBox1.Text += linia + "\n";<br />
}<br />
catch (Exception ex)<br />
{<br />
MessageBox.Show(ex.Message);<br />
}<br />
}<br />
reader.Close();<br />
}<br />
}<br />
<br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
Thread watek = new Thread(pingowanie);<br />
watek.Start(); <br />
}<br />
the thing is that the content i read to the richtextbox alright, as many lines as there are in the txt file but also I get as many exeptions as number of lines with the text like this:
http://img444.imageshack.us/img444/6911/88524168zy6.png[^]
can someone help?
|
|
|
|
|
You cannot set the Text property of your rich textbox from another thread as the one it was created on. You should first create the content string (you're better of using the StringBuilder class by the way, it's faster) and then assign it to the rich text box's Text property from the thread it was created on.
Standards are great! Everybody should have one!
|
|
|
|