|
Hi everyone
I have a valid HTMLImgClass element that I retrieved from the web browser component. I need some help converting this element into a Bitmap object. There are no obvious methods in the HTMLImgClass that I could see for converting a Bitmap. Someone during my google suggested using the local path to the file via localhost and loading it that way.
I am looking for any suggestions.
Thanks for your time.
Dave
test
|
|
|
|
|
Doesn't that element contain a path to an image and the browser downloads and renders it ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
The element has an href with the path to the object. In the case Im dealing with it's an object that gets dynamically created on a server. Anyway I got it..
Here it is for anyone ever interested
string href = imgageElement.href;
WebRequest webrq = WebRequest.Create(href);
Bitmap bmp = (Bitmap)Bitmap.FromStream(webrq.GetResponse().GetResponseStream());
Dave
test
|
|
|
|
|
I can't use this way.
The object InternetExplorer.Aplication maintain open your session.
If you use webrequest, this open other session and can't get image of the session of internetexplorer.application.
Saludos,
Luis Alfredo Lozada Portal
Microsoft DCE3
Trujillo - Perú
|
|
|
|
|
I have the same problem that I want to access the graphics of the element already loaded into the page. Alternatively, I just want to get the number of bytes that compose the picture. Is there really no way to access the bytes binary image of the element loaded within the System.Windows.Forms.WebBrowser control?
I understand the solution with getting the address of the image and WebRequest-ing it, but this picture address does return a different picture each time. Yes, I might avoid the problem by loading the picture again but I would not be able to push it to the element, so I would have a different picture on the screen and in my program.
Is there any way to access it from the browser cache?
Thanks.
|
|
|
|
|
Hi, you can access from the cache using
tempDir = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache).ToString();
and simply getting the file from there.
Since it seems to have been some months since you asked this did you find any way to get the image directly from the browser because i am trying to do something similar but the file isnt saved in the cache for me and i cant just make a new request to the src because it returns a different image.
|
|
|
|
|
hi
i have a database in sqlserver2000 and i want to convert it to access 2003 . how to do ??
thanks ..
|
|
|
|
|
If you use things like stored procedures and triggers, they can't be exported to Access.
You can use the export wizard or DTS to export the data to an Access database.
---
b { font-weight: normal; }
|
|
|
|
|
Hi everybody
I'm trying to recreate the tutorial for webbrowser automation that is posted in code project using c# 2005.
this tutorial shows how to get into google, write something in the text area, and than click the search button.
I've wrote this kind of app in c# 2003 many times, but in c# 2005, it seems that I just cannot find a way to click the search button.
can anyone explain how to do that? thanks alot!
|
|
|
|
|
K here is my problem, I have been racking my brain doing other things but cannot come up qith a way to make a polygon follow a line.
For instance, If I create a line Like this
<br />
Point[] lnePoints = new Point[]{new Point(10, 10), new Point(100, 10),<br />
new Point(100, 70), new Point(300, 70)};<br />
I want to draw a line but I want to Draw a polygon around this line, kind of like a focus shape that surrounds the line, not a rect or square
I started a function to do it but it got waaay to out there and never made it right, any Suggestions.
|
|
|
|
|
|
|
For each line calculate a new line offset the desired distance outwards (I hope you know what direction outwards is, if not I guess it is possible to find out, but I can't remember how - Google it).
For each calculated line, calculate the intersection with each of the neighbouring calculated lines. These are the new points.
There is a catch though - some of the very short lines might no longer be needed. If you after the intersection calculation get a line where the direction between the points are 180 degrees offset from the original line, then throw away this calulated line. This of course means you must recalculate the intersection points of the neighbouring calculated lines as they now intersects each other instead of your line.
Sorry if it is not clear - I did my best in a short time. Oh, and I do in no way claim this algorithm is fastest or easiest way to do this, but it should work.
Alternatively (depending on your needs) you might get away with drawing the outline with a wide pen (twice as wide as you want the focus area to extend) and then filling the polygon with the same color. This will basically draw the sourounding polygon you requested, but if you can use this "drawing" for anything depends on how you use it further on.
|
|
|
|
|
You're going to need to build a path that follows the line in the manner you've described, offsetting your points by a given factor so you draw all around it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thank you for your replys, I pounded it last night and almost got it done, here is what I did in a nutshell. I made two functions, one calcs one offset from the line and one calcs the other offset of the line.
I went through each point in the point array first I check to see which Direction it has come, then I check to see which direction it will be going, then I offset the new point accordingly. Sounds easier than doing it that's for sure. Have some kinks to work out but, In a nutshell I pass each function the point array of the origional line calculating both sets of the offsets, then I combine them together in order by adding each point to another point array the first set in order, then the second set in reverse order, add then to a path object then draw.
|
|
|
|
|
Hi everyone,
I have this small project. It reads from a file and populates a DataGridView. It has been working great when there were only 100 or 200 rows, but now there are 750 and it doesn't work well at all. I'm not sure what I am doing wrong.
When you first enter the page, there is a "SYNC" button. This opens the file, reads from it and populates the datagridview. Well, you can hit SYNC as many times as you want. What I am doing is when you press that button, clear the datagridview, and then re-populate it. I have tried DataGridView1.Rows.Clear(), and I have also tried ForEach loops that run a Rows.Remove() and Rows.RemoveAt() with no luck. I have 751 rows in there, and I have a message box pop up before it begins the Rows.RemoveAt() routine, then another message box that pops up after the foreach loop. It is taking like 30 seconds (I'm on a very very fast machine) to do this, and 98% of my system resources go to it. I'm not sure if it is trying to sort, or redraw or do something each time it deletes a row out of there or what. When the Rows.RemoteAt() routine finishes it has done what needed to be done (cleared out the datagridview completely), but it just takes way too long. I'm not sure exactly what it is that I can do to speed this up?? Any help would be extremely appreciated.
|
|
|
|
|
I need to create a form to act as InputBox like in VB6.
When I write, string temp = InputBox.Show(); it displays the form where I need to insert some text and click ok so that temp variable is set to text entered in InputBoxes text field.
I want to design each of my InputBoxes from the forms I added to my Project.
How can I make this kind of form?
|
|
|
|
|
Make the form of type dialog. Then when you show the form use ShowDialog instead of Show. You can then check the DialogResult to see what action the user returned. Create the form any way you want.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Thanks, that helped a lot.
Becouse I don't want to create an instance outside the InputBox, I've created a method inside the form.
public static string InputBox()<br />
{<br />
string tmp = "-1";<br />
frmReason reason = new frmReason();<br />
reason.ShowDialog();<br />
<br />
if (reason.DialogResult == DialogResult.OK)<br />
{<br />
tmp = txtReason.Text;<br />
}<br />
<br />
return tmp;<br />
}
This way I just need to call InputBox method: MessageBox.Show(frmReason.InputBox()); and I will get a form, write any text, and after clicking on ok (or enter) MessageBox will Show that text.
Thank you Ennis, very much.
|
|
|
|
|
I'm at a position where I cannot step thru my code to see where my problem is at. So I've got message boxes everywhere catching exception. So what is the best way to debug when you can't be there. Right now I'm catching the exception showing the message, the source, and the stack trace. Which I must admit is a little confusing. Any other suggestions.
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Why do you say you cannot debug through your code?
I think you could use
catch (Exception ex)
{
System.Diagnostics.Trace.WriteLine(ex.Message + " " + ex.StackTrace);
}
|
|
|
|
|
I'm sorry, I meant I cannot step thru my code to see where my problem is at. Reason is this is socket app that requires a secured connection and that is on a network on the east coast.....I'm in the midwest.
Currently I am do the try and catch but putting it to a message box instead of the Trace function. I'll try that and see what the results are.
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
When you use Trace you can have the code running without pressing the OK of the MessageBox and writing down the message on a piece of paper, while all the messages are going to be written in the Output window, so I would say it's more convenient.
I hope it helps.
Cheers
|
|
|
|
|
It is the most arduous but it really works when it has too.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Hi. I'm very new to Visual C#. I was wondering if someone could help me print the contents of a pictureBox.
I would like to be able to print just the image and be able to control the size of the image as well as the location of the image on the page.
Please help if you can.
|
|
|
|