Gzoom subgurim asp.net don´t work - asp.net

we're using a subgurim gmaps for show to the users maps in a web application in asp.net web forms. Now in the map we're loading a kml and after with information of the database create a polyline that represent a route of a employee.
Using map.GZoom = 15 for example for apply a zoom this don't work, always appear in the same zoom independent of the value. It's strange because when loading the map if you see zooming, but then this is not maintained.
This is the method used in the page load
Private Sub cargarMapa()
Try
GMapTrampas.GZoom = 10 ' Zoom
GMapTrampas.Height = 600
GMapTrampas.enableHookMouseWheelToZoom = True
'Load the kml save in google sites
Dim rutaMapa As String = implementacionMapa.listarRutaMapaGeneral()
GMapTrampas.Add(New GGeoXml(rutaMapa))
GMapTrampas.DataBind()
Catch ex As Exception
End Try
End Sub

Related

log in to a webpage and capture screenshot in vb6

I have a visual basic 6 application that needs to get pictures from a particular website but the problem is that the users have to open the webpage on the browser and log in to the webpage then download the picture and upload it in the vb6 app. Is it possible to have the vb6 go to that webpage and log in and capture the screenshot and save it in a particular folder without opening the browser?
The url opens the login page by default and you have to log in first, to access the picture page, which we just have to take a screen shot and crop it.
Is this possible in pure VB6?
Here is some VERY generic code that will log you into a website. It is basically a matter of finding the controls in the browser document and filling in the correct values. Since you have provided no code to build on it's up to you to fill in all the correct values. This is using Microsoft Internet Controls to add a browser control to a form.
Private Sub Form_Load()
Dim i As Integer
WebBrowser1.Navigate ("http://URL of the page you want to go to")
Do While WebBrowser1.ReadyState <> READYSTATE_COMPLETE
DoEvents
Loop
If InStr(WebBrowser1.LocationURL, "http://targetwebsite/login.aspx") Then
On Error Resume Next
For i = 0 To WebBrowser1.Document.Forms(0).length - 1
' Uncommenting the MsgBox method will display the control names and help find the controls you are looking for
'MsgBox WebBrowser1.Document.Forms(0)(i).Type & ", " & WebBrowser1.Document.Forms(0)(i).Name
If WebBrowser1.Document.Forms(0)(i).Type = "text" Then
WebBrowser1.Document.Forms(0)(i).Value = "user name"
End If
If WebBrowser1.Document.Forms(0)(i).Type = "password" Then
WebBrowser1.Document.Forms(0)(i).Value = "user password"
End If
Next i
' now find and click the submit button
For i = 0 To WebBrowser1.Document.Forms(0).length - 1
If WebBrowser1.Document.Forms(0)(i).Type = "submit" Then
WebBrowser1.Document.Forms(0)(i).Click
End If
Next i
End If
' You should now be logged in and loading the page you want
End Sub

VB.NET WebBrowser Object Captures Remote Web Page At Low Resolution

Background
I have an ASP.NET web application with a VB.NET back end. In this application users can create payment requests which must be approved by a manager before they are sent to accounts payable for further processing. Within my request page (the page where the user enters the request information) I have a button that links to a separate .aspx page which provides a print preview of the request. When the request is approved by all of the required approvers, I have a VB.NET function that contains a WebBrowser object that navigates to the print preview page behind the scenes and takes a snap shot of it, then saves it as a .tiff file to an internal file share which is then picked up by a internal process and imported into another internal application called OnBase to go through processing for accounts payable.
The Problem
My problem is that when the my function takes the snap shot of the print preview page, the saved tiff has a lower resolution than desired. In other words, it looks kind of crappy when it is viewed through OnBase and when it is printed out.
The Question
How do I increase the resolution of the generated .tiff file at the time that the snapshot of the webpage is generated?
The Code
Private Sub CaptureWebPage()
Try
Dim tiffFileName As String
tiffFileName = OnBasePath & "CheckRequest_" & CurrentRequestId & ".tiff"
Dim impersonateCode As New AliasAccount("TheUsername", "ThePassword")
impersonateCode.BeginImpersonation()
Dim browser As Windows.Forms.WebBrowser = New Windows.Forms.WebBrowser
browser.ScrollBarsEnabled = False
browser.ScriptErrorsSuppressed = True
browser.Navigate(OnBasePath & htmlFileName)
While browser.ReadyState <> Windows.Forms.WebBrowserReadyState.Complete
System.Windows.Forms.Application.DoEvents()
End While
System.Threading.Thread.Sleep(1500)
browser.ClientSize = New Size(950, 768)
Dim Height As Integer = browser.Document.Body.ScrollRectangle.Bottom
browser.ClientSize = New Size(950, Height)
Dim bmp As Bitmap = New Bitmap(browser.Bounds.Width, Height)
browser.DrawToBitmap(bmp, browser.Bounds)
If File.Exists(tiffFileName) Then
File.Delete(tiffFileName)
End If
If File.Exists(OnBasePath & htmlFileName) Then
File.Delete(OnBasePath & htmlFileName)
End If
bmp.Save(tiffFileName.ToString(), ImageFormat.Tiff)
bmp.Dispose()
impersonateCode.EndImpersonation()
Catch ex As Exception
Throw
End Try
End Sub
Additional Information
I have tried to use the .SetResolution method of my bitmap object, but it doesn't actually change the resolution of the generated .tiff file. I have tried to Google this numerous times find a solution, but haven't found anything useful.
Thanks In Advance
Screen "resolution" is much lower than print "resolution". Typically desktop monitors are around 100ppi, where a normal printer on a desk might be 600dpi.
The only suggestion I have for getting a higher resolution rendering of the web page would be configure what is grabbing the screenshot to use a resolution 3x what you are using now, and then set its zoom to 300%. Text elements and vector graphics will be rendered smoothly. Images will still be their web resolutions, and you may even lose image quality through interpolation when sizing up.
You could try and print the page to a virtual print driver in PDF format. I have found OnBase sometimes does strange things with image files, it doesn't like colour or grey scale TIFFs. Instead use JPEG for colour / grey scale.

Get updated image in flex image control after changing source not name of file(image)?

I am changing image through flex every time i change it saved into server directory with same name(which i am referring to show). So when i refresh my page my browser didn't send new request to server since it's already in request.so didn't getting new image.Tip:- when i clear browser history it will come with new image
You can try adding an additional time-stamp to the image source each time u make a new request, which would make the request look different for the browser.
Example :
var src:String = "image.png";
src = src + "?" + new Date().getTime().toString();
Since you mentioned that you're refreshing the browser, then I assume that your embedded SWF file will also need to be refreshed.
When you embed your SWF, you need to add a parameter that would be random across all time (i.e. datetime stamp, etc.)
var mySWF = "swf/YourEmbeddedFlashFile.swf?guid=" + rnd();
and declare a js function:
function rnd()
{
return String((new Date()).getTime()).replace(/\D/gi, '')
}

WF4 - Display workflow image in asp.net and highlight an activity

I need to display current status of a document approval workflow task in asp.net web page with a specific activity highlighted.
I have seen the Visual workflow tracker example (in wf & wcf samples) but I have two issues,
I have to render workflow in asp.net not in a WPF app.
I don't need to display current status with workflow running, all activities that need to be highlighted are the ones that require user input. e.g. "waiting for approval from department head" etc.
If I could just convert the workflow XAML to JPG after highlighting a specific activity by activity id "that created a bookmark and waiting for resumption the bookmark" it would do the work.
check the attached file for required workflow image to be rendered on asp.net page:
Workflow with current activity highlighted (that is waiting to be resumed)
First load the workflow into the designer.
You should already know the 'activity' you want highlighted. There is selection service in the workflow you can use to select the appropriate model items. This example shows single selection, but there is multiple.
ModelService modelService = wd.Context.Services.GetService<ModelService>();
IEnumerable<ModelItem> activityCollection = modelService.Find(modelService.Root, typeof(Activity));
Selection.Select(wd.Context, activityCollection.ElementAt(5));
On the workflow designer there is a button to copy workflow as image or something along those lines. This link will show you how to get the jpg from the WorkflowDesigner.View.
http://social.msdn.microsoft.com/Forums/en-US/wfprerelease/thread/b781c8df-608a-485a-80e3-a795d800f08d
const double DPI = 96.0;
Rect size = VisualTreeHelper.GetDescendantBounds(view);
int imageWidth = (int)size.Width;
int imageHeight = (int)size.Height;
RenderTargetBitmap renderBitmap = new RenderTargetBitmap(imageWidth, imageHeight, DPI, DPI, PixelFormats.Pbgra32);
renderBitmap.Render(view);
BitmapFrame bf = BitmapFrame.Create(renderBitmap);
using (FileStream fs = new FileStream(#"c:\test.jpg", FileMode.Create))
{
JpegBitmapEncoder encoder = new JpegBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(bf));
encoder.Save(fs);
fs.Close();
}
As an added note you should check out Kushals example:
http://blogs.msdn.com/b/kushals/archive/2009/12/22/visualworkflowtracking-aka-workflowsimulator.aspx

ASP.Net links won't disable if done during postback

I'm still fairly new to ASP.Net, so forgive me if this is a stupid question.
On page load I'm displaying a progress meter after which I do a post back in order to handle the actual loading of the page. During the post back, based on certain criteria I'm disabling certain links on the page. However, the links won't disable. I noticed that if I force the links to disable the first time in (through debug) that the links disable just fine. However, I don't have the data I need at that time in order to make the decision to disable.
Code Behind
If (Not IsCallback) Then
pnlLoading.Visible = True
pnlQuote1.Visible = False
Else
pnlLoading.Visible = False
pnlQuote1.Visible = True
<Load data from DB and web service>
<Build page>
If (<Some Criteria>) Then
somelink.Disable = True
End If
End If
JavaScript
if (document.getElementById('pnlQuote1') === null) {
ob_post.post(null, 'PerformRating', ratingResult);
}
ob_post.post is an obout js function that does a normal postback and then follows up with a call to the server method named by the second param. then followed by the call to a JavaScript method named by the third param. The first parameter is the page to post back to. A value of null posts back to the current page.
The post back is working fine. All methods are called in the correct order. The code that gives me trouble is under the code behind in bold. (somelink.disabled = True does not actually disable the link) Again, if I debug and force the disabling of the link to happen the first time in, it disables. Does anyone know what I might do to get around this?
Thanks,
GRB
Your code example is using the IsCallBack check, while the question text talks about the IsPostback Check. I'd verify that you're using Page.IsPostBack in your code to turn off the links.

Resources