|
Hello @ all
I have a problem with my generated PNG - Images.
It's a bit strange for me but may be someone now what i can do to solve this problem.
My windows service create on the fly PNG - Images and store them as binary in a database.
The stored images are displayed later with a crystal report in a windows app.
That works very fine since years and also with different pc's (most XP-OS), but there is a problem with a new PC (XP-OS) since a few days.
All images are displayed shrunken in the reports and it's not the whole report.... only the images. Text- and Report still proportional.
Could it be that something is missing at the new machine ?
Any ideas how this could be ?
Thanks a lot!
Bitmap couponImg = null;
Font font = null;
Graphics graphic = null;
try
{
couponImg = new Bitmap(coupon.Width, coupon.Height, PixelFormat.Format24bppRgb);
using (graphic = Graphics.FromImage(couponImg))
{
graphic.Clear(coupon.BackgroundColor);
graphic.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
graphic.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
graphic.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
graphic.TextContrast = 0;
graphic.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
graphic.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
if (coupon.couponCellCollection != null && coupon.couponCellCollection.Count > 0)
{
for (int idx = 0; idx < coupon.couponCellCollection.Count; idx++)
{
font = new Font(coupon.font, (float)coupon.couponCellCollection[idx].fFontSize, FontStyle.Bold, GraphicsUnit.Millimeter);
graphic.DrawString(coupon.couponCellCollection[idx].sCellValue, font, Brushes.Black, new PointF(coupon.couponCellCollection[idx].iPosX, coupon.couponCellCollection[idx].iPosY));
font = null;
}
}
graphic.DrawImage(couponImg, new Rectangle(0, 0, coupon.Width, coupon.height), 0, 0, coupon.Width, coupon.height, GraphicsUnit.Pixel);
graphic.Flush();
}
}
}
catch (Exception)
{
couponImg = null;
}
finally
{
if (graphic != null)
{
graphic = null;
}
}
|
|
|
|
|
Hi
Got stuck here. Word document gets saved in the correct directory with the correct name but the typed text doesn't persist. Please help. (*I have tested that the text is actually typed in the active document).
private void SaveDoc()
{
Word.Application wdApp;
Word.Document wdDoc;
wdApp = new Word.Application();
wdDoc = wdApp.Documents.Add(ref missing, ref missing, ref missing, ref missing);
//type some text
wdApp.Selection.TypeText("Some Heading"));
//set rtf doc paragraph 1 style to normal
object wdParaStyleName = "Heading 1"
wdDoc.Paragraphs[1].set_Style(ref wdParaStyleName);
//save rtf doc
wdApp.ChangeFileOpenDirectory("C:\\test\\");
object wdFileName = "TestDoc.rtf"
object saveFmt = Word.WdSaveFormat.wdFormatRTF;
wdApp.ActiveDocument.SaveAs(ref wdFileName, ref saveFmt, ref falseO, ref missing, ref falseO, ref missing, ref trueO, ref falseO, ref falseO, ref trueO, ref falseO, ref missing, ref falseO, ref falseO, ref missing, ref falseO);
//Quit Word
object saveChanges = Word.WdSaveOptions.wdDoNotSaveChanges;
wdApp.Quit(ref saveChanges, ref missing, ref missing);
}
Using doc.save() prompts the save dialog which defeats the purpose of automation.
Thanks
GJ
|
|
|
|
|
mailtogj wrote: object saveChanges = Word.WdSaveOptions.wdDoNotSaveChanges;
Documentation: This example includes the wdDoNotSaveChanges argument of the Close method to close without saving changes or prompting the user.
Try using the SaveAs() method.
|
|
|
|
|
object saveChanges = Word.WdSaveOptions.wdDoNotSaveChanges; This saves without the inserted text.
SaveAs() also doesn't work for inserting text. Could i possibly catch the save as event for the word application.
|
|
|
|
|
Hi all,
I am trying to catch the delete event from an Outlook appointment item. I can
get it working using the "Item.BeforeDelete" event but if the appointment is
a recurrence and you delete one occurence from the recurrence the
event is'nt triggered. Does any one know a way around this ?
Many thanks in advance
Kind regards,
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
|
|
|
|
|
Hi
I've got a web service running on a BackgroundWorker which updates the weather in a specified time limit. I've also got a combobox listing a whole bunch of cities. Now the thing is, in the Do_work event of the backgroundworker I update the weather and let the thread sleep for a couple of minutes, and if the user selects a new city, the user has to wait the specified amount of time before it updates. How can I get the weather to update say every 10 minutes, but as soon as a new city is selected, don't wait 10 minutes, and instead update the weather as soon as a new city is selected.
Is there a way to restart the BackgroundWorker perhaps?
|
|
|
|
|
You might want to consider using a ManualResetEvent[^]. In the background thread use the WaitOne method. When the user selects the city, trigger the event and the background thread should continue its processing of the new weather information, otherwise the timeout period will occur and it will refresh as expected.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
A better solution is a combination of a timer and a backgroundWorker.
Add a Timer with the interval set to 10 minutes In the timer Tick event call a new Method, say UpdateWeather . In your new UpdateWeather method test the backgroundWorker IsBusy property and if it is not busy call RunAsync .
The code to change city can then call the same UpdateWeather method.
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
www.JacksonSoft.co.uk
|
|
|
|
|
Understanding that a Timer actually creates a background thread, how is this a "better" solution?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
There is an alternative:
- do not use a BGW
- use a System.Threading.Timer with due time equal to 0, and an infinite period (that makes it a one-shot timer).
- in the timer callback method:
* get the weather info;
* use the InvokeRequired/Invoke pattern[^] to update the GUI;
* set the timer due time to 10 minutes using the Change() method.
- when the user chooses another city, set the timer due time to 0 so it ticks right away.
The advantage is there will be 10 minutes in between weather operations, so they cannot possibly overlap; and you don't need any synchronization. The disadvantage is you need the Invoke stuff for the GUI.
Luc Pattyn [Forum Guidelines] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
modified on Monday, November 16, 2009 2:11 PM
|
|
|
|
|
hi is there a way of changing one of the properties of a nullable rectangle.
for example.
private Rectangle? m_RectangleShape;
m_RectangleShape.Value.X = value;
The above is along the lines of what i am looking for, a way to change the x value
Current attempt:
public int X
{
get
{
return m_LocationX;
}
set
{
ShapeRect = new Rectangle(value, m_LocationY, m_SizeX, m_SizeY);
}
}
|
|
|
|
|
Before you can set properties on a nullable rectangle you have to initialise it. It is also best practice to test the HasValue property before setting properties of the value, though not needed at this point.
Rectangle? m_RectangleShape = new Rectangle?();
m_RectangleShape.Value.X = ValueType;
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
www.JacksonSoft.co.uk
|
|
|
|
|
I have drawn a graph where at the moment the X points for the bars (drawn using boxes) is draw using numbers, but I now need to draw it using time. Im drawing boxes using a class. It is written in C# opengl.
public void DrawBox(float p_X1, float p_X2, float p_Y1, float p_Y2, float p_R, float p_G, float p_B)
{
X1 = p_X1;
X2 = p_X2;
Y1 = p_Y1;
Y2 = p_Y2;
R = p_R;
G = p_G;
B = p_B;
//Take the values passed in by the constructor
Gl.glBegin(Gl.GL_POLYGON);
Gl.glColor3f(R, G, B);
Gl.glVertex2f(X1, Y1);
Gl.glVertex2f(X2, Y1);
Gl.glVertex2f(X2, Y2);
Gl.glVertex2f(X1, Y2);
Gl.glEnd();
}
Thanks
|
|
|
|
|
Hi there,
Im working a web browser automation project. There is an ajax controlled dropdown list in a web site.
It was like this;
<option value="test1">test1</option>
<option value="test2">test2</option>
<option value="test3">test3</option>
<option value="test4">test4</option>
<option value="test5">test5</option>
When i was selected test2 ajax is working and its giving another div. (I need this div)
I use this codes;
webbrowser1.Document.GetElementsByTagName("select")[0].Document.GetElementsByTagName("option")[1].SetAttribute("selected", "selected");
Its only changing attribute and for this reason it doesnt working ajax.
How can i select option 1?
Thanks.
|
|
|
|
|
Try this:
webbrowser1.Document.GetElementsByTagName("select")[0].InvokeMember("index", 0);
|
|
|
|
|
Sorry, it doesnt working.
I can try a lot of thing but i cant work it.
|
|
|
|
|
And this one:
Object[] args = new Object[1];
args[0] = (Object)"0";
HtmlElement elem = webbrowser1.Document.GetElementsByTagName("select")[0];
elem.InvokeMember("index", args);
|
|
|
|
|
Thank for your replies. But i cant run your codes.
You can be try yours method in this pages (http://fatihunal.somee.com/default.aspx) via a web browser object.
Please click test3 from option box via a web browser object. In this way you will see the problem.
Thanks.
|
|
|
|
|
Yes, at last end i have done it.
webbrowser1.Document.GetElementsByTagName("select")[0].Document.GetElementsByTagName("option")[2].SetAttribute("selected", "selected");
webbrowser1.Document.InvokeScript("__doPostBack");
Its working perfectly.
Thanks for all.
|
|
|
|
|
Hi everyone
I developed a software but somehow (by mistake to be honest) in the beginning I used MS SQL Compact Edition
the system works fine, but I know that compact edition is very limited than Sql Server 2005
According to my algorithm, every entered record creates several tables.
This works good.
But I'm a bit nervous about latter stages
Does this Compact Edition has a table cap?
for example, after 5000. table created, does the DB gives an error like "DB table quantity limit reached" or sth like that?
I know it sounds ridicilous but I've encountered numerous ridicilous errors since I started this project
modified on Monday, November 16, 2009 8:00 AM
|
|
|
|
|
|
Hi,
I've been googling a long time about this, so I thought you peeps might have an answer for me.
I have a application which has been written in .net1.1 a long time ago. I ported that application to .net2.0 (one step at a time ) and left the code the same as much as I could. Everything works, except one thing which I cannot figure out why not.
I have this service, which is listening on a port on the same server as the client runs on. My client in this case is a configuration editor with some basic functionality like getting the time the last synchronisation ran etc.
The service is called the StatusPublisher.
I initialize the the publisher object for use with this call:
*****.IStatusPublisher publisher =
(*****.IStatusPublisher)Activator.GetObject(typeof(*****.IStatusPublisher),
string.Format("tcp://localhost:{0}/StatusPublisher", servicePort));
This is the call which works in .net1.1 but fails in .net2.0:
string returnValue = publisher.NextRun (serviceId);
This call locks up the complete config-tool, kinda forever (killed it after 50 minutes). I had a logging step between every code block, but the logger before the publisher.NextRun() logged fine, everything after was a complete lock up.
Any idea why I can instantiate the publisher object but cannot call a method from it?
The consumer isn't a moron; she is your wife.
modified on Monday, November 16, 2009 7:41 AM
|
|
|
|
|
I can't help you there. I Have search on MSDN and can't find any info on IStatusPublisher. I only can presume that it is not shipped with .Net Framework. If you or your own company is author, then investigate, or contact a technical support on official forum or to author/company
|
|
|
|
|
It's one of our own clases which is an class implementing MarshalByRefObject. It's actually quite the same as MarshalByRefObject only adding some methods.
internal class StatusPublisher : MarshalByRefObject, *****.IStatusPublisher
{
public string NextRun(string serviceId)
{
}
}
Thing is, I can load this class, but I cannot call the methods on it. So it must go wrong higher up the chain, which is .Net code I think.
The consumer isn't a moron; she is your wife.
|
|
|
|
|
have you tried removing Internal keyword?
Or tried add public in front of class?
Is this class a DLL?
Helfdane wrote: Thing is, I can load this class, but I cannot call the methods on it
When you set your debugger, in Quick watch can you use method or what kind of error will throw?
|
|
|
|
|