Click here to Skip to main content
15,909,030 members
Home / Discussions / C#
   

C#

 
GeneralRe: Playing DVD Pin
Identity Undisclosed11-Jan-09 21:50
Identity Undisclosed11-Jan-09 21:50 
GeneralRe: Playing DVD Pin
EliottA12-Jan-09 0:59
EliottA12-Jan-09 0:59 
QuestionDeploying a console application (ConsoleApp below) to another machine - I'm confused :( Pin
Tina P8-Jan-09 19:26
Tina P8-Jan-09 19:26 
AnswerRe: Deploying a console application (ConsoleApp below) to another machine - I'm confused :( Pin
PIEBALDconsult8-Jan-09 19:45
mvePIEBALDconsult8-Jan-09 19:45 
AnswerRe: Deploying a console application (ConsoleApp below) to another machine - I'm confused :( Pin
Aman Bhullar8-Jan-09 20:52
Aman Bhullar8-Jan-09 20:52 
AnswerRe: Deploying a console application (ConsoleApp below) to another machine - I'm confused :( Pin
J4amieC8-Jan-09 22:46
J4amieC8-Jan-09 22:46 
Questionhow to change the color of the picture box Pin
prasadbuddhika8-Jan-09 19:26
prasadbuddhika8-Jan-09 19:26 
AnswerRe: how to change the color of the picture box Pin
Jason C Bourne8-Jan-09 20:13
Jason C Bourne8-Jan-09 20:13 
Sadly enough, this control does not expose a border color, even for classes inheriting from it. Your only choice is to draw it yourself, you can for example create a class that inherits from the PictureBox and override the OnClick (or just handle it) to paint the border, it can be something like that:

public class PictureBoxEx
: PictureBox
{

protected override void OnClick(EventArgs e)
{
base.OnClick(e);
Pen pen = new Pen(Color.Red);
this.CreateGraphics().DrawRectangle(pen, base.ClientRectangle);
}

}

This code is not entirely correct, the base.ClientRectangle rectangle is inside the real border but I'll leave it to you to compute the correct coordinates.

The disadvantage of this approach is that it is not done in the "Paint event" of the control, so any redraw (caused if you ALT-TAB or just move something over it, like another window) will cause the control to redraw itself and your border will disappear. I don't know what you really want, if the idea is that it should STAY colored after the click, then override the OnClick and trigger the OnPaint after having set a boolean or so to indicate the clicked state; in the OnPaint, check this boolean and draw the border if the "clicked" state check is positive.

Another disadvantage, but this was really quick code to show the idea, is that I am using a Graphics object that I create myself. In the OnPaint handler, you should use the provided Graphics object from the eventArgs, otherwise you loose Double-Buffering.

Jean-Christophe Grégoire

QuestionHow i Lock my Harddisk drive in c#.net Pin
john ramesh john8-Jan-09 18:43
john ramesh john8-Jan-09 18:43 
AnswerRe: How i Lock my Harddisk drive in c#.net Pin
Dragonfly_Lee8-Jan-09 19:04
Dragonfly_Lee8-Jan-09 19:04 
AnswerRe: How i Lock my Harddisk drive in c#.net Pin
Ashfield8-Jan-09 21:02
Ashfield8-Jan-09 21:02 
AnswerRe: How i Lock my Harddisk drive in c#.net Pin
Tom Deketelaere8-Jan-09 21:32
professionalTom Deketelaere8-Jan-09 21:32 
AnswerRe: How i Lock my Harddisk drive in c#.net Pin
MumbleB9-Jan-09 1:37
MumbleB9-Jan-09 1:37 
GeneralRe: How i Lock my Harddisk drive in c#.net Pin
Аslam Iqbal26-May-11 1:45
professionalАslam Iqbal26-May-11 1:45 
AnswerRe: How i Lock my Harddisk drive in c#.net Pin
EliottA9-Jan-09 2:36
EliottA9-Jan-09 2:36 
AnswerHere is the answer Pin
sourabhsorate9-Jan-09 23:05
sourabhsorate9-Jan-09 23:05 
GeneralRe: Here is the answer Pin
Аslam Iqbal26-May-11 2:00
professionalАslam Iqbal26-May-11 2:00 
QuestionHow to make a cab file? Pin
sumit70348-Jan-09 18:30
sumit70348-Jan-09 18:30 
AnswerRe: How to make a cab file? Pin
Dragonfly_Lee8-Jan-09 19:09
Dragonfly_Lee8-Jan-09 19:09 
GeneralRe: How to make a cab file? Pin
sumit70348-Jan-09 19:21
sumit70348-Jan-09 19:21 
GeneralRe: How to make a cab file? Pin
Dragonfly_Lee8-Jan-09 19:45
Dragonfly_Lee8-Jan-09 19:45 
Questionhow do I read a file name located in a specific folder into a C# app Pin
Tina P8-Jan-09 17:26
Tina P8-Jan-09 17:26 
GeneralRe: how do I read a file name located in a specific folder into a C# app Pin
Luc Pattyn8-Jan-09 17:44
sitebuilderLuc Pattyn8-Jan-09 17:44 
GeneralRe: how do I read a file name located in a specific folder into a C# app Pin
Tina P8-Jan-09 18:11
Tina P8-Jan-09 18:11 
GeneralRe: how do I read a file name located in a specific folder into a C# app Pin
Dragonfly_Lee8-Jan-09 19:27
Dragonfly_Lee8-Jan-09 19:27 

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.