Click here to Skip to main content
15,945,603 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
AnswerRe: Logger Pin
led mike16-Nov-06 5:17
led mike16-Nov-06 5:17 
QuestionInverted/changed textcolor when bar passes over Pin
zoleero15-Nov-06 15:36
zoleero15-Nov-06 15:36 
AnswerRe: Inverted/changed textcolor when bar passes over Pin
Christian Graus15-Nov-06 15:50
protectorChristian Graus15-Nov-06 15:50 
QuestionRe: Inverted/changed textcolor when bar passes over Pin
zoleero16-Nov-06 3:32
zoleero16-Nov-06 3:32 
AnswerRe: Inverted/changed textcolor when bar passes over Pin
Christian Graus16-Nov-06 8:18
protectorChristian Graus16-Nov-06 8:18 
QuestionRe: Inverted/changed textcolor when bar passes over Pin
zoleero17-Nov-06 12:38
zoleero17-Nov-06 12:38 
AnswerRe: Inverted/changed textcolor when bar passes over Pin
Christian Graus17-Nov-06 12:42
protectorChristian Graus17-Nov-06 12:42 
QuestionRe: Inverted/changed textcolor when bar passes over Pin
zoleero19-Nov-06 18:10
zoleero19-Nov-06 18:10 
Okey I came up with this:

virtual void OnPaint(System::Windows::Forms::PaintEventArgs^ e) override<br />
{<br />
   // Creating brush for progressbar<br />
   SolidBrush^ progressBarBrush = gcnew SolidBrush(this->progressBarColor);<br />
   // Assigning the rectangle for this control to barRectangle<br />
   Rectangle barRect = this->ClientRectangle;<br />
   // Setting width of bar<br />
   barRect.Width = (int)(barRect.Width * this->percentCompleted);<br />
   // Getting controls Graphic<br />
   Graphics^ gLayer1 = e->Graphics;<br />
   // Creating bitmap to draw on outside screen<br />
   Bitmap^ bmpLayer2 = gcnew Bitmap(this->Width,this->Height,gLayer1);<br />
   // Getting Graphic for bitmap<br />
   Graphics^ gLayer2 = Graphics::FromImage(bmpLayer2);<br />
   // Painting bar on bitmap<br />
   gLayer2->FillRectangle(progressBarBrush, barRect);<br />
<br />
   // If text is to be displayed on progressbar<br />
   if(this->showTextOnProgressBar == true)<br />
   {   // Creating brushes for text on progressbar<br />
      SolidBrush^ textBehindBrush = gcnew SolidBrush(this->textBehindProgressBarColor);<br />
      SolidBrush^ textInFrontOfBrush = gcnew SolidBrush(this->textInFrontOfProgressBarColor);<br />
      // Creating font for progresstext<br />
      System::Drawing::Font^ drawFont = this->Font;<br />
      // Creating string format<br />
      System::Drawing::StringFormat^ strFormat = gcnew System::Drawing::StringFormat();<br />
      // Center text<br />
      strFormat->Alignment = StringAlignment::Center;<br />
      strFormat->LineAlignment = StringAlignment::Center;<br />
      // Drawing string behind progressbar<br />
      gLayer1->DrawString(<br />
               this->progressBarText,<br />
               drawFont,<br />
               textBehindBrush,<br />
               this->ClientRectangle,<br />
               strFormat<br />
               );<br />
      // Drawing string on bitmap (in front of progressbar)<br />
      gLayer2->DrawString(<br />
               this->progressBarText,<br />
               drawFont,<br />
               textInFrontOfBrush,<br />
               this->ClientRectangle,<br />
               strFormat<br />
               );<br />
   }<br />
<br />
<br />
   // Draw layer2 bitmap to layer1 Graphic<br />
   gLayer1->DrawImageUnscaledAndClipped(bmpLayer2, barRect);<br />
<br />
   // Draw a border around the control<br />
   DrawBorder(gLayer1);<br />
<br />
   // Clean up (delete some objects on the managed heap)<br />
   // Do some cleaning here...<br />
<br />
   // Can not delete Graphics object when using DoubleBuffer<br />
   //delete gLayer1;<br />
}


Is this how you meant??

Any feedback on the code??
AnswerRe: Inverted/changed textcolor when bar passes over Pin
Christian Graus19-Nov-06 18:23
protectorChristian Graus19-Nov-06 18:23 
GeneralRe: Inverted/changed textcolor when bar passes over Pin
zoleero20-Nov-06 13:27
zoleero20-Nov-06 13:27 
GeneralRe: Inverted/changed textcolor when bar passes over Pin
Christian Graus20-Nov-06 13:31
protectorChristian Graus20-Nov-06 13:31 
QuestionProgressChanged not being called? Pin
Miro L15-Nov-06 8:54
Miro L15-Nov-06 8:54 
Questionak english very wellplease help me Pin
pedarebad15-Nov-06 0:12
pedarebad15-Nov-06 0:12 
AnswerRe: ak english very wellplease help me Pin
Christian Graus15-Nov-06 9:48
protectorChristian Graus15-Nov-06 9:48 
Questionfile conversion Pin
Shriya Kapoor14-Nov-06 22:17
Shriya Kapoor14-Nov-06 22:17 
AnswerRe: file conversion Pin
Christian Graus15-Nov-06 9:49
protectorChristian Graus15-Nov-06 9:49 
AnswerRe: Need Programs Pin
Bram van Kampen14-Nov-06 17:04
Bram van Kampen14-Nov-06 17:04 
Question[Message Deleted] Pin
abhiramsss14-Nov-06 12:56
abhiramsss14-Nov-06 12:56 
AnswerRe: #define Pin
Christian Graus14-Nov-06 13:19
protectorChristian Graus14-Nov-06 13:19 
AnswerRe: #define Pin
Bram van Kampen14-Nov-06 16:34
Bram van Kampen14-Nov-06 16:34 
QuestionProblem with relative path in Webbrowser Pin
Miro L14-Nov-06 8:44
Miro L14-Nov-06 8:44 
QuestionEnabling CLR caused a failure in my MFC window Pin
earlgraham14-Nov-06 7:01
earlgraham14-Nov-06 7:01 
QuestionLinker errors Pin
kumarangopi13-Nov-06 19:17
kumarangopi13-Nov-06 19:17 
AnswerRe: Linker errors Pin
Christian Graus13-Nov-06 19:31
protectorChristian Graus13-Nov-06 19:31 
Questionconstructor and destructor Pin
rajinder singh sikh13-Nov-06 7:19
rajinder singh sikh13-Nov-06 7:19 

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.