Checkbox with image and autosize - vb.net

In Word 2012 I have seen the following checkbox:
I am wondering if this checkbox is a .NET control with an image assigned to it (with property "imagealign" being middle right) or if this is a custom solution by MS for their Office GUIs.
I can reproduce the appearance, but I am unable to easily check if the user clicks the checkbox (and wants to change its state) or the info button and wants to show the tooltip.
Also, I have to add some spaces at the end of the checkbox text, else the image is under the text if the checkbox autosize property is set to True.
I would tend to think that the checkbox is a custom solution by MS or perhaps the image is a separate control.
Does anybody know more about this?

I think you are looking for
Checkbox.AutoSize = False
CheckBox.Image = "Your Image"
CheckBox.ImageAlign = MiddleRight
But this way you won't be able to distinguish if the user clicks the checkbox or the info button to show the tooltip.
As far as I know, there is no control available at .NET which allows this behavior, so I suppose they are using separate controls.
I think you'll need to use a PictureBox near the CheckBox and then use CheckBox_CheckedChanged and PictureBox_Click events to do whatever you want on each case.

Related

Having a problem with visual studio Databinding when leaving and coming back to the same form

For making this simply I have two forms a button on each to navigate between the two forms. Then on one I have a checkbox and label when the checkbox is checked it displays the label by using the following code in the form.load event:
Me.label1.DataBindings.Add("Visible", Me.checkbox1, "Checked")
The problem is if I were to leave the form with the checkbox and label and the checkbox is not checked and then I come back to the form with the checkbox and try and check it the label doesn't show up any suggestions or solutions.
Delete that line of code from the form load
Open your form in the designer, the one with the label and the checkbox on it
Click the checkbox
In the Properties grid expand (PropertyBinding) and open the drop down next to (none), click New at the bottom
Pick an initial value, and choose a name for the setting. Make it user scoped if you want to be able to save it and restore it next time the program opens
Now go to your label, properties, click the [...] next to (PropertyBinding) to see a list of all bindable properties, scroll to Visible and drop down to choose the same setting
Run the program.
Side note; when I did this I think I may have encountered a bug/feature of databinding (that I plan to research more) in that the behavior was only as expected if the bool starts out as true (so the control is visible) when the binding is set up. If the control is invisible, it never binds properly to see when the property has become true - so as a workaround (purely in this case where we're binding Visible), replace he call to InitializeComponent() with this, in the form's constructor:
if (!Properties.Settings.Default.FormatWithoutConfirmation)
{
Properties.Settings.Default.FormatWithoutConfirmation = true;
InitializeComponent();
Properties.Settings.Default.FormatWithoutConfirmation = false;
}
else
InitializeComponent();

Add "X" button at the end of a TextBox

My question is the opposite of this one (Remove "X" button at the end of a TextBox).
I have a vanilla TextBox (with TextWrapping set to NoWrap), but I'm not seeing the clear cross delete button.
This is a store/universal/winrt app, so it's a Windows.UI.Xaml.Controls.TextBox.
I haven't got any overrides for the default template in App.xaml either.
Any ideas?
If you can afford it, you can use Telerik UI for Windows Phone. It has a textbox control with a built in clear button.
Other route would be implementing your own user control. It should be rather easy.

VB.Net UI is missing

I'm using Visual Studio 2012 to make a Vb.Net application.
In short, I added DotNetBar RibbonControl with some RibbonItems on it as my menu.
What happened is one of my tab is suddenly missing along with all the buttons in it.
I have searched for it on my Document Outline still no luck.
But what even more odd is, when I tried to recreate it with the same name, it shows an Alert "Property value is not valid" with message "The name AppPOButton is already in use by another component".
When I checked it on the form's Designer I do found this lines:
Me.AppPOButton = New DevComponents.DotNetBar.ButtonItem()
and
'AppPOButton
'
Me.AppPOButton.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText
Me.AppPOButton.Image = Global.ProjectBMT.My.Resources.Resources.approval
Me.AppPOButton.ImageFixedSize = New System.Drawing.Size(40, 40)
Me.AppPOButton.ImagePosition = DevComponents.DotNetBar.eImagePosition.Top
Me.AppPOButton.Name = "AppPOButton"
Me.AppPOButton.SubItemsExpandWidth = 14
Me.AppPOButton.Text = "Approve"
Me.AppPOButton.Visible = False
and
Friend WithEvents AppPOButton As DevComponents.DotNetBar.ButtonItem
Is there anyone can explain why this is happening?
Thank you
This behavior is weird itself, but it's not a problem actually, All the Ribbon style works on "Containers", if you check your ribbon control and click the left-upper button will see these little arrows that move four containers, these objects hold the buttons, images and other controls. Within your design window in the right panel (Properties) you can still see the names of the controls you "lost" when you deleted your tab, wich is also a container.
Steps:
Add a container within your design view and Dock it into the Ribbon control Form.
Click on the uppper right boton (Right Arrow) and select "Layout Ribbon", this will adjust the lenght and hight of the controls conatained.
Add the tab that will contain all the controls you have.
The fact that they are still in the designer form is the prove that they still exist, This behavior is just a glitch in the position and order of the controls set above your form ;-)

vb.net How to make a DropDownList with readonly appearance

I am developing desktop application using vb.net and vs2008.
I have a DropDownList that I don't want it interact with use when the info is locked.
But if I disable it, it is greyed out and the text is not easy to read.
Is there any way to make radiobutton like readonly textbox?
I want text of the DropDownList looks black and itself is not clickable.
The above shows a disabled DropDownList with greyed out text and a readonly textbox
Try this:
Enable="false"
Place it within your <asp:DropDownList> tag.
I recently encountered a similar issue. My solution was to remove all other values of the DropDownList except the one that is selected. This will keep the text as black as opposed to grey. Users will be able see the existing value and click it but will not be able to change it.
Hope this helps.
No, you can't use CSS in a desktop app. When you disable the dropdownlist by setting Disabled=true; or Enabled=false (whatever the case is), you can also change the Font properties to make it easier to read. You can set other properties such as Border, BorderStyle, etc, etc.
Keep the control enabled. In the GOTFOCUS event, use SENDKEYS to send a {tab} to the form. the user will not be able to change it! By the way, workt for ALL controls, that a user can focus.

Textbox in Visual Basic

Lately I have been programming an application in Visual Basic 2008, and on one of my Windows Application forms I have several text box forms, and with my code the way it is, none of them can be enabled, and they must all be set to Read Only.
Now if I put a big block of text in one of the Text Box's that extends past the parameters of the box, the scroll bar appears but doesn't scroll because of making it's enabled false. So here's my question, is there any way I can make the Text Box's scroll bar functional but still leaving the enabled set to false?
You should be able to use textbox1.Readonly = true instead of textbox1.enabled = false. Then you can use the scrollbars.