-
Apr 1st, 2019, 11:02 PM
#1
WinForms Bootstrap Theme
This is a work in progress, but here is a library that I've been working on that mimics twitter-bootstrap 4.3.
Control
- Base Class
- Rounded edge control
- Function to calculate REM
Alert
- Dismissable - i.e. a close icon appears in the upper-right hand corner, once the close icon is clicked it destroys the control.
- Fadable - i.e. when the Dismiss method is called, it slowly causes the control to fade away.
Button
- IsOutline - Allows the button to just contain a border
- MouseOver, MouseEnter, and Disabled styles the button
Long story short, I started doing a lot of web development and realized how crappy WinForm applications look.
Here is a screenshots of the work in progress:
Code was too large to include in a post, here is the file: Bootstrap.vb
UPDATE
I'll keep the original file, but please note that I've moved this project to GitHub: https://github.com/dday9/win-forms-bootstrap
Last edited by dday9; Jun 30th, 2020 at 11:09 PM.
-
Apr 12th, 2019, 05:19 PM
#2
PowerPoster
Re: WinForms Bootstrap Theme
Very Nice Dd, I love this kind of stuff!!
-
Apr 17th, 2019, 02:26 PM
#3
Re: WinForms Bootstrap Theme
Have you considered doing a TextBox with a focus glow like shown below?
-
Apr 17th, 2019, 11:07 PM
#4
Re: WinForms Bootstrap Theme
Yep, I’m actually moving onto form inputs next.
-
Dec 6th, 2019, 11:35 AM
#5
PowerPoster
Re: WinForms Bootstrap Theme
Nice Job dday... You always do good! And of course you too Karen
-
Feb 7th, 2020, 06:56 AM
#6
New Member
Re: WinForms Bootstrap Theme
better you can provide full sample project
-
May 21st, 2020, 05:19 PM
#7
Member
Re: WinForms Bootstrap Theme
I liked the topic very much, but I do not know how to use the attached class .. I wish clarification steps
-
May 22nd, 2020, 09:43 AM
#8
Re: WinForms Bootstrap Theme
Originally Posted by vbxprogrammer
I liked the topic very much, but I do not know how to use the attached class .. I wish clarification steps
- Add the file to your project
- Build the solution
- You can either drag and drop the controls onto your form using the form designer or you can create new instances of the controls via code
-
May 22nd, 2020, 02:52 PM
#9
Member
Re: WinForms Bootstrap Theme
Originally Posted by dday9
- Add the file to your project
- Build the solution
- You can either drag and drop the controls onto your form using the form designer or you can create new instances of the controls via code
You are awesome and thank you very much ..
I know your time is short and you may be too busy .. But
I have hope and ambition ... that you will help me to show the tools as in the picture on the topic above ... because I did not understand what is meant by : (( you can create new instances of the controls via code )) !!
waiting your answer ...
-
May 22nd, 2020, 05:54 PM
#10
Re: WinForms Bootstrap Theme
The steps to create a new instance of the control via code (as opposed to just using the form designer) would be to:
- (optional) Import the namespace of the file (Bootstrap, Bootstrap.Control, etc.)
- Generate the Form's Load event or New constructor
- Declare a new instance of one of the controls
- Add the control to the form
An example using the Button control that's included:
Code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
Dim btn As New Bootstrap.Control.Button() With {
.Location = New Point(5, 5),
.Size = New Size(150, 150),
.StyleType = Bootstrap.Control.Button.StyleType.Primary,
.Text = "Click Me"
}
Me.Controls.Add(btn)
End Sub
End Class
-
May 22nd, 2020, 06:33 PM
#11
Member
Re: WinForms Bootstrap Theme
Originally Posted by dday9
The steps to create a new instance of the control via code (as opposed to just using the form designer) would be to:
- (optional) Import the namespace of the file (Bootstrap, Bootstrap.Control, etc.)
- Generate the Form's Load event or New constructor
- Declare a new instance of one of the controls
- Add the control to the form
An example using the Button control that's included:
Code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
Dim btn As New Bootstrap.Control.Button() With {
.Location = New Point(5, 5),
.Size = New Size(150, 150),
.StyleType = Bootstrap.Control.Button.StyleType.Primary,
.Text = "Click Me"
}
Me.Controls.Add(btn)
End Sub
End Class
Wonderful .. beautiful .. .. remains a question:
How to change the design of the form in the same way. And increase the shadow of the textbox limit
-
Jun 25th, 2020, 08:19 AM
#12
Member
Re: WinForms Bootstrap Theme
The topic is great, and it benefited me a lot .. Thank you and I hope an important thing as an addition:
A very important addition. I hope that you will help me add it to the button specifically: Add a picture or image of the button .. what the code ??? and where set it ???? i wait
-
Jun 25th, 2020, 01:45 PM
#13
Re: WinForms Bootstrap Theme
All of the controls inherit from the base .NET class, Control. You're still able to set the BackgroundImage property of the Bootstrap Button.
-
Jun 25th, 2020, 05:33 PM
#14
Member
Re: WinForms Bootstrap Theme
Originally Posted by dday9
All of the controls inherit from the base .NET class, Control. You're still able to set the BackgroundImage property of the Bootstrap Button.
I hit the target .. this is because you are creative .. but I am very sad because I tried to Working the BackgroundImage property of the Bootstrap Button .. Without success, this BackgroundImage property for Button did not work and tried more than one code without success .. I would be grateful ... and thank you if you helped me put a picture of the buttons
-
Jun 28th, 2020, 07:31 AM
#15
Member
Re: WinForms Bootstrap Theme
helped me put a picture of the buttons
-
Jun 28th, 2020, 12:44 PM
#16
Re: WinForms Bootstrap Theme
Hello ,
I tested this new custom class on Vb.net 2017. It's nice, I like it.
I noted 2 strange behaviors :
The background image works for the default control and the alert but not for the button. For the button, sometime, the image seems to appear but is replaced quickly by the background color but generally, the image doesn't appear at all.
For the alert, it seems that the fading doesn't work. When I click, I have a delay then the alert disappear quickly (so no fading).
(I tested it with just a form and a control of each)
regards
The best friend of any programmer is a search engine
"Don't wish it was easier, wish you were better. Don't wish for less problems, wish for more skills. Don't wish for less challenges, wish for more wisdom" (J. Rohn)
“They did not know it was impossible so they did it” (Mark Twain)
-
Jun 28th, 2020, 03:07 PM
#17
Member
Re: WinForms Bootstrap Theme
Originally Posted by Delaney
Hello ,
I tested this new custom class on Vb.net 2017. It's nice, I like it.
I noted 2 strange behaviors :
The background image works for the default control and the alert but not for the button. For the button, sometime, the image seems to appear but is replaced quickly by the background color but generally, the image doesn't appear at all.
For the alert, it seems that the fading doesn't work. When I click, I have a delay then the alert disappear quickly (so no fading).
(I tested it with just a form and a control of each)
regards
This is what I mentioned and I told friends about it and I hope that it will be done quickly .. We need the intervention of friends to amend and the ability to add a picture of the button
-
Jun 30th, 2020, 07:46 AM
#18
Member
Re: WinForms Bootstrap Theme
Originally Posted by Delaney
Hello ,
I tested this new custom class on Vb.net 2017. It's nice, I like it.
I noted 2 strange behaviors :
The background image works for the default control and the alert but not for the button. For the button, sometime, the image seems to appear but is replaced quickly by the background color but generally, the image doesn't appear at all.
For the alert, it seems that the fading doesn't work. When I click, I have a delay then the alert disappear quickly (so no fading).
(I tested it with just a form and a control of each)
regards
This is what I mentioned and I told friends about it and I hope that it will be done quickly .. We need the intervention of friends to amend and the ability to add a picture of the button
-
Jun 30th, 2020, 08:07 AM
#19
Re: WinForms Bootstrap Theme
No need to post a second time the same post just to bump the subject.
Dday9 will do what he wants, when he wants and if he wants to about his code.
As the codes in code banks are free of use, feel free to correct it yourself if you need it so urgently
Regards
The best friend of any programmer is a search engine
"Don't wish it was easier, wish you were better. Don't wish for less problems, wish for more skills. Don't wish for less challenges, wish for more wisdom" (J. Rohn)
“They did not know it was impossible so they did it” (Mark Twain)
-
Jun 30th, 2020, 09:10 AM
#20
Member
Re: WinForms Bootstrap Theme
Originally Posted by Delaney
No need to post a second time the same post just to bump the subject.
Dday9 will do what he wants, when he wants and if he wants to about his code.
As the codes in code banks are free of use, feel free to correct it yourself if you need it so urgently
Regards
I apologize for that and it was not intended ..
And I wait @Dday9 very quickly ... because I couldn't really modify the code .. I hope for help from @Dday9 and I thank him very much
-
Jun 30th, 2020, 10:34 PM
#21
Re: WinForms Bootstrap Theme
It's worth mentioning that I have a repository on GitHub here: https://github.com/dday9/win-forms-bootstrap
If anyone would like to implement bug fixes, feel free to do so and submit a pull request. I'll review it and merge it into master if it passes my scrutiny.
-
Jun 30th, 2020, 11:08 PM
#22
Re: WinForms Bootstrap Theme
Originally Posted by Delaney
The background image works for the default control and the alert but not for the button. For the button, sometime, the image seems to appear but is replaced quickly by the background color but generally, the image doesn't appear at all.
The issue stems from the fact that I'm using the Graphics::Clear method. This gives it the visual styles you'd expect a button to have when hovering over the button, pressing down on the mouse, or releasing the mouse.
If you comment out line 489 (per the GitHub repo, not the source code above), rebuild the project, and set the BackgroundImage then the image displays when the project is running but it does not display in the designer.
I'm really not sure how I can get around this issue. I'll ask the question in the main VB.NET forum to see if some more senior developers can pitch in.
Originally Posted by Delaney
For the alert, it seems that the fading doesn't work. When I click, I have a delay then the alert disappear quickly (so no fading).
I don't experience the same thing. Do you have both the Dismissable and the Fadable properties set? If you have just the former set to true, then it would disappear quickly without any fading whereas if you have both true then it should fade slowly until it ultimately disappears.
Edit - I recorded a GIF to show you what I'm seeing:
Edit #2 - Apparently the animated GIF in my signature is supported, but not in a thread. That's odd.
Last edited by dday9; Jun 30th, 2020 at 11:18 PM.
-
Jul 1st, 2020, 07:23 AM
#23
Member
Re: WinForms Bootstrap Theme
Originally Posted by dday9
It's worth mentioning that I have a repository on GitHub here: https://github.com/dday9/win-forms-bootstrap
If anyone would like to implement bug fixes, feel free to do so and submit a pull request. I'll review it and merge it into master if it passes my scrutiny.
I tried to send a message to you without success..I hope you can help me add a picture to the button..I thank you very much for your effort and I wish you happiness
-
Jul 1st, 2020, 08:23 AM
#24
Re: WinForms Bootstrap Theme
Did you see my comment here: http://www.vbforums.com/showthread.p...=1#post5485090
Would this suffice for now while I investigate how to preserve the visual styles while simultaneously supporting BackgroundImage support?
-
Jul 1st, 2020, 09:19 AM
#25
Re: WinForms Bootstrap Theme
Hi Dday9,
Thanks for the investigation and comments, I will try tonight. I have thinking also of something and I will check that.
for the gif, it seems the picture is converted into a JPG (that's what you get if you try to save it). And for the gif into you signature, it is working because it is already a bug
The best friend of any programmer is a search engine
"Don't wish it was easier, wish you were better. Don't wish for less problems, wish for more skills. Don't wish for less challenges, wish for more wisdom" (J. Rohn)
“They did not know it was impossible so they did it” (Mark Twain)
-
Jul 1st, 2020, 09:19 AM
#26
Member
Re: WinForms Bootstrap Theme
Originally Posted by dday9
Dear friend..Thank you .. It seems that I have burdened you and annoyed you .. I apologize .. The problem is that I started in one of the programs and used these buttons .. Now unfortunately I will be forced, and I am very sad to delete the entire project and re-work on it with buttons Different .. Once again thank you I apologize if I bothered you
-
Jul 1st, 2020, 10:01 AM
#27
Re: WinForms Bootstrap Theme
Mais bruh, you're good! I'm not burdened or annoyed. If you have a lot of effort put into your existing project but would like to switch from using these custom buttons to using a different button, you can do it fairly easily without having to start completely over. In the Solution Explorer, click on Show All Files, open up the *.designer.vb file for the Form, and then replace any reference of Bootstrap.Controls.Button with just System.Windows.Forms.Button (or whatever control you're replacing it with).
-
Jul 1st, 2020, 10:18 AM
#28
Re: WinForms Bootstrap Theme
Originally Posted by dday9
Mais bruh,
Long time since I read some Cajun
The best friend of any programmer is a search engine
"Don't wish it was easier, wish you were better. Don't wish for less problems, wish for more skills. Don't wish for less challenges, wish for more wisdom" (J. Rohn)
“They did not know it was impossible so they did it” (Mark Twain)
-
Jul 1st, 2020, 10:57 AM
#29
Member
Re: WinForms Bootstrap Theme
Originally Posted by dday9
Mais bruh, you're good! I'm not burdened or annoyed. If you have a lot of effort put into your existing project but would like to switch from using these custom buttons to using a different button, you can do it fairly easily without having to start completely over. In the Solution Explorer, click on Show All Files, open up the *.designer.vb file for the Form, and then replace any reference of Bootstrap.Controls.Button with just System.Windows.Forms.Button (or whatever control you're replacing it with).
Thank you for your response and communicating with interest .. I wish there was a solution soon to the problem of inserting a picture of the buttons
-
Jul 1st, 2020, 12:16 PM
#30
Re: WinForms Bootstrap Theme
What about my suggestion from earlier, here: http://www.vbforums.com/showthread.p...=1#post5485090
If you comment out line 489 (per the GitHub repo, not the source code above), rebuild the project, and set the BackgroundImage then the image displays when the project is running but it does not display in the designer.
It has the unintended side effect of losing the visual styles when your mouse is over the control but it'd solve your immediate issue of need to support the BackgroundImage.
-
Jul 1st, 2020, 01:47 PM
#31
Member
Re: WinForms Bootstrap Theme
Originally Posted by dday9
What about my suggestion from earlier, here: http://www.vbforums.com/showthread.p...=1#post5485090
It has the unintended side effect of losing the visual styles when your mouse is over the control but it'd solve your immediate issue of need to support the BackgroundImage.
I did not understand it and did not understand what you meant by it .. I wish you could simply explain it so that I can follow it in steps
-
Jul 1st, 2020, 04:06 PM
#32
Re: WinForms Bootstrap Theme
@vbxprogrammer : open the Bootstrap.vb file, go to the line 490 and put under comment this line : e.Graphics.Clear(backColor).
@Dday9, for the fadable stuff, I have both the Dismissable and the Fadable properties set on true, so I will investigate
By the way I love the ToggleSwitch
Last edited by Delaney; Jul 1st, 2020 at 04:49 PM.
The best friend of any programmer is a search engine
"Don't wish it was easier, wish you were better. Don't wish for less problems, wish for more skills. Don't wish for less challenges, wish for more wisdom" (J. Rohn)
“They did not know it was impossible so they did it” (Mark Twain)
-
Jul 1st, 2020, 04:31 PM
#33
Re: WinForms Bootstrap Theme
concerning the fadable,
I test it again and I can't make it work. I tested the idea on an other application with this code
Code:
Do
Button3.BackColor = Color.FromArgb(Button3.BackColor.A - 1, Button3.BackColor.R, Button3.BackColor.G, Button3.BackColor.B)
Refresh()
Threading.Thread.Sleep(Byte.MaxValue \ 150)
Loop Until Button3.BackColor.A = 0
And it works only if I add the refresh() command, so I add it in you class like that :
Code:
Me.Invoke(New MethodInvoker(Sub()
refresh()
End Sub))
And I still don't have the fadable effect
By the way there is a funny property : Isdismissed, if you put it to true, that's remove the control from the form
The best friend of any programmer is a search engine
"Don't wish it was easier, wish you were better. Don't wish for less problems, wish for more skills. Don't wish for less challenges, wish for more wisdom" (J. Rohn)
“They did not know it was impossible so they did it” (Mark Twain)
-
Jul 1st, 2020, 04:44 PM
#34
Re: WinForms Bootstrap Theme
Ok Dday9,
I am a big Moron!
The fadable effect works perfectly : in my application test, I put a background image so, of course, I can't see the effect as the picture hide it
by the way, I noted that the cross is a bit outside the click zone.
The best friend of any programmer is a search engine
"Don't wish it was easier, wish you were better. Don't wish for less problems, wish for more skills. Don't wish for less challenges, wish for more wisdom" (J. Rohn)
“They did not know it was impossible so they did it” (Mark Twain)
-
Jul 1st, 2020, 04:51 PM
#35
Re: WinForms Bootstrap Theme
Originally Posted by dday9
What about my suggestion from earlier, here: http://www.vbforums.com/showthread.p...=1#post5485090
It has the unintended side effect of losing the visual styles when your mouse is over the control but it'd solve your immediate issue of need to support the BackgroundImage.
the alternative is to use the control "control" as a button, it allows the background image (but not the text, but who need it if you have a background image) and has the click event
The best friend of any programmer is a search engine
"Don't wish it was easier, wish you were better. Don't wish for less problems, wish for more skills. Don't wish for less challenges, wish for more wisdom" (J. Rohn)
“They did not know it was impossible so they did it” (Mark Twain)
-
Jul 1st, 2020, 06:19 PM
#36
Member
Re: WinForms Bootstrap Theme
Originally Posted by Delaney
the alternative is to use the control "control" as a button, it allows the background image (but not the text, but who need it if you have a background image) and has the click event
background image Not Work
-
Jul 2nd, 2020, 04:30 AM
#37
Re: WinForms Bootstrap Theme
Yes it is ...
here is an example : new_button.zip
I didn't change anything to the custom class (ie, i didn't put under comment the line 490).
just click on the button and on the control...
The best friend of any programmer is a search engine
"Don't wish it was easier, wish you were better. Don't wish for less problems, wish for more skills. Don't wish for less challenges, wish for more wisdom" (J. Rohn)
“They did not know it was impossible so they did it” (Mark Twain)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|