How to use metroframework modern ui via NuGet

how-to-use-metroframework

You may also like...

  • Unknownymous

    Hi Sir,

    I’m very thankful for your ModernUI framework.. I already using it on my projects but I have one question if your metroUI framework cater some sliding group panels? just like for example in windows 8.1 when opening STORE then click one of those apps it doesn’t show another form instead it will slide the form/GroupPanel(or whatever you call it) then if you want to go back you just need to click the BACK ARROW button then it will slide to previous form.. How can I do that in your framework?

    Hoping for your reply.

    Thanks in advance.

    • Thenndral

      Hi,

      I’m also having the same requirement in my project. Did you fix?
      If you done, could share your samples or suggestion to us.

      Thanks,
      thenndral

  • I just tried to use this and I see that the form’s default border and controlbox are also active along with the Metro UI’s controlbox. I can’t seem to get the form that you get right after inheriting from MetroForm

    • Ok. I figured it out! I converted my existing form. I realized that if the FormBorderStyle is not the default (Sizable), the MetroForm will be shown as contained within regular WinForm. Resolved by converting back to default Form and changing FormBorderStyle property to Sizable and then inheriting from MetroForm again.

      • Good to know that you managed to solve your issue. Happy coding…

  • Rodney Jan Mandap

    Hi Sir,

    why this code doesn’t work after i used metro:

    Private Sub txtUser_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtUser.GotFocus
    If txtUser.Text = “Username” Then
    txtUser.Text = “”
    txtUser.ForeColor = Color.Black
    End If
    End Sub

    Private Sub txtUser_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtUser.LostFocus
    If txtUser.Text = “” Then
    txtUser.Text = “Username”
    txtUser.ForeColor = Color.Gray
    End If
    End Sub

    it must work just like the placeholder in html… pls help me sir

    • It was not handled in MetroTextBox, you need to add a few line of codes to achieve it. Check out my github I will include this on my update.

      • Rodney Jan Mandap

        Thank you sir for the reply… When will be the release of the update, I hope this will be release soon cause I want to apply your Metroframework in my thesis… Thanks πŸ™‚ I’m looking forward to the update.

        • You can get the updates from NuGet, I just uploaded the update for MetroTextBox you can just recompile it

          • Rodney Jan Mandap

            What is the version of the updated MetroFramework? I didn’t see it from the NuGet package.

          • I’m sorry you should get the update from GitHub not Nuget

          • Rodney Jan Mandap

            How can I use it?

          • You can download the source code and compile it so that you can get the DLL’s

          • Rodney Jan Mandap

            Thank you very much sir πŸ™‚ it works and I know now how to recompile the source code to be a DLL file πŸ™‚ awesome work sir Dennis

          • Rodney Jan Mandap

            Sir I have another question why when the form loads it keeps on focusing on the first textbox or button?

          • Check your TabIndex

          • Rodney Jan Mandap

            the first textbox is set to 1

          • That is actually the behavior of the Form to focus on the first object that has lowest TabIndex

          • Rodney Jan Mandap

            ok sir, how can i change the behavior of the form so that it will not focus on the first object. because when i start the program the placeholder of a certain textbox can’t be seen, with that the user will not know what he/she are going to input there. Am I going to make another textbox or object and set to the first tab index and set the visible = false or there is another better idea?

          • Try to set a label as your first object by setting the tabindex to 0

          • Rodney Jan Mandap

            Thank you sir,
            Another problem that i encountered I have a two panel i set the other panel to back but this is what happened.

          • Rodney Jan Mandap

            Thank you sir πŸ˜‰
            Sir another problem that I encountered, I create a two panel I send the other panel to back, but after I send it to back it doesn’t totally send to back. Here’s the picture.

          • Rodney Jan Mandap

            sir can I ask you about mysql database?

          • denricdenise

            What’s your question about mySQL?

          • What’s your question about MySQL?

          • Rodney Jan Mandap

            I have two tables one is applicant and the other one is scholar. In the applicant there’s a field called appID which is a primary key and set to auto_increment. On the other table(applicant) got a Primary key(scholarID) w/c is auto_increment also and a Foreign key(appID). Since the primary key is not manually input by the user I find myself difficult to do this. How am i going to get the appID data and insert it into the scholar.appID foreign key what is the sql query for it in vb.net?

            look for the picture below if you feel like your confused πŸ™‚ thanks

            https://uploads.disquscdn.com/images/20719da3341e0f55b02cf28fdba92b01f177c5a0d481401633d0057a9f5f3bc1.png

          • I got what you mean, this is a parent and child table. The question here how are you going to insert this data. Do you have a UI for this, from where you will select from a drop down or list all students then check only those who are qualified as a scholar.

          • Rodney Jan Mandap

            I don’t have yet a UI for this sir. And by the way how to create a check box, combo box in a certain cell in datagrid

          • The easiest and fastest way to add a checkbox on a grid is to add a column with a data type of Boolean.

          • Rodney Jan Mandap

            How can I insert the foreign key that is reference to the primary key that is auto_increment into another table? For example INSERT INTO scholarship (appID, schpName) values (?, ‘” + txtchpName.text + “‘)

            ? = what am I going to put here

            appID is the foreign key which is reference to the applicant’s primary key which is auto_increment.

          • Try make your query like this “INSERT INTO scholarship (appID, schpName) SELECT AppID,`Name` FROM Applicant where `Name` = ‘” + txtchpName.text + “‘;”

          • Rodney Jan Mandap

            Do this work on metroframework controls?

            Private Sub ClearAllControls(ByRef container As Panel, Optional ByVal Recurse As Boolean = True)
            Dim ctrl As Control
            For Each ctrl In container.Controls
            If (ctrl.GetType() Is GetType(TextBox)) Then
            Dim txt As TextBox = CType(ctrl, TextBox)
            txt.Text = “”
            End If
            If (ctrl.GetType() Is GetType(CheckBox)) Then
            Dim chkbx As CheckBox = CType(ctrl, CheckBox)
            chkbx.Checked = False
            End If
            If (ctrl.GetType() Is GetType(ComboBox)) Then
            Dim cbobx As ComboBox = CType(ctrl, ComboBox)
            cbobx.SelectedIndex = -1
            End If
            If (ctrl.GetType() Is GetType(DateTimePicker)) Then
            Dim dtp As DateTimePicker = CType(ctrl, DateTimePicker)
            dtp.Value = Now()
            End If

            If Recurse Then
            If (ctrl.GetType() Is GetType(Panel)) Then
            Dim pnl As Panel = CType(ctrl, Panel)
            ClearAllControls(pnl, Recurse)
            End If
            ‘If ctrl.GetType() Is GetType(GroupBox) Then
            ‘ Dim grbx As GroupBox = CType(ctrl, GroupBox)
            ‘ ClearAllControls(grbx, Recurse)
            ‘End If
            End If
            Next

            End Sub

          • Yes, it is give it a try. Instead of TextBox you will use MetroTextBox
            etc.

          • Rodney Jan Mandap

            there’s no metrobox when i try to replace the textbox in getType

          • Rodney Jan Mandap

            does mouse hover work in metro tile?

          • Yes, it works. Don’t be afraid to try.

          • If (ctrl.GetType() Is GetType(MetroTextBox)) Then
            Dim txt As MetroTextBox = CType(ctrl, MetroTextBox)
            txt.Text = “”
            End If

            Don’t forget to add Imports MetroFramework.Controls on top of your form.

          • Rodney Jan Mandap

            I try just a simple coding about mouse hover using metro tile but it doesn’t work like this

            Private Sub MetroTile1_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles MetroTile1.MouseHover
            MetroTile1.BackColor = Color.Black
            End Sub

          • Did you set the UseCustomBackColor to true?

          • Rodney Jan Mandap

            Now I do it works LOL…. what is the default color of metrotile with style set to default?

          • Rodney Jan Mandap

            I set it now LOL… what is the default color of the metrotile?

          • Rodney Jan Mandap

            what’s the default color of metrotile with the style is set to Default?

          • You can find all the style colors MetroFramework.MetroColors

          • Rodney Jan Mandap

            I use this code:
            MetroMessageBox.Show(Me, “Do you want to Delete the selected item(s)?”,MessageBoxButtons.YesNo, MessageBoxIcon.Warning)

            but the output is this https://uploads.disquscdn.com/images/5a1dcf81d3f3aa6ec4aa3339f177c3a06caff9f252209f598b357f5df0fa54b3.png

          • Rodney Jan Mandap

            I used this code:

            MetroMessageBox.Show(Me, “Do you want to Delete the selected item(s)?”, MessageBoxButtons.YesNo, MessageBoxIcon.Warning)

            but the output is this:
            https://uploads.disquscdn.com/images/92b7c729ed1d18f2561b0c8ccd3f5259a756cdd02dba10cc54156030ebff4e7e.png

          • Rodney Jan Mandap

            Ignore that sir, I found what’s the problem to my question πŸ˜‰

          • Rodney Jan Mandap

            How can I put a logo before the title?

          • You can use the BackImage property. Then adjust BackImagePadding and set BackLocation depending on where you want to place the logo.

          • Rodney Jan Mandap

            How can I use Metro Style Manager in VB.Net?

          • Add the MetroStyleManager on the form. Set the owner of Stylemanager. Inside the form add a code Sub New. Inside the sub after InitializeComponent() add this code to set the stylemanager of the form

            Me.StyleManager = MetroStyleManager1

      • Rodney Jan Mandap

        Sir, I have another question. Where am I going to put that codes in VB.Net? it’s C#. πŸ™‚

  • Varun Venkatesh Murthy

    Hello Sir,

    I am a newbie trying to develop a winform project using VS2013 along with C# I am using your metroFramework.

    If i use the metroFroms and debug (or even publish) then the form won’t hold the focus. Every new metroForm called gives away the focus to the previous window and I have keep clicking on the form to get focus.

    I not facing this problem if i just inherit the normal forms for the same project.

    Can you please let me know where and what I am doing wrong?

    Thanks in advance!

    • Joshua Alzate

      Sir, i also got that proble. solved it by using Form.Activate()

  • Kret Sokpanharoat

    Hello Sir,
    I am new to this VB, but what my problem is after i put all the tool in Tool box , I cant use any of the tool.Please help

    • Make sure to add all DLL’s as a reference of your project.

  • Meng Seng

    When I choose items and I find a dll it has this message. How should do please?

    • Try to drag the DLL in toolbox instead of doing this way.

  • How to change that blue border of the form…? and thankyou for the framework

  • Aroop β€œFinlay” Roelofs

    The framework seems to kill the designer quite alot, always getting errors after a while.

    Heres the error that comes in every error (sometimes can be up to 200-300 depennding on how much stuff I use)

    at
    Microsoft.VisualStudio.Design.Serialization.CodeDom.XML.CodeDomXmlProcessor.ParseXml(String
    xmlStream, CodeStatementCollection statementCollection, String fileName, String
    methodName)
    at
    Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomParser.OnMethodPopulateStatements(Object
    sender, EventArgs e)
    at
    System.CodeDom.CodeMemberMethod.get_Statements()
    at
    System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager
    manager, CodeTypeDeclaration declaration)
    at
    System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager
    manager)
    at
    Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager
    serializationManager)
    at
    System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost
    host)

  • Hey Dennis, i don’t know it’s bug or it’s just for me, when you move the focus control with tab, the combobox list backcolor all change to the color style what i set…

    • I believe this was already fixed in version 1.3.5

      • Piotr Dziedzic

        Hi Dennis, bad news, I just checked this bug, and still it is the same.
        Even when you are away of combobox, TAB key broke it’s style.

        Could you please try to fix this? πŸ˜‰

        • Stefan Sullbauer

          Can you please share how you fixed it as the bug is still appearing in version 1.3.5? πŸ™‚ THX

          • Piotr Dziedzic

            ehh, I must look into the DLL’s where it was located
            please, remind me at the end of the week

    • Piotr Dziedzic

      I fixed it, I can share my solution πŸ™‚

  • Nicolas

    Hi Dennis ! Why is it that the minimize, maximize and exit button don’t work ?