I've been struggling for a long time with basic controls that Windows Forms offers to developers, but... right now, I am developing an application that requires more advanced control than normal "TextBox".
Since, at this time, my application is about memory management, I have to show in the form, the process memory in bytes (or other type of data) to the user, giving it the ability to modify it as he wants.
The problem comes here, because... if I show the data in a TextBox, it only allow me to display the data in read-only text because if I let the user modify the textbox directly, it will be very messy and unaesthetic.
I was reviewing some projects on SourceForge about C# and the handling of hexadecimal data, and i found a good project, called Be.HexEditor, which has a control developed and designed by its creators, but in GDI+.
The control is called HexBox, and that's just what I need to get.
Do any of you know how to develop a control like this?... I would greatly facilitate things. What kind of manuals/books should I read to learn this kind of development? I ask this because I ignore everything about GDI+.
Or... is there other way for do it?
I would use a textbox to show to the user the current value and another textbox to enter the desired value (maybe a slider will work better).
I think you'll find it's GDI+ that you have to learn
http://www.amazon.co.uk/GDI-Programming-Creating-Controls-Programmer/dp/1861006314
You may still be able to write controls in WPF and then include them somehow into your winforms app, but if you need to push pixels GDI+ is the only way.
Related
I just inherited a C# windows application codebase. It's a relatively large application with lots and lots of UI "elements" that I believe may have been added by the previous developer with little to no interaction with the actual clients. This application is a robotics control system, it runs at a manufacturing facility, and it has some of the most complex UIs I have ever seen (forms inside of forms inside of tabbed elements inside of etc...)
One of the first things I want to do, is learn about how the actual plant floor associates interact with this application. I have already sent out a survey to the different supervisors, but I would like some empirical data as well.
What I would like to do:
I would like to somehow, capture every time a user presses a button, control, etc... and record it to a file. Something simple like:
timestamp,name of control,any other cool data I can capture (program run state, for example.)
The difficulty is that I'm not really a C# expert at this point, and I can't figure out the appropriate way to add some sort of global behavior to my application which does this, and doesn't impact existing functionality. Any advice would be greatly appreciated.
Global keyboard and mouse hooks would be the way to go. Unless someone knows the design thoroughly and can comment how to extend existing functionality. it is going to be bit difficult.
Ive been working on a C# project for a while now and I fell it needs change its look.
I have found a UI kit that I really like, which can be seen below:
http://medialoot.com/item/transparent-ui-kit/
Does anyone know how to do this?
Thanks
EDIT: Im using WinForms
EDIT2: Maybe I should convert over to WPF? Is this doable?
You can subclass most common controls and draw their appearance yourself. However, unless for novelty applications I doubt your users will thank you for doing so.
Your example is a library of controls. For you to have an appearance such as that you'll have to create or acquire a similar library of controls and replace all your controls in your project to get that appearance.
If you want to update colors (background, foreground, etc.) and such you can make a class that recurses through controls and sets the settings using reflection and a switch statement to process each control. Then just run this on each form before you show it. One word of caution about this, some controls don't respect your changes and get overridden with themes from the OS (datetimerpicker being the biggest culprit). You'll also need to consider whether your users will appreciate the extra work put in for color/appearance changes.
If you don't have very good design skill and have a good know how about creating such templates, its better to buy them.
And C# is just a language. You're looking to create templates and skins for either for ASP.NET website/application or for windows forms.
Have a look at DevExpress Skins
If you can afford it.
I need to create a window similar to this:
a window similar to the types of dialog boxes that have been included with windows vista.
but I could not find exactly the same dialog boxes. very similar - it's Credential dialog and Input dialog. In the first case there are differences in the UI, in the second - the number of input fields and the absence of label. How can I make exactly the same window? Sorry for bad English.
You want to create a dialog exactly like the first dialog you've shown, the one used by FluffyApp?
You'll have to create it yourself, by hand. It's not a standard Windows dialog; it's a custom dialog resource provided by the FluffyApp application. It's obviously modeled to look a lot like the standard Windows authentication dialog, which is a good idea—users are already familiar with the native UI and will find your application to be much easier to use if it strongly resembles what they're already accustomed to. I recommend that if you decide to create your own custom dialog that you follow Windows's example as well.
But it's not entirely clear why you need your dialog to look exactly like the one that FluffyApp uses. I'm not really even sure why FluffyApp needed to create a custom dialog! It seems like the standard Windows authentication dialog would be perfectly sufficient. They have the same number of input fields, the UI designers at Microsoft have just replaced labels with cue banners. Not anything to worry about.
Those are standard windows dialogs, but instead of letting the dialog manager draw the text, they use DrawThemeText to draw the text, using one of the themed elements (not sure what, because you have several examples). You can play around with the various parameters to DrawThemeText to come up with something that works.
basically my project is an MDI Winform application where a user can customize the interface by adding various controls and changing the layout. I would like to be able to save the state of the application for each user.
I have done quite a bit of searching and found these:
How to auto save and auto load all properties in winforms C#?
Save WinForm or Controls to File
Basically from what I understand, the best approach is to serialize the data to XML, however winform controls are not serializable, so I would have use surrogate classes:
http://www.codeproject.com/KB/dotnet/Surrogate_Serialization.aspx
Now, do I need to write a surrogate class for each of my controls? I would need to write some sort of a recursive algorithm to save all my controls, what is the best approach to do accomplish that? How would I then restore all the windows, should I use the memento design pattern for that? If I want to implement multiple users later, should I use Nhibernate to store all the object data in a database? I am still trying to wrap my head around the problem and if anyone has any experience or advice I would greatly appreciate it, thanks
You don't want to serialize the actual control instances. They should be created and destroyed along with the Form they reside in. Rather look at what you let the user customize. Layout and position? Very well, save out the Top and Left coordinates for each control along with a control identifier. Do you let the user add new controls? Save their ids along with a type identifier so when its time to reload you are able to recreate the controls at their previous position.
Whether you use XML or some other format, there is no best approach or best practice, choose what makes sense for your project. XML happens to be an easy to go with format with great support in the .Net Framework.
I know there is a software, LinsUI Layout Manager, which handle your problems very well. They have free version for interested developers. You can check the site.
Cheer
I need to design a calendar control which should be added to our companie's application (I know there's already quite a lot calendar controls but I shall develop our own one...).
How should I start, should I use a kind of table to display the days or should I completely draw my own grid? How can I do this (I do not need rdy-to-use code, I just need some ideas...)
The application is written in C# as a WindowsForms application (thanks for the hint, forgot to mention this in first case...)
Seeing your comment about WinForms and:
I need to develop an own one because it must be integrated in an already existent application, I need full access in means of style and functionality
makes me suggest to use ready project http://www.codeproject.com/KB/selection/MonthCalendar.aspx and modify it if necessary. I use it in my own little project and it works like a charm. It provides full source if necessary so you can integrate it easily and modify if you think it's not fit enough.
In the end if you end up not using it, you can peak at the sources and functionality it implements and do it your own way.
To me redoing it from scratch is a bit pointless especially with such a good / free one.
If you are developing a web application then I would seriously look at using jquery. A good calendar control should be done client side so I would be looking at some form of java script solution. If you look at jquery-calendar.js as a good example you will see the complexity involved in developing your own control.