|
how to change the tab contol background color?
thnx in advance
|
|
|
|
|
You'll have to handle painting yourself since TabControl.BackColor always returns SystemColors.Control . You'll have to extend TabControl with your own class and override OnPaint to do so. There should be several articles here on CP ( I knew of a good one, but the bastard went commercial and pulled all his articles off CP after he got all our free help and beta testing! )
Why is this so hard? Because almost every control in System.Windows.Forms is just a wrapper for its Windows Common Controls equivalent where such details are often abstracted or don't fit the .NET pattern at all times. It is possible, though. I used a similar approach to override the painting for the actual TagPage s in order to make them use the Theme API (for Visual Styles) correctly (they don't by default).
[EDIT]
Note: this is only for the TabControl itself. To paint the TabPage s, see the next message I posted (memory slipped!).
[/EDIT]
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
You can set the TabControl.DrawMode to TabDrawMode.OwnerDrawFixed and 1) handle the TabControl.DrawItem event if handling the painting from another control, or 2) override the TabControl.OnDrawItem if extending the TabControl with your own class (faster than handling the event inside a derivitive class).
[EDIT]
Note: this is only for the TabPage s. See the previous message about the TabControl itself.
[/EDIT]
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi,
I am goin to make a Toolbar (band) for the Internet Explorer. But I can't find any good examples on that subject. I need to have a concrete example of a toolbar, that's all I need to advance..
Thank You!
//- UP THE IRONS, MORTEN S. KRISTENSEN -\\
|
|
|
|
|
Since you're in the C# forum, I assume you're going to do this in C#. Therefore, see this article: Extending Explorer with Band Objects using .NET and Windows Forms[^]. This provides a simple base class and attribute to make DeskBands.
I should warn you, however, that this is somewhat limited. You'd be better off using C++ and write one using COM or ATL (wrapper classes for COM). For documentation, search MSDN[^] for IDeskBand . You'll find LOTS of information.
Even if you use the first link I gave you, you should still read some of the information from the search results I mentioned directly above. It's important to understand how things work.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Yeah I read the example over a couple of times, but I'd like a more concrete example. That is if that is possible of course. And I also have to say that I code in notepad/mono =)- Dont have VS.NET.
And yes there is indeed mostly information in C++, but there has to be some good ones in C# too.
Hmm..
//- UP THE IRONS, MORTEN S. KRISTENSEN -\\
|
|
|
|
|
Morten Kristensen wrote:
And I also have to say that I code in notepad/mono =)- Dont have VS.NET.
Good for you. I do a lot of coding in GViM, but what does that have to do with anything? You don't need VS.NET to code these solutions.
Morten Kristensen wrote:
but there has to be some good ones in C# too.
There has to be? Someone has to be first. If you do a search on CP like I said, you'll find plenty of related articles about how to emulate a console window. The first link was how to actually embed the cmd.exe console window. If you can't find decent material in .NET, P/Invoke the functions required in the good C++ articles. Not everything is available in .NET, not even when Longhorn comes out (though a LOT more APIs will be available for managed applications).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Heath Stewart wrote:
but what does that have to do with anything?
Yeah so right... =)
Okay I think im gonna study again.. Thx Man
//- UP THE IRONS, MORTEN S. KRISTENSEN -\\
|
|
|
|
|
Does anyone know of any examples of a document/view model in c#?
Thanks a ton,
|
|
|
|
|
There's been a recent multi-part article on document-centric applications on the Microsoft Developer Network (MSDN): http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnforms/html/winforms09182003.asp[^]. As a developer, you should frequent not only CodeProject but MSDN as well - it contains a HUGE library of API and framework documentation, plus thousands of articles and tutorials on practically any Microsoft-related technology (and even some non-Microsoft technologies) you can think of.
Note: I gave you the link to part 1. See the table of contents (TOC) on the left of the page for other other 2 or 3 parts.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I have a regular window application project by C#. I like to embed this window application on the browser which is a ASP.NET application. I used to program ASPX page with ActiveX control component from 3rd party.
How do I convert C# based application to activeX control so I can run on the browser? Once I create dll files within .NET 2003 environment (C# compiler), can I program a activeX control by either C#, VB and/or C++ in .NET?
Or is it impossible to use .NET dll with VB6.0 in order to create activeX control?
Thank you,
Young
Java and C# programmer
|
|
|
|
|
You don't - you can embed .NET controls in Internet Explorer. You can make an CCW (COM-callable wrapper) for your .NET control, though, so that you can script it. I've been working on converting an older article from another site, but this should help you: User Controls for Windows and the Web[^]. There's also an article by Nick Parker that goes a little more in depth about how to create a CCW for your .NET control here: Creating a CCW for COM enabled non .NET applications[^].
Note that all this still uses the <object> tag, but with a different format for the classid parameter: it is a URL to the assembly, followed by a # sign, then the fully-qualified type name for the Type that you want to embed. There is more information in MSDN about this deployment method: Deploying a Runtime Application Using Internet Explorer[^].
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Is there a simple way to emulate console mode on a GUI form or dialog box? Perhaps an article or control somewhere? Would it be logical to create one as a derived Rich Text box?
Thank you,
Ray Gregory
|
|
|
|
|
Ray Gregory wrote:
Would it be logical to create one as a derived Rich Text box?
No! The RichTextBox is not really a line-driven control and would be left parsing lines - perhaps even RTF for multi-line commands or commands with tabs - and it would not be worth it.
There is one article here on CP that I know about that actually embeds a console window in an Explorer bar: Command Prompt Explorer Bar[^]. This might give you some tips about embedding it in your application, but make sure you know how to P/Invoke native functions.
You should also search[^] the CodeProject site for "console". There are many pages worth of hits, and the link above only searching C#/.NET/VB.NET article topics. Add MFC/C++ in there if you feel comfortable P/Invoking native functions.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi, Guru
How to know at any time the Shift or Control key up or down. (console application)
Thank You.
Sorry for bad English.
|
|
|
|
|
Using Windows Forms, this is pretty simple. You can either get this information in the KeyEventArgs , or using the Control.ModifierKeys static property.
Since you're not using Windows Forms, you'll have to P/Invoke the GetKeyState function. You can either use the System.Windows.Forms.Keys enum, or if you don't want the overhead of referencing the Windows Forms assembly for a console app, you can find the VK_XXX constant values in the winuser.h header file.
See a previous reply I wrote here: http://www.codeproject.com/script/comments/forums.asp?msg=687790&forumid=1649&XtraIDs=1649&searchkw=GetKeyState&sd=9%2F23%2F2003&ed=12%2F22%2F2003#xx687790xx[^]
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
How can I format an integer into a string so that it is a fixed size (with leading zeros if necissary)?
In C++, I could do something like this:
int val = 1;
printf( "%03d", val ); And it would appear as "001" on the screen.
In C#, I can do something like this:
int val = 1;
Console.WriteLine( "{0}", val ); But I can't figure out how to format the "{0}" part so that what is printed on the screen appears as "001" instead of just "1".
Any assistance is greatly appreciated!
|
|
|
|
|
You should read the documentation for the NumberFormatInfo class and the String.Format method. You still can use format specifiers, but they work a little differently. For a similar format for "%03d", you would use Console.WriteLine("{0:000}", val) . This more closely represents the MaskEdit control commonly used in VB (and various ports).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks! I was having a hard time trying to find the info in the documentation.
|
|
|
|
|
Don't worry. That little feature isn't actually documented, just like using a number after the "X" format code to manipulate hex values, like "X2" is used to format a byte so that you always get 2 characters per byte (necessary for hex values in many cases). I meant to mention that it isn't really documented in the .NET Framework SDK, but I only remember after I hit "Submit".
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Ahh... you always beat me to it!
|
|
|
|
|
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Ah, Justin, shouldn't you know by now that there's no beating Heath!
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
Support Bone
|
|
|
|
|
|
int val = 1;
Console.WriteLine( "{0,0:000}", val );
But the angel said to them, '...I bring you good news of great joy... Today in the town of David a Savior has been born to you; he is Christ the Lord.'
FLUID UI Toolkit | FloodFill in C# & GDI+
|
|
|
|