So I've got this problem where I'm creating a control in c# .NET, and I can use it just fine in VB6. However, since you can't place borderless controls in .net containers in vb6, I've tried making a special .NET Label and exposing it to vb6.
I can get this label on my form just fine, but I can't make it transparent.
I have tried using UserControl_AmbientChanged but the Ambient.BackColor always seems to be the form's color, and not the actual parent's color (say, a frame). Same when I use UserControl.Parent and then the Parent's BackColor. Same with Extender.Parent. Even if that worked, it wouldn't be pretty in the case where the background is an image.
I've tried using SetWindowLong but that just makes the whole label invisible / transparent with no regards for the Caption.
I've tried using a bliting technique found here: http://www.vbforums.com/showthread.php?438895-transparent-text-box-or-label-with-scrollbars&highlight=transparent%20TextBox But this did not work as my controls are not PictureBoxes.
I'm out of option, has anyone done this before? How? Any help at all would be very appreciated.
If I understand your situation correctly you will want to set the .NET user control background color to something distinct (say a pink color with a specific HEX color code). Then in your VB6 application you'll set this same color code (pink) to be the transparent color within the property sheet.
I've handled transparency in VB6 user controls in this fashion for a number of years and it seems to work fine.
As for the comments regarding VB6 in 2013 for an Enterprise application, well these people obviously haven't working in the software industry for long :) VB6 has been implemented in millions of Enterprise applications that are still in use today. I would ask one question for the users that posted such comments, how can you provide the power of a VB6 ActiveX control in any other language? Answer -> You cannot.
Related
Im trying to change the color of button widget in GTK# by using
button1.ModifyBase(Statetype.Normal,new Gdk.Color(1,1,1));
This is called from another button click event,but the widget color is not updated
why is this?
Instead of the 'flaky' ModifyBase, you can just use the ModifyBG method, same params are passed.
button1.ModifyBG(Statetype.Normal,new Gdk.Color(1,1,1));
BTW, I say flaky since you are dealing with GTK2.x under Mono GTK# and there are tons of issues on both sides when it comes to 'theming' and Mono. GTK3 has a consist model using a CSS approach, but the Mono distro is stuck on GTK2. You can search for theming GTK 2.x if you wish to theme/colorize your application the GTK way. Note: If using MonoDevelop/XS, make sure you routinely test/run it outside of the IDE as the app theming will change (this is really apparent on OS-X and again, an issue that goes back years and years).
If you have other widgets that do not 'behave' correctly in their background colors, you can place them within an eventbox widget as that widget has a background while others might not. You can search for this condition within the Mono email threads as it has been around since 2007.
I'm writing a program to implement COM component in C#. This component provides a UI component too. In the interest of making it easy to implement future additions to the component, I decided to write the UI in Xaml using WPF and wrapping it in an ElementHost control to provide the handle back to to the COM consumer.
Here's where this gets interesting. The element is being hosted in a win32 tab control. The first time the tab is selected, it loads fine. Switching to another tab and coming back causes it to not draw the component correctly. If I move the mouse through it, it'll draw the TextBox elements, but it'll never redraw the whole UserComponent.
I've tried every possible solution I've seen suggested, from changing the height/width values of the component to putting the HwndTarget in SoftwareOnly rendering mode.
I'm not sure what to try at this point, so suggestions are welcome. I'd really like to do this without using Windows Forms as the future maintainers of this aren't the best programmers and it's a lot easier to tell them to write up a Xaml file with data bindings than manually lay out a form and set the values in the code-behind.
Haven't met such problem yet.
Try to force refresh or focus (methods) to the hosting wrapper or HwndSource when switching to the hosting tab.
I developing an application in C# on Windows mobile 6.5 and .NET 3.5 CF. I'm using multiple forms and would like to have a common color scheme that is easily changed by just changing a color definition file or some simple option in VS 2008.
I've looked around and it doesn't seem to be any clear solution. I've tried digging down to where the colors are defined to see it I could add my own that would be a global variable, or even in the designer files, but there is not mention of color, the only way I can change the color is in the properties window.
A simple way to do this is to use Form inheritance. Create a template form (named "TemplateForm.frm" or whatever), color/style is as you wish, then add one (invisible) instance of each type of control (a Button, a Checkbox, a Label etc.) that you're using on all of your other forms.
Then edit your existing forms so that they inherit from TemplateForm (instead of inheriting from Form). Add a method to TemplateForm's Load event that iterates through all the controls on the form (this needs to be recursive, of course) and styles each one (font, colors etc.) to match the corresponding (invisible template) control of that type on the parent form.
An other approach, probably not better, is to modify the system colors in the registry in [HKEY_LOCAL_MACHINE\System\GWE] "SysColor". I've used it, but I'm not a fan as it is sometime hard to get a good set of colors that work, and it changes it everywhere in the system. #MusiGenesis appoach affords you finer control.
see Customizing System Colors
May be i can get some negative points on this question but, really this question is boggling in my mind from last many days that what is the basic/raw code behind textbox(or other such controls).
i mean i understands that, we can inherit the textbox class and make our changes, we creates its object and use it.
but wants to know how that class creates a textbox(the design which allow us to enter text) (same query for other components), is it a code of 'C' language which are generating it using CG (computer graphics) programming or any other thing.
Experts please resolve my curiosity.
Thanks
Windows provides several basic API's for drawing on the screen. You can draw pixels, lines, boxes and more complex geometric shapes. There are also API's to draw text. Other API's allow you to react to user input, e.g. mouse movement and clicks and keyboard input.
From these basic API's you can create your own text box by drawing the exact pixels of how the text box should look and react to user input. However, Windows has a built-in concept of a text box. This text box has a standard look and feel and is also integrated with UI concepts like focus, tab order, the clipboard and the caret. But behind the scenes Windows is using the low level API functions to draw on the screen and react to user input.
When you create a TextBox in Windows Forms it actually creates and wraps a standard Windows Edit control. This control is drawn using GDI. However, other programming models like WPF may create TextBox controls that looks like a normal text box but uses a custom implementation supplied by WPF and is drawn using DirectX.
Use http://www.red-gate.com/products/reflector/ and see for yourself...
Here is what I think it is doing:
The Raw code behind TextBox or any other Control uses Windows API that is responsible for drawing these controls and provide Handles of these controls for later reference.
Windows has been using different methods to draw it's UI like GDI, GDI+ and sometimes DirectX. I may be wrong and there may be some other techs I forgot to mention.
These controls use each window's WinProc to receive Input Notification and other callbacks that notify these controls when clicked, typed or for example resized.
I have been extending the RichTextBox control in VS2008 using C# (adding printer support and URL links). I have most of the functionality I need but the control is not that good. I do not know how to change the mouse cursor for image sizing handles. Bullets get out of wack with the size and colour. I need this for winforms not asp.net or wpf. I prefer rtf to html wysiwyg editors.
Most of the richtextbox replacements are either too old .NET 1.0/1.1, too simple or way too complex and expensive.
I am using Infragistics control libraries and their closest control to the richtextbox does not quite provide all the functionality I want. They do supply a spell checking control which works with both their text based controls and std winforms textbox and richtextbox. It will work with any control that implements the IProvideTextBox or ISupportSpellChecking interfaces. Unfortunately most of the functionally richtextbox replacements provide their own spelling checking addon controls which do not support either IProvideTextBox or ISupportSpellChecking. I want to distibute 1 std dictionary to users with my application not multiple one which need to be kept some how in synch.
The other thing is the richtextbox just comes as an unadorned control. You need to add your own menu controls and wire things up yourself. Most of the expensive replacments provide a tool bar ready wired up. This is nice but if one is developing a consistant look and feel to all ones applications having to drop a vendors tool bar makes this difficult as one now has this odd set of menu buttons that look and behave differently to the rest of my UI. Also I am using an application styler to skin my aplications. Third party menu controls are unlikely to accomodate this sort of styling.
Can anyone suggest a reasonable RichTextBox control replace that I could use that won't cost the earth, works in winforms, supports RTF and is robust with proper mouse over transitions for image sizing handles and with reliable bullet support.
My current option is scale back my efforts and remove support for the features that just don't cut it but will still leave me with something that is usable.
We use the DevExpress Rich Text Editor here are we are very satisfied. The price is not high and the support is incredible.
The editor is also embeddable inside their grid, should you want to buy the whole package.
By adorner, do you mean like the Office 2007 toolbar that pop out over a selected text?
While I don't have extensive experience with RichTextBoxes, I have had great success with the DevExpress control suite in the past (much, much nicer than Infragistics, IMHO). I also know that they released a brand new RTF editor in the past few months, so I would definitely give that a look.
You could always try the Microsoft Inkedit Control provided you've got an OS that supports it (I had issues with 64bit WS2008, and Windows XP, but the rest were fine).
InkEdit inherits from RichTextBox so you can:
private System.Windows.Forms.RichTextBox richTextBox3;
try
{
this.richTextBox3 = new Microsoft.Ink.InkEdit();
Microsoft.Ink.InkEdit ie = (Microsoft.Ink.InkEdit)richTextBox3;
// disable tablet-style ink mode
ie.InkMode = Microsoft.Ink.InkMode.Disabled;
}
catch
{
\\ in case platform does not support inkedit control
this.richTextBox3 = new RichTextBox();
}
You will need to add a reference to the Microsoft.Ink.dll which (on my machine) is at:
C:\Program Files\Reference Assemblies\Microsoft\Tablet PC
Unless you want to use this controls ink features, then there probably aren't major benefits in terms as features. But, I have noticed that loading text is much faster for long files (10x +) than the previous RichTextBox and also seems to have smoother scrolling.
This seems to be unadvertised, but Visual Studio 2010 B1 has an updated RichTextBox control also.
I'm using the ScintillaNet, but it also in some way (very) complex.