First of all, I am a real newbie to programming in Visual Studio. That being said, I have created a small program that pops up an Internet Explorer window; I now want to replace the Internet Explorer icon in the top-left corner with the project's icon.
Currently, I am opening the window in C#, using the ShDocVw object:
static void Main(string[] args)
{
SHDocVw.InternetExplorer IE = new SHDocVw.InternetExplorer
{
AddressBar = false,
MenuBar = false,
StatusBar = false,
ToolBar = 0,
Visible = true,
Height = 768
};
IE.Navigate2("http://someURL/page.aspx");
}
What I want to replace is the IE icon in the top-left corner (see included picture). The icon is in my project as a resource, and appears on the .exe.
Screen capture of IE header
Is there a way to change the browser icon here?
After checking the SHDocVw InternetExplorer Interface and test it on my side, it seems that there is no way to change the IE window icon on the left via the SHDocVw library.
From your description, I suggest you could try to create a WPF or Windows Forms application, then use the WebView or WebView2 control to display the web content. In this scenario, you could add the custom icon for the WPF or Windows Forms window. screenshot like this:
About how to set the window icon, please refer to the following methods:
To the WPF application, try to use the following code (set the Icon property):
<Window x:Class="WpfApp1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp1"
mc:Ignorable="d"
Icon="favicon.ico"
Title="MainWindow" Height="450" Width="800">
<Grid>
</Grid>
</Window>
More detail information, please check Setting the application icon in WPF
To the Windows Form application.
Right click the Form, in the Properties , it contains the Icon property, click the ... button to select icon.
Related
How can hide the opened child windows from taskbar when I am showing and hiding the child windows even when I hide the child window the hidden window still appear in the taskbar WPF?
Thanks in advance,
Here is an Example how I show the dialogs:
AlignLocalAxisView alignLocalAxisView = Container.Resolve<AlignLocalAxisView>
(new ParameterOverride("model", AttributesSelectedItems));
OpenedWindowView = alignLocalAxisView;
alignLocalAxisView.Show();
There should be a ShowInTaskbar property for the window.
If your window is defined in XAML, you can set the property deliberately as shown below:
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="MyApplication.MainWindow"
Title="MainWindow"
Height="350" Width="425"
ShowInTaskbar="False">
You can also set this in your code behind:
this.ShowInTaskbar = false;
This is also applciable to a window created in code behind when called by name.
Window myNewWindow = new Window();
//Set the property to keep the window hidden in the task bar
myNewWindow.ShowInTaskbar = false;
//Then, show the window
myNewWindow.Show();
EDIT: Based on your example code, the following should work
AlignLocalAxisView alignLocalAxisView = Container.Resolve<AlignLocalAxisView>(new ParameterOverride("model", AttributesSelectedItems));
OpenedWindowView = alignLocalAxisView;
//Assuming your view extends the Window class, the following will work
alignLocalAxisView.ShowInTaskbar = false;
alignLocalAxisView.Show();
Hopefully, this will be enough to sort the problem out.
For future reference though, this was a fairly quick solution to look up on google - its generally worth searching for an answer first as it can sometimes be a faster way to solve the problem.
in this case, I reworded your issue to "hide task bar icon for window in wpf". The child window part wasn't really needed in the search, as all windows in WPF are basically the same.
I hope that's of some help.
I'm trying to disable the maximize capacity (not the maximize button) in a wpf window, but so far nothing has succeded.
I'm using a window with WindowStyle="none", but when I drag the window to the far top of the screen, the OS "maximizes" the window (terribly bad, by the way).
I uploaded 3 pictures to show what is happening exactly.
(however, due to the fact that I don't have 10 reputation, I have to post the links instead. Sorry about that. And I can't put all 3 links, only 2 of them, but the first one is just of the window working normally)
During:
After:
use the window state change event:
private void Window_StateChanged(object sender, EventArgs e)
{
if (this.WindowState == System.Windows.WindowState.Maximized)
{
this.WindowState = System.Windows.WindowState.Normal;
}
}
Set MaxHeight,MinHeight and MaxWidth,MinWidth property for the window.
Example
<Window x:Class="test.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" MaxHeight="350" MaxWidth="525" MinHeight="350" MinWidth="525">
</Window>
How do you disable Aero Snap in an application?
I am new here, I want to set an Icon on the left side of my program(WPF).
I copied it in an Image folder.!
Code:
<Window x:Class="Hotelverwaltung.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Icon="..\Fachlogik\Images\icon.png" Title="Hotelverwaltung"
Height="350" Width="525" Loaded="Window_Loaded">
After you posted the image, I see the image is in a different project. That's important to know.
Make sure the Build Action for you image is set to "Resource".
Make sure the Hotelverwaltung project references Fachlogik.
Then try setting the location like this:
Icon="pack://application:,,,/Fachlogik;component/Images/icon.png"
You can't set a relative path like that to go between projects.
You used the right property. Just make sure that the image is included in the project (right click on the image in the Solution tree and choose 'Include in project'). Then set the Icon property using the properties window in VS. That should do it.
Try setting the Image path like this
Icon="pack://application:,,,/Hotelverwaltung;component/Fachlogik/Images/icon.png"
Check this link for more details about XamlParseException XAML Parse Exception - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
excuse me for my bad English.
I know that many conversations were made for this type of problem but none answer my specific problem...
I am currently improving a Wpf Application coded in C # and xaml in Microsoft Visual Studio Express 2012 for Windows Desktop.
I would like to remove the navigation bar at the top of my window and maximize it. In my xaml file I do:
NavigationWindow x:Class="WpfAppTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
WindowState="Maximized"
WindowStyle="None"
Title="MainWindow" Height="980 " Width="540" Source="Home.xaml" />
Despite WindowState= "Maximized" and WindowStyle="None" the navigation bar is still displayed and the window is still small. I followed several tutorials that removed the navigation bar, but they used a Window class. I did some tests on a new project by creating a class Window and I can well maximize and remove the navigation bar from my window.
But in my case I need to improve an application in progress but the main window type is MainWindow
Indeed the source Source= "Home.xaml" is no longer recognized after the change Navigation Window to Window. My application contains several pages and I must navigate through it so I have to keep my "Home" type "page" page: <Pagex:Class = "WpfAppTest.Home".
Do you have any idea where my problem may be?
Thanks you in advance.
Geoffrey
You can host a Frame in your Window. That is essentially what a NavigationWindow does.
MSDN has more info on navigation hosts.
Working with the ribboncontrolslibrary, when I run my application the title bar looks like W98 application,. How can I make it look pretty?
Edit: It seems that has something to do with the theme used on windows.
any help would be appreciated.
alt text http://img718.imageshack.us/img718/8188/321321.jpg
<r:RibbonWindow x:Class="Produccion_Dampers.main"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:r="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
Title="Window1"
Height="600"
Width="800">
<DockPanel>
<r:Ribbon DockPanel.Dock="Top" Title="my App looks like s***t">
</r:Ribbon>
</DockPanel>
</r:RibbonWindow>
(from my previous comment)
You can draw a custom window frame as described in this MSDN article: http://msdn.microsoft.com/en-us/library/bb688195(VS.85).aspx, which includes information about drawing the window caption with the system theme's font (which might provide clues about accessing other theme information).
If you are running a custom theme on your machine, WPF windows default to the "Classic" theme.
As I understand, your options are then limited because the title bar is non-client to your application -- it is rendered by the OS (why then it can't adopt the custom theme, I don't know).
you can use p/invoke to do some nasty stuff
you can create a borderless window and fake the title bar yourself
you can see if the (rather old) info here does anything good for you : http://www.browsoft.com/tutorials/DefaultTheme.html
(If the last one works, it means my understanding about rendering the title bar is incorrect.)