I am not worried about whether this is in Winforms or WPF.
Is there ANY way at all that I could develop my own user control like the one found in Microsoft Paint, below:
If you can't see the pic above, it's here: http://img232.imageshack.us/i/txtboxlblctrl.png/
Is there anyway at all I can do something like this in C#?
Thank you
Sure you can. By developing your own Usercontrol you can do nearly anything.
I think the easiest way would be to use a WPF TextBox and alternate it with a template.
This [http://img199.imageshack.us/i/textboxu.png/] is what you get by simply using [http://img163.imageshack.us/i/stipe.png/] as BorderBrush
Related
How can I make a custom button like in the image below? I searched on Google about custom control, but this is more special, is animated...
I know that on StackOoverflow are more questions like mine, but it is not a duplicate, I want to learn more about this particular button.
It is a button for WinForms.
you can create these buttons with GDI+ in C#,for example look at this one
On Windows form these buttons are made using the BackgroundImage Property of Button Control.
All you need is to toggle the background image on events like Click,OnMouseEnter etc.
This is not a custom control, this is CSS
Have a look at this, http://www.dynamicdrive.com/style/csslibrary/item/css_square_buttons/
You should possibly read something about gif-animation, jquery animation or css3 transitions to be able to animate backgrounds of such element
I have a combobox in my winform, and I wish change the button that show the list (with the triangle) with another button or at least change the image..
it's possible? how can I do this?
thanks!
you should use OwnerDrawn techniques like the one described here: https://stackoverflow.com/questions/2891981/net-ownerdraw-combobox-vista-7-themed-dropdownlist
or you override the window proc and redefine whole control message handling or you create your own control from scratch or you use third party controls like DevExpress WinForms suite or Telerik ones.
I'm trying to style some wpf user controls to make them look the same i have in my web application. I found some really great example for every control i need except for sliders and radio buttons.
Here is how they should look like:
Slider:
Radio Button:
I know i should create some ControlTemplate but i don't really know where to start...
If you can provide a complete example it would be perfect, but i guess that even some good deep advise would fit my needs.
Thank you 1000!
I have style sample here. It renders this:
I would start with Control Styles and Templates on MSDN pages. There are examples for most controls which give a good overview of how the control template works. Also you can extract/download the original control template and try to make your changes to it. Download default control templates
P.S. Actually the slider example on the first link resembles the one you describe.
Try using Expression Blend.
Learn Expression
and specifically this video: Creating ControlTemplates.
Expression Blend is something like a XAML design application - you can size, colour, adjust fill and stroke etc on all the elements in a control. It takes a little while to get used to, but you will be able to design controls with a graphical UI and Expression will provide you with the appropriate XAML to use in your project.
I'm wondering if it is possible to create a busy indicator with the following style:
The default busy indicator I don't like so I wanted to customize it and have it appear like the above? But I don't think I can use 'gif' images in silverlight. Anyone know how to achieve this?
In this post you can see how a progress bar can be templated
It might be easiest to do this in Blend instead of typing it in XAML.
Have a look at this question too: Problem with IsIndeterminate while trying to put together a ProgressBar XAML template
I found this code here which explains how to create custom controls. I have been using these controls as buttons, but now that I am beginning to understand the code a bit more, I would like to try and create a text box control using the same drawing techniques. I have been searching endlessly for some examples on the subject, but cannot find a single one. I don't understand how a textbox can be writable if a rectangle is being used to make it. Does anybody have any experience creating custom controls in C#? I would like for my textbox to be able to match the theme in the above link which is why it has to be custom made.
Well, at the beginning you should have in mind, that the implementation of new text box control is kinda complicate thing. It is necessary that you consider the following points:
1) What should your textbox do? How can the user interact with it? Which events do you necessarely throw?
2) How should you textbox be drawn? Is it a simple box with an outline or do you have elements which are different if the user gets interacted.
A good starting point for implementing your own textbox is to look how it works under the hood - in fact, you should start by referencing to samples which came from the DirectX and DirectDrawing area, one example is the following link (the sample is for c++, but the concepts are the same as used in windowsforms or wpf drawing):
http://www.uc-forum.com/forum/d3d-tutorials-and-source/65377-make-textbox-ingame-console-directx.html
a more direct sample (explaining howto extend an existing textbox) can be found here:
http://www.codedblog.com/2007/09/17/owner-drawing-a-windowsforms-textbox/
All in all, to achieve your goal try to extend the basic text box at the beginning and afterwards start with a component which is not that complicated, for example a simple checkbox. Go on and at the end you will be able to implement your own textbox control ;)