|
Okey I came up with this:
virtual void OnPaint(System::Windows::Forms::PaintEventArgs^ e) override<br />
{<br />
SolidBrush^ progressBarBrush = gcnew SolidBrush(this->progressBarColor);<br />
Rectangle barRect = this->ClientRectangle;<br />
barRect.Width = (int)(barRect.Width * this->percentCompleted);<br />
Graphics^ gLayer1 = e->Graphics;<br />
Bitmap^ bmpLayer2 = gcnew Bitmap(this->Width,this->Height,gLayer1);<br />
Graphics^ gLayer2 = Graphics::FromImage(bmpLayer2);<br />
gLayer2->FillRectangle(progressBarBrush, barRect);<br />
<br />
if(this->showTextOnProgressBar == true)<br />
{
SolidBrush^ textBehindBrush = gcnew SolidBrush(this->textBehindProgressBarColor);<br />
SolidBrush^ textInFrontOfBrush = gcnew SolidBrush(this->textInFrontOfProgressBarColor);<br />
System::Drawing::Font^ drawFont = this->Font;<br />
System::Drawing::StringFormat^ strFormat = gcnew System::Drawing::StringFormat();<br />
strFormat->Alignment = StringAlignment::Center;<br />
strFormat->LineAlignment = StringAlignment::Center;<br />
gLayer1->DrawString(<br />
this->progressBarText,<br />
drawFont,<br />
textBehindBrush,<br />
this->ClientRectangle,<br />
strFormat<br />
);<br />
gLayer2->DrawString(<br />
this->progressBarText,<br />
drawFont,<br />
textInFrontOfBrush,<br />
this->ClientRectangle,<br />
strFormat<br />
);<br />
}<br />
<br />
<br />
gLayer1->DrawImageUnscaledAndClipped(bmpLayer2, barRect);<br />
<br />
DrawBorder(gLayer1);<br />
<br />
<br />
}
Is this how you meant??
Any feedback on the code??
|
|
|
|
|
Yep, that looks like what I meant.
Christian Graus - C++ MVP
|
|
|
|
|
Thanks a lot, Christian, for helping me!
Now I got my wholly Managed C++/CLI progressbar with text on it. And I did not have to use any unmanaged functions like BitBlt() or other... that's appreciated a lot!
Thanks again for the help, you have been very helpfull!!
|
|
|
|
|
NO worries, glad to help out.
Christian Graus - C++ MVP
|
|
|
|
|
I've been trying to add a progress bar to a web browser window, but as far as I can tell, webBrowser_ProgressChanged is never being called.
private void webBrowser1_ProgressChanged(object sender, WebBrowserProgressChangedEventArgs e)
{
warnLabel.Text = "webBrowser1ProgressChanged was called.";
}
The really odd thing is, I downloaded a full web browser example, ran it, and the progress bar isn't working on that either. Thank you in advance for your help...
|
|
|
|
|
my name is fafa and i live in iran im study computer enginering and cant speake english very well . i have a project .design a web site by c#.net .
if it possible mail me this project code.
thanks.
my mail is:mamoosh_1990@yahoo.com
|
|
|
|
|
1 - This is not the C# forum
2 - YOU have a project, we don't.
3 - We don't do people's homework for them, and if we did, it would not be helping them
Christian Graus - C++ MVP
|
|
|
|
|
I am a new user to this site. I need to to know that how to convert a database file may be in access or in SQl in to html file.if anybody can help me in this
regards
shriya
|
|
|
|
|
You want to do this in Managed C++, or you're just asking in the wrong place ?
How do you expect to convert it to HTML ? The most obvious way is to read the data from the database, and set the result as the datasource of a GridView or DataGrid, which will show the data in a HTML table.
Christian Graus - C++ MVP
|
|
|
|
|
Well, ofcourse, all of us people on this forum are in cahoots and know that it would take us only two or three lines of code to solve all your problems. None of us will however, and that is out of organised pure baddness.
As an alternative, try your exam again in a few years time, but start with reading a few books.
Brian Kernighan and Dennis Richie wrote a very good one. Look for names like PJ Plaugher , Stephen Hewitt, Matt Pietreck, and others. Then come back with real questions.
LateNightsInNewry
|
|
|
|
|
|
First step - ask in the right forum
Second step - explain why you want to use a #define, and why you think replacing every instance of the number 1 with a string in your code is a good idea ( with luck, the compiler is stopping you from doing this )
Third step - when you ask for help, tell us the error you are getting.
|
|
|
|
|
Maybe you should first read a few books on C, never mind CPP, or anything further. To start to explain what's wrong with your code would take far more space than the code you wrote. I can recommend Kernighan and Richie-for a starter!.
LateNightsInNewry
|
|
|
|
|
Hello all,
I need to load a html document from a HDD. When I try it with absolute path everything works good. But I need to use relative path and it seems to be impossible. The one way how you can do it is something like this: String^ path = Application::StartupPath + "\\ok.htm". But I think there has to be another (maybe trivial) solution of this problem. Thank you in advance,
|
|
|
|
|
We started developing on VS2005 with Shared MFC and CLR enabled. Now one of my MFC windows in a subclass is failing. When I compile everything is fine, but when I compile I get an acceptation:
ENSURE(afxOccMgr !=NULL);
Here is my code examples
CMainFrame::CMainFrame()
{…
AfxEnableControlContainer();
…
pMainFrm = this;
…
AfxOleInit();
….
}
Class Mysub : public CWnd
C3DWindow *m_p3dWnd;
Extern CMainFrame *MainFrm;
…
MySub::Load()
{…
m_ p3dWnd = new C3DWindow();
…
bRet = m_ p3dWnd ->Create("Internal_Win", 0, Rect,
pMainFrm, ID_MEM, NULL, FALSE);
…
}
Note: My code from the stack that caused the acceptation is the above create. Any clues?
Thanks
Programmer
Glenn Earl Graham
Austin, TX
|
|
|
|
|
Bad object record file number in module c:\tc\lib\graphics.lib
How to rectify this error?another doubt is that by default turbo c 3.0 supports egavga.bgi graphic drive only?how to show a image in svga graphic drive?
Thanks in advance, you can mail me at kumarangopi@yahoo.com
|
|
|
|
|
If you're using TurboC, odds are you need to find a forum where others are using it.
Odds are also even lower that you're using managed C++, it seems more likely that you've asked in the wrong forum.
|
|
|
|
|
WHY CONSTRUCTOR CAN'T BE VIRTUAL FUNCTION BUT DESTRUCTOR CAN BE.
RAJINDER SINGH SIKH
|
|
|
|
|
|
Dare I ask...
Why?
To create an object of the base type and have the compiler choose a derived class for me?
|
|
|
|
|
DON'T YELL !!!
Also, ask in the right forums next time. This is the MANAGED C++ forum.
|
|
|
|
|
Take a step back, and think about it! Virtual functions are called from a list of function adresses. When you create a new class, the constructors are called first, starting with the base class constructors. Each Base class constructor edits the virtual function table. When your class is constructed, it is there for you to use.The same happens in the oposite direction, when your class is destroyed. You cannot have virtual constructors, because they would have to be called before the virtual function table could have been constructed. It is a case of chicken or egg first.
LateNightsInNewry
|
|
|
|
|
Hi,
I´m pretty new in C++... and would like to get some help.
I´m connecting a device (a condutivimeter) to my RS232 COM1, and using BIOSCOM to comunicate with it, but I just can´t. (i just need to read from the port)
I´ve already done it with my other device (wich is a balance).
The device (condutivimeter) works with:
Baud rate 4800
Handshake: CTS/RTS + Xon/Xoff(this is the only difference between the devices)
Data bits : 8
Parity: none
Stop bit : 1
If somebody has some idea...
Thanks a lot
bruno Garcia
|
|
|
|
|
You posted in the (Managed) C++/CLI forum. I think you want to post this in the Visual C++ / MFC forum. People who can answer your C++ problems don't always come here. So, to better your odds of getting an answer, please post in the Visual C++ / MFC forum.
|
|
|
|
|
Hi every one,
I don't know how can I create wrapper class,wrapper code,.. in C++,if anyone knows please tell me step by step or send me sample code or link for learning.
yours sincerely ,
Orchid
|
|
|
|