Click here to Skip to main content
16,011,482 members
Home / Discussions / C#
   

C#

 
GeneralRe: Getting Error In For each Pin
Anubhava Dimri27-Nov-09 20:38
Anubhava Dimri27-Nov-09 20:38 
GeneralRe: Getting Error In For each Pin
Saksida Bojan27-Nov-09 21:10
Saksida Bojan27-Nov-09 21:10 
GeneralRe: Getting Error In For each Pin
Anubhava Dimri27-Nov-09 22:03
Anubhava Dimri27-Nov-09 22:03 
QuestionTextBox DataBindings doesn't work... Pin
shayke2327-Nov-09 14:37
shayke2327-Nov-09 14:37 
AnswerRe: TextBox DataBindings doesn't work... Pin
Christian Graus27-Nov-09 16:11
protectorChristian Graus27-Nov-09 16:11 
AnswerRe: TextBox DataBindings doesn't work... Pin
Gerry Schmitz28-Nov-09 7:17
mveGerry Schmitz28-Nov-09 7:17 
GeneralRe: TextBox DataBindings doesn't work... Pin
shayke2328-Nov-09 7:53
shayke2328-Nov-09 7:53 
Questiontabcontrol_DrawItem Pin
User 663428927-Nov-09 13:15
User 663428927-Nov-09 13:15 
hi to all, i was wondering if i can get some help,
i'm srawing on tabs of tab control item that has string and a-16X16 pixel icon of cancel button,
(just like the tabs in a regular browser that have a small button to close the tab).
anyway, i'm tring to make the icon on the selected tab to be red and the other tabs gray.
here is the code:

private void tabControl1_DrawItem(object sender, DrawItemEventArgs e)
{
Image img1 = new Bitmap(Application.StartupPath + "\\icons\\cancelGray.png");
Image img2 = new Bitmap(Application.StartupPath + "\\icons\\cancelRed.png");
Rectangle r = e.Bounds;
r = this.tabControl1.GetTabRect(e.Index);
r.Offset(2, 4);

Brush TitleBrush = new SolidBrush(Color.Black);
Font f = new Font("Microsoft Sans Serif", 8.0f);

string title = this.tabControl1.TabPages[e.Index].Text;

e.Graphics.DrawString(title, f, TitleBrush, new PointF(r.X, r.Y));

foreach (TabPage tp in tabControl1.TabPages)
{
if (tp == lastSelected) //LAST SELECTED IS THE THE CURRENT TABPAGE THAT SELECTED.
e.Graphics.DrawImage(img2, new Point(r.X + (this.tabControl1.GetTabRect(e.Index).Width - _imageLocation.X) - 7, _imageLocation.Y));
else e.Graphics.DrawImage(img1, new Point(r.X + (this.tabControl1.GetTabRect(e.Index).Width - _imageLocation.X) - 7, _imageLocation.Y));
}

}


the problem is that the changing colors of the tabs is not correct, i can't figure why when i'm clicking one tab the other is change..

thanks,

modified 31-Dec-20 21:02pm.

AnswerRe: tabcontrol_DrawItem Pin
Luc Pattyn27-Nov-09 14:07
sitebuilderLuc Pattyn27-Nov-09 14:07 
GeneralRe: tabcontrol_DrawItem Pin
User 663428927-Nov-09 14:29
User 663428927-Nov-09 14:29 
GeneralRe: tabcontrol_DrawItem Pin
Luc Pattyn27-Nov-09 14:35
sitebuilderLuc Pattyn27-Nov-09 14:35 
GeneralRe: tabcontrol_DrawItem Pin
User 663428927-Nov-09 14:42
User 663428927-Nov-09 14:42 
QuestionHow to delete a Directory Pin
Wamuti27-Nov-09 12:11
Wamuti27-Nov-09 12:11 
AnswerRe: How to delete a Directory Pin
Luc Pattyn27-Nov-09 14:12
sitebuilderLuc Pattyn27-Nov-09 14:12 
GeneralRe: How to delete a Directory Pin
Roger Wright27-Nov-09 20:07
professionalRoger Wright27-Nov-09 20:07 
AnswerRe: How to delete a Directory Pin
RCoate27-Nov-09 16:48
RCoate27-Nov-09 16:48 
GeneralRe: How to delete a Directory Pin
Shameel27-Nov-09 18:56
professionalShameel27-Nov-09 18:56 
AnswerRe: How to delete a Directory Pin
Shameel27-Nov-09 18:59
professionalShameel27-Nov-09 18:59 
QuestionJavaScript <-> C# and WebBrowser: How to serialize JS-Objects to C#-Classes and Backward? Pin
softwarejaeger27-Nov-09 9:49
softwarejaeger27-Nov-09 9:49 
AnswerRe: JavaScript <-> C# and WebBrowser: How to serialize JS-Objects to C#-Classes and Backward? Pin
Gerry Schmitz28-Nov-09 4:24
mveGerry Schmitz28-Nov-09 4:24 
GeneralRe: JavaScript <-> C# and WebBrowser: How to serialize JS-Objects to C#-Classes and Backward? Pin
softwarejaeger29-Nov-09 1:48
softwarejaeger29-Nov-09 1:48 
GeneralRe: JavaScript <-> C# and WebBrowser: How to serialize JS-Objects to C#-Classes and Backward? Pin
Gerry Schmitz29-Nov-09 4:44
mveGerry Schmitz29-Nov-09 4:44 
Question[Resolved]Calling to a thread [modified] Pin
Trollslayer27-Nov-09 9:35
mentorTrollslayer27-Nov-09 9:35 
AnswerRe: Calling to a thread Pin
Garth J Lancaster27-Nov-09 10:33
professionalGarth J Lancaster27-Nov-09 10:33 
AnswerRe: Calling to a thread Pin
Luc Pattyn27-Nov-09 10:35
sitebuilderLuc Pattyn27-Nov-09 10:35 

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.