I am a developer trying to make an operating system in VBA. On the login screen, there is a password box. I would like to make it transparent so that the user can see the UserForm's bitmap image through the text box. Is this possible. I'm also starting out on this project so a bit of help/explanation would really help please.
Kind Regards,
J
You can do this by changing the BackStyle property of the TextBox.
Let's say you're using VBA in Excel; you can make TextBox1 transparent by changing BackStyle to 0.
ActiveSheet.TextBox1.BackStyle = 0
Changing the property to 1 would render the TextBox opaque again.
Related
I've been writing a program that calls batch files (which download some stuff). I've added a label that reports the download progress to the user. The program is going to allow for multiple downloads so at some point the Label will be full of text. When that happens, the text extends from the label and I can't see any of it. What I want is to have the label scroll to the newer line of text added in the label. In other words I want to always have the focus of the label text to be on the last written line. Can some1 post an example that can do this on a label ?
Similar to Steve's comment I would recommend using a multiline text box or RichText control for this purpose. You can set the control's ReadOnly property to True, and the ScrollBars property to Both.
When adding new text to this control, you can use the following code to ensure that it is visible to the user:
TextBox2.AppendText('New text')
TextBox2.SelectionStart = TextBox2.Text.Length
TextBox2.ScrollToCaret()
I have programmatically added a RichTextBox control to a form, but I seem to be experiencing a lot of issues when trying to format it. Please note that I have manually added the control through the GDI but also encounter the same problems.
Basically what is happening is that my control is drawn but uses the same initial background color as the form (even though I have manually specified a different color). The control also appears empty upon loading of the form, however, I can manually click the mouse the obtain a cursor where text 'should' be appearing.
If I click and drag inside the control, all of my text then appears with all of the formatting I defined. I have no idea what is causing this, but I have tried to Refesh the form, Refresh the Control, Update the control but nothing works. I have also tried using .Text, .SelectedText and .AppendText, as well as .SelectionColor and .SelectionBackColor.
My code is simply this:
Dim rtb As RichTextBox = New RichTextBox
rtb.Location = New Point(94, 229)
rtb.Size = New Size(608, 46)
rtb.BackColor = Color.FromArgb(38, 38, 38)
rtb.ForeColor = Color.LightGray
rtb.AppendText(_ticket.ticket_lastcomment)
Me.Controls.Add(rtb)
Yet it creates a new RichTextBox that is the same color as the form (Color.Control) and empty. No formatting is applied to the control until I highlight the text manually.
I have never come across this before.
UPDATE
After various trial and error and moving code, I have come to find that the piece of code preventing the drawing of the RichTextBox is this:
Me.animator = New FormAnimator(Me, FormAnimator.AnimationMethod.Centre, FormAnimator.AnimationDirection.Right, 200)
I apply a FormAnimator to the form to give it an effect upon opening. Removing this piece of code allows the RichTextBox to draw correctly.....strange.
Try this :)
rtb.rtf =_ticket.ticket_lastcomment
I know its a little late for this answer, but it may help future visitors.
All you have to do, is add first the RichTextBox to the form and then set the text:
Me.Controls.Add(rtb)
rtb.AppendText(_ticket.ticket_lastcomment)
Hi so I have just noticed something very strange and I'm wondering if anyone else has had this issue and how to fix it.
Basically using visual studios 2010 on a windows 7 computer I have noticed that the locations of my controls on a form are out of sync with the form size itself.
For example: If I make a form and set its size to 500x500 and then place a control on the form like a button and set its size to the same and its location to 0,0 then the control is cut off by about 10 pixels or so. It happens on both my work and home computer so it isn't the computer and the values are the same at both runtime and design time. It seems as though the controls are being scaled differently than the form and I am not sure why.
Any ideas?
The form's size includes the border. Use the ClientSize property instead.
I got the Telerik RadRibbonBar for free with the Express edition of vb a while back, but it did not come with any sort of form. It also, unfortunately, has the control buttons there automatically. How would I create a form which is resizable, and works like a standard winform, but doesn't have the top bar?
I tried:
FormBorderStyle = Sizable
Text = Nothing
ControlBox = False
Unfortunately, when you maximize the window, it goes in front of the taskbar...and it has an ugly border when it isn't maximized.
How can I:
Change border color?
Make it so it does not go in front of the taskbar?
Thanks for the help! I'm surprised there is not some sort of form already made for this.
Telerik comes with a "Telerik.WinControls.UI.RadRibbonForm"
You have to add a RadRibbonForm Instead of a Standar Form.
I am designing an app and I want to attach some pictures to my VB forms. I have used a picture box and the image is only visible before I debug. Once debugging starts, the image disappears.
How do I display the image when I run the debugger? This is the code I used for the picture box:
PictureBox1.Image = My.Resources.tropical_island3
I ran into a similar problem on a VB.NET form. I found when loading the form as a modal window (.ShowDialog) the image in the picture box showed fine, but if loading the form as non-modal (.Show) the PictureBox showed with a white background.
To resolve showing the image in the non-modal form, I needed to call .Refresh for the form after the .Show
Hope that helps someone else!
This is a possibility, based on the limited info:
If the image is shown in the picturebox before you run the form in debug mode, then it apparently has been assigned at design time to the PictureBox1.Image property. When you run the program and assign My.Resources.tropical_island3 to the Picture Box image, it clears the image because My.Resources on your home computer does not have tropical_island3 like the one at class, or maybe tropical_island3 is spelled incorrectly.