C# 2005: Remove icon from the form's title bar - c#

A client has asked me to remove the icon from the form's title bar. As they don't want to display any icon. But this me guessing as when I click on the icon property you have to browse to some icon.

Set ShowIcon Property of the form to False to see if that's what your client wants.

There are two ways.
First is to create an empty Icon file and then Select Form -> Right Click -> Goto Properties -> Goto Icon -> Select your file.
The other approach is to set FormBorderStyle of the form to FormBorderStyle.SizableToolWindow or FormBorderStyle.FixedToolWind
And one more way is to set ShowIcon property to be false.

Set
FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog

You can set ControlBox = false. However, that will remove not only the icon but also maximize and minimize buttons from the title bar.

There appears to be an updated process. Following the steps in the selected answer doesn't direct me to an option to upload an icon. That option can be found on Microsoft's site: https://support.office.com/en-us/article/add-a-custom-title-or-icon-to-a-database-0e43e135-dd0d-4451-84ea-4f547e14480e

You can also try this:
this.Icon = null;

Icon > False
This COULD be a good approach, but these are good too:
this.Icon = null;
//Or
FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
//Or
Select Your Form -> Right-Click -> Properties -> Icon -> Select file
That's all I have for this, I hope this helps you.

Related

UltraGridColumn with button

how do I edit the properties of the button created after setting the property:
columnUltraGrid.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.EditButton;
I would like to add an image and remove the edges of it or just remove the edges and add a word, but then it would have to resize it. If it is not possible to edit, any idea of how it could be done?
By default, the button will be shown using the OS theme. To be able to set the appearance of the cell button you need first to turn off the OS themes:
this.ultraGrid1.UseOsThemes = DefaultableBoolean.False;
Then you can set the ButtonStyle and CellButtonAppearance of the Override:
e.Layout.Override.CellButtonAppearance.Image = MyImage;
e.Layout.Override.ButtonStyle = UIElementButtonStyle.Borderless;

Wrong (Default?) Icon shown in Taskbar

I have a Form which I show with ShowDialog. I explicitely set the icon for the form with:
using (frmActivation myActivationView = new frmActivation())
{
myActivationView.ShowInTaskbar = true;
myActivationView.Icon = Properties.Resources.icon;
myActivationView.ShowDialog();
}
And I also set it in the project properties in the application tab as mentionend here:
Even though I have set ShowInTaskbar explicitely to true, it will show me the wrong icon.
I'm out of ideas what else could be the reason that it won't show the set icon?
It's not enough to set ShowInTaskbar. You must also make sure that the property ShowIcon of the form is set to true.
Based on the screenshot of your form and the fact, I can't see an icon in the upper left corner, I guess you haven't set it yet.
From the MSDN: Form.ShowIcon Property
The ShowIcon property contains a Boolean value that indicates whether the form's Icon is displayed in the caption bar of the form. If the ControlBox property is false, both the icon and control box will be suppressed.
If ShowIcon is false when the primary form is shown, a generic icon will be displayed in the taskbar button for the application.

Winforms, Minimized, Text

I am new to WinForms and am currently developing a simple application. I am not too sure if it is possible, but I would like to display the Form's text value (or some text value) in the taskbar when the application is minimized, rather than the icon?
You can set the text of your application by:
this.Text = "Text that you want to display";
paste the above line of code in your Form's constructor just below the InitializeComponent() method.
The answer is Rohit Vyas's. But due to your comment, you're looking for:
Right-click on taskbar -> Properties -> Taskbar buttons: Never
Combine.
Title usually appears in the taskbar of Win xp and many windows
it can be set like this in win forms
This.Text ="Some Text";
But in Win 7 it will always give you the icon unless you change the properties of windows.
This is not possible without going into COM/Interop stuff and even then I would not advise it. Why not use a text icon instead, or you could look at the NotfyIcon Class.

Hide Title Bar in Compact Framework

I am working in a Windows mobile project.
Due to some project requirement I need to Hide the form's tittle bar, but didn't find any properties of the form to do so.
Any suggestion would be appreciated.
Thanks in advance
to hide the forms title bar you have to use
this.WindowState = FormWindowState.Maximized;
if you like to hide the menu bar too, use
this.Menu = null;
In general a Windows Mobile Form does not have a caption but the form's title (caption text) appears as part of the top bar.
~josef
Considering you are using Winforms using WPF you can try consider this:-
this.ControlBox = false;
this.Text = string.Empty;
Otherwise, you could set FormBorderStyle to None.
or you can try this:-
this.ShowInTaskBar = false;
I haven't developed for WindowsMobile, but I have for Windows CE. In Windows CE, I would do the following to hide the Window Title Bar.
FormBorderStyle set to None
ControlBox - False
MinimizeBox - False
MaximizeBox - False
Try that
For window CE devices you can try these properties to hide title bar.
TopMost ====> TRUE
WindowState =====> Normal
FormBorderStyle ====> None
hope it will help you... :)

Disable resizing of a Windows Forms form

How do I turn off the user's ability to resize a Windows Forms form?
I'm having it resize itself on a click.
Take a look at the FormBorderStyle property
form1.FormBorderStyle = FormBorderStyle.FixedSingle;
You may also want to remove the minimize and maximize buttons:
form1.MaximizeBox = false;
form1.MinimizeBox = false;
First, select the form.
Then, go to the properties menu.
And change the property "FormBorderStyle" from sizable to Fixed3D or FixedSingle.
More precisely, add the code below to the private void InitializeComponent() method of the Form class:
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
Explanation
By default, FormBorderStyle property has the sizable value FormBorderStyle.Sizable assigned. Which enables form to be resized.
There are 7 kinds of FormBorderStyle property values available to use.
None
FixedSingle
Fixed3D
FixedDialog
Sizable
FixedToolWindow
SizableToolWindow
Depending upon the kind of form, we can assign the appropriate value accordingly.
Assuming your form name is form1.
Choose any one from below to make it as Fixed
FixedSingle, Fixed3D, FixedDialog makes the form non-resizeable, assigning None will also work but won't make sense without a control box in case.
Code
Code snippets below, use any one of them
FixedSingle
form1.FormBorderStyle = FormBorderStyle.FixedSingle;
Fixed3D
form1.FormBorderStyle = FormBorderStyle.Fixed3D;
FixedDialog
form1.FormBorderStyle = FormBorderStyle.FixedDialog;
None [Optional] Note: There'd no control box
form1.FormBorderStyle = FormBorderStyle.None;
Or, Graphically
We can apply it graphically like this.
Make sure you've selected the form which you want to make it fixed size. then you'll see a property named FormBorderStyle property there in Properties window.
Another way is to change properties "AutoSize" (set to True) and "AutosizeMode" (set to GrowAndShrink).
This has the effect of the form autosizing to the elements on it and never allowing the user to change its size.
None of these answers worked for me, perhaps because my window had a status bar. To fix I did this:
StatusStripObject.SizingGrip = False
The same works for a StatusBar object, e.g.:
StatusBarObject.SizingGrip = False
There is far more efficient answer: just put the following instructions in the Form_Load:
this.MinimumSize = new Size(Width, Height);
this.MaximumSize = this.MinimumSize;

Categories