CefSharp BrowserControl - Image Hyperlinks open in new Form - c#

Hope somebody could give me some advice or point me into some direction.
Im using CefSharp Browser Control in an application, one if the things that im struggling with is when i click on Image Hyperlinks (or any hyperlinks for that matter) it shows a Windows Form where the image is displayed, i fiddled around in the RequestHandler on the OnBeforeBrowse method and added the following:
if (ValidateURL(request.Url))
{
System.Diagnostics.Process.Start(request.Url);
return true;
}
return false;
Where the ValidateURL does some REGEX checks.
What i have noticed is that a Windows Form (Blank Windows Form) still opens up and the image on my Browser (expected).
Where can i double check to not show the blank Windows Form, or hide it?
Version:
Chromium 39.0.2171.95 CEF: r2069, CefSharp: 39.0.2.0
Regards
Jean

Related

How do I display an image when I click a button (Like MessageBox.Show)?

How do I display an image when I click a button ? Like MessageBox.Show, it will open a new window. Unfortunately MessageBox only do it on text. how about images ?
As a suggestion how about if you:
Create a new windows form instead with PictureBox inside.
Load the image on the PictureBox before showing it
Use Form.ShowDialog(this)
Return DialogResult upon clicking the buttons you define in your windows form
we can create image (or) pic to be clickable links by using this code
<a href="http://www.w3.org"><img src="w3c_home.gif"
alt="World Wide Web Consortium Home"
width="72"height="46"border="0"/></a>see in this blog
http://www.facebookliteapp.com/2015/06/facebook-lite-for-Android-pc-laptops.html

Why is my Form on top when I hover over a GMap.NET control?

I have a GMap.NET control on my main form, and then I have a second form that will show when the user clicks on a button. The problem is, that when the user leaves the second window and hovers over the GMap control from the main form, the main form comes to the front. This does not happen when i hover over the rest of the main window with the second window on the front. Also I have another form that will show while the program searches for some data, and this one will also disappear when the user hovers over the map.
I hope I explained it well enough, basically when I hover over the map the main window comes to the front. And it does only happen when there is another form of my project in front of it, not when there is any other window like firefox or something in the front.
So my question is: why does this happen and can I change this behavior? Is it a standard of the GMap.NET control? I am using the Version 1.7.0.0 control btw.
you must use
GMap1.DisableFocusOnMouseEnter = true;
i added this code to my program and problem solved.
It would help to see some code as to how you are showing the forms, but it sounds like you are doing something like secondwindow.Show() instead of secondwindow.ShowDialog(), and then an event from GMap for OnEnter is doing a Focus().
Then, when you have the "other form" in front of it, it's opened in a way that will restrict access to the parent form (ShowDialog(), etc).

ProgressIndicator wraps content on page

Im creating an app where the startpage is an login screen. When user enter their credentials and finally taps the login button an Progressindicator Dialog is being shown. The dialog is based on an Window Popup. The window and the indicator works like a charm but there is one problem. The indicator is wraping the content on the page. So if you for example entered the wrong credentials and tapped the login button the inticator will dissapear to give the user one more chance to enter their right credentials. But when the indicator dissapear the Rememember Me Checkbox position is changed, it's getting placed over the login button. It seems like the Indicator Dialog is wraping the content on the page. Im a pretty good css & html developer so i wonder if there are something like in css called z-index or is it possible to set the position of the checkbox to absolute so its position aren't based upon other elements position. I used this guide to make this indicator.
http://blogs.msdn.com/b/priozersk/archive/2010/09/20/creating-progress-dialog-for-wp7.aspx
Thanks
Problem solved. As i copied the sample code from the orginal project to my own there was a few variables that i had to change the value of to work with my project. Including the height and the width of the object and so on. Anyway, it works like a charm now.

How to hide form header when switching between forms on Winmobile 6.5

I have two simple forms designed in maximized view. when switching between them (showing second and hiding first), the second form first shows its header for some miliseconds. Than the header dissapears.
How to avoid showing the header?
Thanks.
This is a tricky one. You can use SetWindowsPos windows api call. To move the header out from the screen. Then when closing the application or on a crash you can put it back. This trick can cause some problems, when there are background stuff happening in windows. I use this only when switching between .exe - form files.
I think a better solution for this problem is to use one Form, but have different UserControls. It will look something like this.
public class MainForm : Form
{
public void AddView(UserControl view)
{
SuspendLayout();
Controls.Add(view);
ResumeLayout(true);
}
}
Have you set the FormBorderSytle to None?

how to launch a default browser instance within a program window?

I am creating console app, involving lots of services. I want to display a webpage within my program window. I know how to launch a new window ( http://dotnetpulse.blogspot.com/2006/04/opening-url-from-within-c-program.html )but I was wondering can I ask a browser to render a webpage withing my program window (in C#) ?
The best solution would likely be to use the WebBrowser control.
This can be placed on a form and allows the web page to appear inside your application.
Here is a nice example of how to go about implementing it http://ryanfarley.com/blog/archive/2004/12/23/1330.aspx
Hope this helps
Use the WebBrowser control and pass it the URL of the web page to render.
In your Windows form, something like (off the top of my head so may need tweaking to get it to compile):
WebBrowser browser = new WebBrowser();
browser.Dock = DockStyle.Fill;
this.Add(browser);
browser.Navigate("http://www.myurl.com");
In a Form you can use WebBrowser Control... in a Console Application there is no way wihout opening a new form.... but you could:
design a form with a Webbrowser Control
hide its border and showintask = false
Open it at a position in your Console-Window

Categories

Resources