-
2 Attachment(s)
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:
Attachment 167211
Code was too large to include in a post, here is the file: Attachment 167213
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
-
Re: WinForms Bootstrap Theme
Very Nice Dd, I love this kind of stuff!!
-
1 Attachment(s)
Re: WinForms Bootstrap Theme
Have you considered doing a TextBox with a focus glow like shown below?
Attachment 167621
-
Re: WinForms Bootstrap Theme
Yep, I’m actually moving onto form inputs next.
-
Re: WinForms Bootstrap Theme
Nice Job dday... You always do good! And of course you too Karen
-
Re: WinForms Bootstrap Theme
better you can provide full sample project
-
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
-
Re: WinForms Bootstrap Theme
Quote:
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
-
Re: WinForms Bootstrap Theme
Quote:
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 ...
-
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
-
Re: WinForms Bootstrap Theme
Quote:
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
-
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
-
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.
-
Re: WinForms Bootstrap Theme
Quote:
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
-
Re: WinForms Bootstrap Theme
helped me put a picture of the buttons
-
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
-
Re: WinForms Bootstrap Theme
Quote:
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
-
Re: WinForms Bootstrap Theme
Quote:
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
-
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
-
Re: WinForms Bootstrap Theme
Quote:
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
-
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.
-
1 Attachment(s)
Re: WinForms Bootstrap Theme
Quote:
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.
Quote:
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:
Attachment 177742
Edit #2 - Apparently the animated GIF in my signature is supported, but not in a thread. That's odd.
-
Re: WinForms Bootstrap Theme
Quote:
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
-
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?
-
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 :D
-
Re: WinForms Bootstrap Theme
Quote:
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
-
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).
-
Re: WinForms Bootstrap Theme
Quote:
Originally Posted by
dday9
Mais bruh,
Long time since I read some Cajun :cool:
-
Re: WinForms Bootstrap Theme
Quote:
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
-
Re: WinForms Bootstrap Theme
What about my suggestion from earlier, here: http://www.vbforums.com/showthread.p...=1#post5485090
Quote:
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.
-
Re: WinForms Bootstrap Theme
Quote:
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
-
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 :thumb:
-
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 https://www.developpez.net/forums/im...milies/koi.gif
By the way there is a funny property : Isdismissed, if you put it to true, that's remove the control from the form
-
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.
-
Re: WinForms Bootstrap Theme
Quote:
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
-
Re: WinForms Bootstrap Theme
Quote:
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:mad:
-
1 Attachment(s)
Re: WinForms Bootstrap Theme
Yes it is ...
here is an example : Attachment 177763
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...