Custom Button - Rounded, Pill or Square Shape - WinForm C#

Поделиться
HTML-код
  • Опубликовано: 14 июн 2024
  • 🎬 [ Custom controls in Windows Forms and C# ]
    ⏮ PREVIOUS: Toggle Button or Switch Button • Toggle Button - WinFor...
    ⏭ NEXT: Custom DateTimePicker • Custom DateTimePicker ...
    ▶ Current video: How to create a flat button with a customizable border radius?
    In this tutorial you will learn how to build a custom button with a customizable border radius, thus obtaining a button with rounded corners, in the form of a pill, or a normal rectangular button, with good image quality in the rounded corners of the button.
    🔰 Get Code (Updated and improved)
    rjcodeadvance.com/rounded-but...
    🎦 See all custom controls:
    • Custom Controls C#
    😸Social networking
    Facebook: / rjcodeadvanceen
    Instagram: / rjcodeadvanceen
    🎁 GET RJ CODE MODERN UI - M1 (55% OFF) [ C# || VB.NET ]
    Learn how to create Custom Forms + Custom Controls + Theme and Style Settings
    - Get Project: rjcodeadvance.com/tienda/
    - Download Demo: drive.google.com/uc?id=1uo3yw...

Комментарии • 112

  • @tinchoignacio5192
    @tinchoignacio5192 2 года назад +1

    Thanks for your videos man, they go straight to the point and plus that you have the code in the page, i love you bro, please keep uploading videos

  • @Maik8885
    @Maik8885 3 года назад +4

    Great tutorial!
    It is really great as a base to build upon.
    I love to tinker around with custom controls, even tho I do have a bunifu license.

  • @allefsilva8849
    @allefsilva8849 2 года назад +1

    Muito Obrigado! O melhor tutorial que já vi nesse youtube.

  • @ProgThoughts
    @ProgThoughts Год назад

    Hands down best implementation of a rounded button

  • @mieba5599
    @mieba5599 2 года назад

    Awesome tutorial with good explanations!

  • @nstriker
    @nstriker 2 года назад

    Great Tutorials! Your videos helps me a lot! Thanks

  • @jmondelus
    @jmondelus Год назад

    Awesome work, this helped a lot. Thanks for the great content

  • @SamuelSilva-jl7fu
    @SamuelSilva-jl7fu Год назад

    Excellent tutorial, gained another follower.

  • @jezreelmoraes5864
    @jezreelmoraes5864 3 года назад +3

    Thank you for this video, you are so good

  • @abdullahleghari
    @abdullahleghari Год назад

    Just found this little hidden gem. Thanks RJ

  • @uineecrack6155
    @uineecrack6155 2 года назад +1

    OH GOD! Thank you so much sir you helped a newbie C# student :D

  • @frediopratamad2349
    @frediopratamad2349 2 года назад +1

    How interesting!, I can Implemented it without any error, Thanks RJ Code

  • @bakiwebdev
    @bakiwebdev 2 года назад +1

    Thank you ma man. keep up the good work

  • @hozmannew896
    @hozmannew896 3 года назад +1

    amazing, thank you so much, great efforts

  • @denisvyazankin3744
    @denisvyazankin3744 2 года назад +1

    Really good content. Amazing useful! Keep going! Good luck, and more subs)

  • @KvarkLt
    @KvarkLt 2 года назад +1

    SuperB! Thanks a lot for such! That was missing brick for me!

  • @gabrielcouto4356
    @gabrielcouto4356 2 года назад +1

    Amazing, thank very much

  • @tim-w
    @tim-w Год назад

    Thanks for the great video.

  • @bastibasti7350
    @bastibasti7350 2 года назад +2

    Very well done, well eplained and providing the code is awesome. One question tho, in the beginning of the video you have buttons with an image as well, could you maybe make a video where you show how that can be done?

  • @user-pw2rl9kw1j
    @user-pw2rl9kw1j 3 месяца назад

    Finally I got as i want ,, really thanks a lot🥺

  • @sewwandiweerasingha7032
    @sewwandiweerasingha7032 2 года назад

    Thank you so much for this video....it helps me a lot.......🙏

  • @Optimuseq
    @Optimuseq 2 года назад

    You made my day!

  • @naturalanimals2
    @naturalanimals2 2 года назад

    Thanks So Much . You are the best.

  • @adnanesikilli3718
    @adnanesikilli3718 8 месяцев назад

    Great work !!

  • @corvojow
    @corvojow 3 года назад +1

    Just amazing

  • @mayurshetty4587
    @mayurshetty4587 2 года назад +3

    This is really helpful. The output is awesome. Kindly help us in creating rounded form as well.. Thank You :)

  • @ady200003
    @ady200003 3 года назад +1

    Great video !!! Thanks for sharing !!! Can you please include in one of your next video gradient color for a control ?

  • @jmloli
    @jmloli 9 месяцев назад

    Muchísimas gracias, me fué de mucha ayuda.

  • @saoodhussain3857
    @saoodhussain3857 9 месяцев назад

    you the man , you are real life iron man

  • @samuelgirmagirma4019
    @samuelgirmagirma4019 3 года назад +1

    Thanks for The Buttons they are coool hoping that you will make a video about a custom webveiw

  • @mpgsystem
    @mpgsystem 2 года назад

    Parabéns pelo vídeo. Ganhou um inscrito.

  • @yxvwa
    @yxvwa 8 месяцев назад

    ОТЛИЧНО! Спасибо за видео и идею

  • @dionisheraliyanage3634
    @dionisheraliyanage3634 Месяц назад

    Thanks🙏 ❤

  • @TheWammbo
    @TheWammbo 2 года назад

    Thanks a lot

  • @MohammadSadeqq
    @MohammadSadeqq 2 года назад

    Amazing❤

  • @nguyen4153
    @nguyen4153 Год назад

    Thank you very muchhhh

  • @raphael2921
    @raphael2921 2 года назад

    With this tutorial , i can remake all controls! Just the property "BackgroundColor" and "TextColor" is the same property than "BackColor" and "ForeColor"

  • @janslanina2209
    @janslanina2209 2 года назад

    It works and it is astounishing ! Love your work !
    EDIT: when you make the button transparent the lower side is not a straight line. :(

  • @FudanshIKun
    @FudanshIKun 2 года назад +5

    May I ask, What topic of c# programming should I learn to understand and be able to make these codes by myself? thank you in forward.

  • @fatimashehzadi8604
    @fatimashehzadi8604 2 года назад

    hello! Great tutorial sir i want to use icon color change property in this button can you please tell me which line of code i should write

  • @glebi.r6
    @glebi.r6 2 года назад

    Awesome tutorial!
    But howcan I add picture/iocn like in the beginning of the video?

  • @MuhammadAziz-tb8zr
    @MuhammadAziz-tb8zr 2 года назад +1

    Awesome. But I have problem, when I made the button size around (250, 50) and set the image align to middle left, the result was unsatisfying for me. So I added new picture box, set the size mode to "auto size", set the location and finally override OnSizeChanged to change the picturebox location every time button's size changed, but it didn't work, and the picture box just disappeared when the size changed. Do any of you have solution. This is the code
    PictureBox picture = new PictureBox();
    picture.sizemode = PictureBoxSizeMode.AutoSize;
    picture.Location = new Point (this.Location.X + 25, this.Location.Y + this.Height/2 - picture.Height/2);
    this.Controls.Add(picture);
    //And the override
    protected override void OnSizeChanged(EventArgs e)
    {
    base.OnSizeChanged(e);
    picture.Location = new Point (this.Location.X + 25, this.Location.Y + this.Height/2 - picture.Height/2);
    }
    Thanks for listening this long and boring question :)

  • @learn9491
    @learn9491 3 года назад +3

    Thx. Pls if possible, next time do it in dark theme of VS. For convinient sake.

  • @ahmadgamal3200
    @ahmadgamal3200 2 года назад

    Thanks Pro

  • @sebastiaofreitas2554
    @sebastiaofreitas2554 Год назад

    Very good. A lot Is there any ListView type control that I can populate with a product table, with each ListView item having 2 lines, one with the product code and description and the second with the quantity sold and the price?

  • @technomed6720
    @technomed6720 Месяц назад

    Thanks for your videos, i notice when i radius the button and put it on the panel the corner of the button become not smooth this happen when i
    put the button on panel

  • @periandavarg7558
    @periandavarg7558 Год назад

    Thanks, how about for panel type with similar code.
    There is slight change in it (inheriting from panel). Can you please give suggestion

  • @GuardaOsservaValuta
    @GuardaOsservaValuta 2 года назад

    Thanks very useful your videos, really thanks.
    Could you make a video for creating a 3D button?

  • @amrelsayedahmed3102
    @amrelsayedahmed3102 2 года назад

    Thanks you are great , can you make Advanced Track Bar

  • @maxgdh7618
    @maxgdh7618 Год назад +3

    Hi, thanks for the tutorial
    I have several problems though
    Like, corners being pixelish, or bottom right corner being less "round" than others. Also I noticed that border line tends to not fully cover borders of the button, which results in some ugly one-pixel-thick lines outside the borderline
    Why that could possibly happen and what can I do to fix that?

    • @raymondvanroest372
      @raymondvanroest372 10 месяцев назад

      Try setting the back color to transparent rather than giving it an actual color, and only set fore color and border color to an actual color

  • @nurcahyono714
    @nurcahyono714 2 года назад

    great tutorial. but can we add this button to wpf?

  • @user-sd6ge4nf1y
    @user-sd6ge4nf1y 2 года назад

    شكرا لك

  • @arsaljee6573
    @arsaljee6573 2 года назад

    how to learn front end styling manually for window form in visual studio.please tell me.

  • @arthur2633
    @arthur2633 3 года назад

    How to make a button that can change the color of the selected icon in visual basic? can you show this?

  • @duytrananh2292
    @duytrananh2292 2 года назад

    Well this is nice, but my app is extremely lagging when i moving my form around. Pretty sure it is OnPaint that cause the lag, any way to prevent it?

  • @TheAmazeer
    @TheAmazeer Месяц назад

    how do you add thosE icons inside your buttons ?

  • @nove1398
    @nove1398 Год назад

    Can i have 3 buttons in the same gridview cell? Like the same column and row had 3 buttons instead of one

  • @serhatkaradag8786
    @serhatkaradag8786 2 года назад

    Please tell me how to add icons to left and right and image ?

  • @lshadowSFX
    @lshadowSFX Год назад

    Extremely beautifuil! but i have one issue i can't seem to solve! If there is an image as the background of the form, the border looks really bad. How can i fix this? :(

  • @ryanrishat1665
    @ryanrishat1665 2 года назад

    Okay Great

  • @jonaszprzybycien6545
    @jonaszprzybycien6545 11 месяцев назад

    is there a way to make regular buttons smother without making a new class that extends Button? The way my probram works requires me to use them.

  • @rirsfleex-kilsog8918
    @rirsfleex-kilsog8918 3 года назад +2

    good video, a question do you have a social network or something? is to ask you a question

  • @kashikoi4318
    @kashikoi4318 6 месяцев назад

    Hello Can anyone tell why the category in mine does not show up??

  • @myprogramme5303
    @myprogramme5303 3 года назад +2

    more and more please

  • @user-ul9vc6dq5j
    @user-ul9vc6dq5j 2 года назад +1

    in the End Video You did not use Icon In Button ,Does the video have a second part?

  • @1007643
    @1007643 2 года назад

    hi, it's possible to change font with imported font ?

  • @masoudartan2411
    @masoudartan2411 2 года назад

    Hello I knocked like your codes, but my button is not applied at runtime, Only the primary borderRadius is applied What is the problem?

  • @zacharyschwanke7160
    @zacharyschwanke7160 Год назад

    now how do make the button a flashing color?

  • @sbasalan
    @sbasalan 5 месяцев назад

    But you did not show in the video how to add icon or image something center of a buttton.

  • @wilsoncristiano4247
    @wilsoncristiano4247 2 года назад

    Why not:
    path.StartFigure();
    path.AddArc(rect.X,rect.Y,radius,radius, 180, 90);
    path.AddArc(rect.Width-radius, rect.Y, radius, radius, 270, 90);
    path.AddArc(rect.Width-radius, rect.Y, radius, radius, 0, 90);
    path.AddArc(rect.X, rect.Y, radius, radius, 90, 90);
    path.CloseFigure();
    Why using "rect.Height - radius" instead "rect.Y"? (It gives the same result and it's more understable way!)
    Thank you for your tutorial! :D

  • @thomasjoshua3499
    @thomasjoshua3499 Год назад +2

    Great work. I want to add that, you would want to use Region property in OnHandleCreated() event instead of OnPaint(). Region in OnPaint() will trigger tons of events and use very large amount of system resources. I have a simple panle and only a single rounded button and it cost my pc nearly 30% CPU usage.
    I move the region codes to OnHandleCreated(), and it solve the problem :)

    • @it-traveler
      @it-traveler Год назад

      Thomas, you've saved my day🙂. I've had the similar problem, thank you very much for this solution😊. Could you give me a hint how exactly did you change your code? I read that you moved Region codes to OnHandleCreated but what does your OnPaint method look like now? Thanks in advance for your reply😄

    • @thomasjoshua3499
      @thomasjoshua3499 Год назад +2

      @@it-traveler Since the region is also associated with the control's size, so I ended up assigning the control's Resize event to a new function. So the code might look like this.
      Assign the resizing event in the OnHandleCreated event:
      protected override void OnHandleCreated(EventArgs e)
      {
      base.OnHandleCreated(e);
      this.Parent.BackColorChanged += new EventHandler(Container_BackColorChanged);
      this.Resize += Region_Update;
      }
      And the new function is:
      private void Region_Update(object? sender, EventArgs e)
      {
      //Assign new region here
      RectangleF Rect_OutterSurface = new RectangleF(0, 0, this.Width, this.Height);
      if (Border_Radius > 2)
      {
      using (GraphicsPath Path_OutterSurface = GetFigurePath(Rect_OutterSurface, Border_Radius))
      {
      this.Region = new Region(Path_OutterSurface);
      }
      }
      else
      {
      this.Region = new Region(Rect_OutterSurface);
      }
      }

    • @it-traveler
      @it-traveler Год назад

      @@thomasjoshua3499 thanks a lot😃 BTW, is there a way to avoid rectangular-oval effect when placing a button in Form Designer? It fixes with immediate Region_Update call but maybe something else?

    • @thomasjoshua3499
      @thomasjoshua3499 Год назад

      @@it-traveler Glad to hear my answer is working, but unfortunately about the rectangular-oval effect, I haven't encountered it yet and don't have a clue how to solve it.

  • @MrYosi90
    @MrYosi90 2 года назад

    When i use it, the onpaint event fires continuously. what could be causing it?
    in the other hand, the antialias isnt working for me too.

    • @RJCodeAdvanceEN
      @RJCodeAdvanceEN  2 года назад

      Sometimes the project will hang, clean the project, close visual studio, and reopen it.

  • @orakulstorm3720
    @orakulstorm3720 3 года назад +2

    Coool Спасибо, у вас очень полезные видео. Привет, из Украины)

  • @gizemdenizkoksal8815
    @gizemdenizkoksal8815 2 года назад

    I don't like this man, I'm in love with this man :D

  •  2 года назад +1

    It doesnt show on my toolbox, even after built and rebuilt project. Any tips?

    • @shawnthomas3918
      @shawnthomas3918 2 года назад

      did u get it working?

    •  2 года назад +1

      @@shawnthomas3918 yes, I dont remember exactly what I did, I think that I closed e reopen the Visual Studio

    • @shawnthomas3918
      @shawnthomas3918 2 года назад

      Ahh ok, I had forgotten to import the systems component model as described in the previous video

  • @serhatkaradag8786
    @serhatkaradag8786 2 года назад +1

    In your Tutorial you didn't show , how create Custom Button with image but your Video shows pictures at start.

  • @Jordan-cz1zf
    @Jordan-cz1zf 2 года назад

    I'm having trouble making circular buttons. If I set them to be circles in the designer, they revert to being squares with rounded edges when I run the app. The only way I can get them to stay as circles is to make them bigger than necessary in the designer and then reducing the size using code on load. Anyone have a solution?

    • @RJCodeAdvanceEN
      @RJCodeAdvanceEN  2 года назад

      Hi,
      Removes the following condition from the border radius property.
      if (borderRadius > this.Height)
      borderRadius = this.Height;
      In the code published on the website this is corrected.

  • @ozgurege6613
    @ozgurege6613 4 месяца назад

    button in textbox ?

  • @khalidsalim-ey6iv
    @khalidsalim-ey6iv Год назад

    anyone have the code it text form ?

  • @DangTheVinh-Hanjo
    @DangTheVinh-Hanjo 2 года назад

    Custom calendar pls

  • @yonatanklein
    @yonatanklein Год назад

    is it relevant for .net too?

  • @mrmakinist
    @mrmakinist 2 года назад

    Pleas radial progress bar

  • @mrmakinist
    @mrmakinist Год назад

    Pleasssss c# round trackbar make

  • @ardafirat2124
    @ardafirat2124 Год назад +1

    Abi yazdığın kod çalışmıyor tekrar yaz bence ben bu işlerde baya iyiyim ama hataların var düzelt istersen

  • @allhzzenmiserable2295
    @allhzzenmiserable2295 2 года назад

    Source code please

  • @mfs6165
    @mfs6165 2 года назад +1

    01:59

  • @CodeDisease
    @CodeDisease 3 года назад +1

    You should make your own library like guna and make free

    • @RJCodeAdvanceEN
      @RJCodeAdvanceEN  3 года назад +3

      Yes, I've been thinking that. So I will try to do it soon and make it open source. But maybe Bunify or Guna will go bankrupt 😅

  • @user-kk4th8ev1p
    @user-kk4th8ev1p 2 года назад

    8:56

  • @vinso6600
    @vinso6600 2 года назад +1

    why would microsoft make this so complicated forcing us to make images with onclick listeners XD

  • @ahmetmericozcan2310
    @ahmetmericozcan2310 Год назад

    This custom buttons is not good for different resolutions!!! Whyyy, it scales really bad.

  • @Often_Guy
    @Often_Guy Год назад +1

    OMG WHY THE ERIC VOICE!?!

  • @xastralmars
    @xastralmars 3 года назад +1

    this doesn't work

  • @eletrixalt
    @eletrixalt 2 года назад

    dosent work

  • @arthur2633
    @arthur2633 3 года назад

    İcon color

  • @Khunryijduy
    @Khunryijduy 8 месяцев назад

    Popcom 🎉❤🎉 silençe you 😊❤😊😊😊😂😂😂🎉

  • @ardafirat2124
    @ardafirat2124 Год назад +1

    İşine karışıyor gibi olmasın ama yanlışların var