473,609 Members | 1,868 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do you paint the titlebar of a form?

What would be the easiest way of painting a titlebar in a form?

Setting the background property of a derived System.Windows. Forms.Form only
paints the client area. I need to paint the frame as well but when I tried

this.ParentForm =System.Drawing .Color.Crimson;

I get an error: Property or Indexer cannot be assigned to -- it is read
only.
So is there a way to override this read only property for a forms frame?
Nov 15 '05 #1
2 5439
Gregory,

If you want to paint the titlebar (or paint on it), you need to handle
the WM_NCPAINT message in the WndProc method on your form. This message is
sent when the frame of a window needs to be painted.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Gregory Hawke" <ab****@hotmail .com> wrote in message
news:ei******** ******@TK2MSFTN GP11.phx.gbl...
What would be the easiest way of painting a titlebar in a form?

Setting the background property of a derived System.Windows. Forms.Form only paints the client area. I need to paint the frame as well but when I tried
this.ParentForm =System.Drawing .Color.Crimson;

I get an error: Property or Indexer cannot be assigned to -- it is read
only.
So is there a way to override this read only property for a forms frame?

Nov 15 '05 #2
Are you from a C++ background?

The Titlebar colors are determined by system settings or themes. They apply
to all windows and cannot easily be manipulated. You would have to draw
directly to the frame during NC paint events or replace the titlebar with a
custom control and implement the windowing functionality yourself. Painting
in the non-client area would be easiest, when you remove the frame from a
window it strips a lot of Windows functionality away with it.

I implemented a custom titlebar control in VB6, but have not yet ported it
to .NET.

HTH;
Eric Cadwell
http://www.origincontrols.com
Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3669
by: Manjesh Gowda | last post by:
I am using StretchDiBits to convert the DIB bitmap to Device context of my window. It has some problem , sometimes it fails to paint the form DC whenever i move the mouse over it get repainted. I even tried using SetDIBitsToDevice , but it didn't help Is there i need to do , make this work , here is the code ret=SetDIBitsToDevice(dc,mRect.left,mRect.Top,mWidth,mHeight,0,0,0,mHeight,pBits,bInfo,DIB_RGB_COLORS);
2
4902
by: Serge Klokov | last post by:
Hi! 1. Please, help with example "paint on form by mouse" 2. Below is my example, but it clear the line after each Refresh()... how to fix? 3. How to draw the line in Mouse_Move event? private Boolean isCanPaint = false; private MouseEventArgs MouseEvent1;
1
1746
by: some good man | last post by:
Hi How do i print the a form with its controls? I know how to print, but when i want to paint the form onto the printerdocument control, i have to paint from an image, but the form doesnt even has a graphics property! In old vb i could just print from the hDC into another picturebox and then take the image member, but there are no such things in vb.net, its ruined!!! please help me
6
2263
by: able | last post by:
Dear friends In my app the main form is processing a lot of code. Thats why it takes a pretty long time to paint the form. Because of that i want to first paint another form displaying some sort of wait message waile the main form is processing invisible in the background. At the second the main form is finished loading I want the waiting form to close and the main form to paint. Somebody guide me to the right approach to achieve this...
2
7578
by: Dean Slindee | last post by:
It appears that I have two routines that don't play well together! First routine: a form's background is shaded with a gradient color. Second routine: then, the background of all labels on the form are made transparent. What results is the label's backcolor appearing as blocks of 'control' colored background. Setting the label's backcolor to color.transparent does not make it transparent (evidently the text is repainted with a...
17
3844
by: stathis gotsis | last post by:
Hello everyone, I am tying to come up with an elegant way to process some input data that come from a form. When the user hits the 'Submit' button, i want the form to appear again with the already entered valid data filled in and prompt the user to re-enter the non-valid data. If all data is valid, i will forward to an other .php page which enters the data into a database. I tried to do this in the following way: the form always hits...
3
1304
by: TristaSD | last post by:
Hi, I know, I know, there's a ton of form validation questions already in this group. However, I can't seem to make sense of any of the posts - none go into detail. All I need is to validate my form with 'post' method on the server because my terminals' JavaScript abilities are questionable. So far I've created a global error flag that gets raised whenever a
2
2758
by: Pradeep Varma | last post by:
Hello, I am using the following code to paint a normal form and it works. PaintDesktop Me.hdc In the standard module i have the declaration for PaintDesktop Public Declare Function PaintDesktop Lib "user32" (ByVal hdc As Long) As Long
6
2917
by: Ryan Liu | last post by:
Hi, I have a form, with some user control in it, usually hung up when I call form.Show(). I debug to there, I found in Visual Studio 2003, the call stack is empty! And CPU is not busy at all. Can anyonoe give me idea about what is happening?
7
1981
by: Apolakkiatis | last post by:
Sorry that im asking a lot of questions, i know, but i have a lot of things im curious about... Well to begin, how do i make sure that the file that i am printing to keeps the original text that is already located in that file? Second... In a screen shot application that uses CTRL + PRTSC then pastes to PAINT and SAVES how do you make it paste into paint and not another program?.... Script below.... Public Class Form1 Private Sub...
0
8091
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8579
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8555
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7024
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6064
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4032
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4098
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2540
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1686
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.