Click here to Skip to main content
15,902,777 members
Home / Discussions / C#
   

C#

 
QuestionInsert into MS Access database using C#.Net Pin
sunkkd22-May-07 9:37
sunkkd22-May-07 9:37 
AnswerRe: Insert into MS Access database using C#.Net Pin
Pete O'Hanlon22-May-07 9:59
mvePete O'Hanlon22-May-07 9:59 
AnswerRe: Insert into MS Access database using C#.Net Pin
led mike22-May-07 10:01
led mike22-May-07 10:01 
AnswerRe: Insert into MS Access database using C#.Net Pin
Hamid_RT23-May-07 2:11
Hamid_RT23-May-07 2:11 
QuestionCreate pop-up message Pin
diddy3422-May-07 9:07
diddy3422-May-07 9:07 
AnswerRe: Create pop-up message Pin
Muammar©22-May-07 9:21
Muammar©22-May-07 9:21 
AnswerRe: Create pop-up message Pin
Hamid_RT23-May-07 2:18
Hamid_RT23-May-07 2:18 
QuestionCenter Text on Custom Button Pin
PHDENG8122-May-07 7:17
PHDENG8122-May-07 7:17 
I have a custom button that I have created which inherits from windows.forms.button. I simply override the mouseenter, mouseover, and mousedown events to paint a custom gradient over the button. In doing so, I must redraw the available image and text. I have been able to align the image with the base. However, I am unable to do the same with the text. Specifically, centering. It is close, just not perfect.

SizeF wSize = graphics.MeasureString(this.Text, this.Font);
float wCenterX = (Width - wSize.Width) / 2;

mTextPt.X = wCenterX;//this does not work properly
mTextPt.Y = Height - 19;// this works fine

e.Graphics.DrawString(this.Text, this.Font, new SolidBrush(this.ForeColor), mTextpt);

For most of the buttons, the text shifts slightly to the left when I use any of the custom events.

Any suggestions would be greatly appreciated. Thanks.

PHD

AnswerRe: Center Text on Custom Button Pin
Manoj Kumar Rai22-May-07 8:02
professionalManoj Kumar Rai22-May-07 8:02 
GeneralRe: Center Text on Custom Button Pin
PHDENG8122-May-07 8:29
PHDENG8122-May-07 8:29 
AnswerRe: Center Text on Custom Button Pin
Ian Shlasko22-May-07 10:34
Ian Shlasko22-May-07 10:34 
GeneralRe: Center Text on Custom Button Pin
PHDENG8123-May-07 0:45
PHDENG8123-May-07 0:45 
GeneralRe: Center Text on Custom Button Pin
Ian Shlasko24-May-07 3:40
Ian Shlasko24-May-07 3:40 
GeneralRe: Center Text on Custom Button Pin
PHDENG8124-May-07 4:38
PHDENG8124-May-07 4:38 
QuestionDisabling controls without changing appearance Pin
Ian Shlasko22-May-07 6:13
Ian Shlasko22-May-07 6:13 
AnswerRe: Disabling controls without changing appearance Pin
Dave Herren22-May-07 6:33
Dave Herren22-May-07 6:33 
GeneralRe: Disabling controls without changing appearance Pin
Ian Shlasko22-May-07 7:42
Ian Shlasko22-May-07 7:42 
GeneralRe: Disabling controls without changing appearance (Solved!) Pin
Ian Shlasko22-May-07 10:05
Ian Shlasko22-May-07 10:05 
GeneralRe: Disabling controls without changing appearance (Solved!) Pin
Martin#22-May-07 21:43
Martin#22-May-07 21:43 
GeneralRe: Disabling controls without changing appearance (Solved!) Pin
Ian Shlasko23-May-07 6:13
Ian Shlasko23-May-07 6:13 
GeneralRe: Disabling controls without changing appearance (Solved!) Pin
Martin#23-May-07 7:04
Martin#23-May-07 7:04 
AnswerRe: Disabling controls without changing appearance Pin
Dave Herren22-May-07 6:38
Dave Herren22-May-07 6:38 
AnswerRe: Disabling controls without changing appearance Pin
Dan Neely22-May-07 7:20
Dan Neely22-May-07 7:20 
Questionrun .exe from command prompt in c#...help please Pin
lavy288322-May-07 5:22
lavy288322-May-07 5:22 
AnswerRe: run .exe from command prompt in c#...help please Pin
Bekjong22-May-07 5:44
Bekjong22-May-07 5:44 

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.