Click here to Skip to main content
16,010,394 members
Home / Discussions / C#
   

C#

 
GeneralRe: voice recording Pin
mav.northwind13-Jun-05 5:02
mav.northwind13-Jun-05 5:02 
Generaladding items to a list box using a dataset Pin
steve_rm13-Jun-05 4:37
steve_rm13-Jun-05 4:37 
GeneralEnableVisualStyles on a TabPage having a problem with some controls Pin
Joe_Huddleston13-Jun-05 4:22
Joe_Huddleston13-Jun-05 4:22 
GeneralRe: EnableVisualStyles on a TabPage having a problem with some controls Pin
steve_rm13-Jun-05 6:27
steve_rm13-Jun-05 6:27 
GeneralRe: EnableVisualStyles on a TabPage having a problem with some controls Pin
Joe_Huddleston13-Jun-05 7:06
Joe_Huddleston13-Jun-05 7:06 
GeneralRe: EnableVisualStyles on a TabPage having a problem with some controls Pin
Dave Kreskowiak13-Jun-05 8:41
mveDave Kreskowiak13-Jun-05 8:41 
GeneralRe: EnableVisualStyles on a TabPage having a problem with some controls Pin
Joe_Huddleston13-Jun-05 13:38
Joe_Huddleston13-Jun-05 13:38 
GeneralRe: EnableVisualStyles on a TabPage having a problem with some controls Pin
Joe_Huddleston14-Jun-05 0:58
Joe_Huddleston14-Jun-05 0:58 
My main function looks like:

[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.DoEvents();
...
}

And my handler for the Paint event for my tab page is:

private void VisualStyleTabPage_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Graphics g = e.Graphics;
Control c = (Control)sender;
IntPtr hTheme = OpenThemeData(c.Handle, "Tab");

try {
IntPtr hDC = g.GetHdc();
RECT rect = new RECT();
rect.LoadFromRect(c.ClientRectangle);
DrawThemeBackground(hTheme, hDC, 10, 0, ref rect, ref rect);
g.ReleaseHdc(hDC);
} finally {
CloseThemeData(hTheme);
hTheme = IntPtr.Zero;
}
}

When I set, for instance, the label control's BackColor to Transparent, it paints a solid white background for the control. So, I created a custom control that inherits from Label, and overrode the OnPaintBackground handler, painting with the same color as the tab page's background:

protected override void OnPaintBackground(PaintEventArgs e)
{
Graphics g = e.Graphics;
IntPtr hTheme = OpenThemeData(this.Handle, "Tab");

try {
IntPtr hDC = g.GetHdc();
RECT rect = new RECT();
rect.LoadFromRect(this.ClientRectangle);
DrawThemeBackground(hTheme, hDC, 10, 0, ref rect, ref rect);
g.ReleaseHdc(hDC);
} finally {
CloseThemeData(hTheme);
hTheme = IntPtr.Zero;
}
}

This paints most of the background of the label control with the correct background, but the horizontal strip where text is present is still solid white.

Thanks,

Joe

GeneralSAP Modules into C#.Net Pin
Anonymous13-Jun-05 4:10
Anonymous13-Jun-05 4:10 
GeneralRe: SAP Modules into C#.Net Pin
Seraphin13-Jun-05 4:45
Seraphin13-Jun-05 4:45 
GeneralRe: SAP Modules into C#.Net Pin
Sneha Dehariya14-Jun-05 0:41
Sneha Dehariya14-Jun-05 0:41 
QuestionString.Format-ting floating point numbers, how? Pin
iliyang13-Jun-05 3:04
iliyang13-Jun-05 3:04 
AnswerRe: String.Format-ting floating point numbers, how? Pin
Seraphin13-Jun-05 3:09
Seraphin13-Jun-05 3:09 
GeneralRe: String.Format-ting floating point numbers, how? Pin
iliyang13-Jun-05 3:21
iliyang13-Jun-05 3:21 
GeneralReflection ... Call Method. Parameter question Pin
Seraphin13-Jun-05 2:57
Seraphin13-Jun-05 2:57 
GeneralRe: Reflection ... Call Method. Parameter question Pin
occcy13-Jun-05 4:07
occcy13-Jun-05 4:07 
GeneralRe: Reflection ... Call Method. Parameter question Pin
Seraphin13-Jun-05 4:45
Seraphin13-Jun-05 4:45 
GeneralSyntax error (missing operator) when deleting with commandbuilder Pin
Hawkmoth13-Jun-05 2:28
Hawkmoth13-Jun-05 2:28 
GeneralRe: Syntax error (missing operator) when deleting with commandbuilder Pin
Nick Parker13-Jun-05 2:56
protectorNick Parker13-Jun-05 2:56 
GeneralRe: Syntax error (missing operator) when deleting with commandbuilder Pin
Hawkmoth13-Jun-05 4:17
Hawkmoth13-Jun-05 4:17 
GeneralImplementing a nonvisual control Pin
Jack Bond13-Jun-05 2:00
Jack Bond13-Jun-05 2:00 
GeneralRe: Implementing a nonvisual control Pin
mav.northwind13-Jun-05 2:29
mav.northwind13-Jun-05 2:29 
GeneralCustom Browser Pin
arun_appu13-Jun-05 1:28
arun_appu13-Jun-05 1:28 
GeneralRe: Custom Browser Pin
MoustafaS13-Jun-05 4:16
MoustafaS13-Jun-05 4:16 
GeneralCreate folder and Add user with proper rights. Pin
Anonymous12-Jun-05 23:51
Anonymous12-Jun-05 23:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.