|
<virgoci> guys. is there anyone here with an extended knowladge of MFC?
<virgoci> i am having problems with making a CToolBarEx control.
<virgoci> it's derived from CToolBar
<virgoci> for some crapy reason i can't find a way to override the painting funcs! i mean i found a few ways to do so but all those ways are bad since they all have some flaws.
<virgoci> i tried using OnUpdateCmdUI() but it is flawed as well cuz it draws the saparator buttons but since this func called after the actual drawing proccedure the grafics sometimes glich alot.
<virgoci> i found OnNMCustomdraw() a good way to do owner drawing but there is a flaws in it.
<virgoci> for some reason i can't draw the speretor buttons using that func! and even when the windows calls this func with the CDRF_NOTIFYITEMDRAW message it skips the seperator buttons. i even tried to out smart it and detect and draw the seperator buttons when it calls the func with CDDS_PREPAINT which means it redraws the whole toolbar but it seems it's smarter then i am cuz when i draw something at the location of the seperator buttons it would draw it as a back ground and still draw the damn windows`s 3d Line as a seperator!
<virgoci> anyone know of anything that can help me?
plz mail me if you have a solution for me...
virgoci@mail.ru
|
|
|
|
|
For just about complete control: Capture WM_PAINT messages.
Using this mode, however, you need to paint everything yourself. Familiarize yourself with the Platform GDI commands, which allow you to paint just about everything from lines to edges and to rectangles. Heck, you can even draw a standard button by using DrawEdge().
It takes time to make it completely custom drawn, but once you have accomplished this once, you are a BIG LEAP forward on learning how to make even more customized controls. I suggest taking this trip, as it will prove most fruitfull.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
thanks antti. i tried to refrain of using WM_PAINT cuz i knew i will have to redraw the whole ctrl from scratch. (i am abit lazy)
oh well... guess it's "build it your self in 21 From Scratch" time.
|
|
|
|
|
we sent our customers emails by smtp for 4 times in 2 months, by several university customers complained that they didn't receive our emails.
we guess the reason is that smtp servers of universities don't accept our emails because we are not in their mail list - is this right?
thanks
includeh10
|
|
|
|
|
you would have to ask the universities, if your other customers all received their emails and the uni people didnt it would seem you emails might be getting tagged at spam
bryce
---
Publitor, making Pubmed easy.
http://www.sohocode.com/publitor
|
|
|
|
|
Hi,
I have a dialog with a few edit controls.
I want to set the text of one control to red and the rest should not change.
Now if I call the pDC->SetTextColor(RGB(255,0,0)) in the OnCtlColor message handler of the dialog this changes the text color for all the edit controls in the dialog.
If I call the following code:
CDC *pDC = EditToChangeTextColor.GetDC();
pDC->SetTextColor(RGB(255,0,0));
nothing changes.
Does anyone know if there is a way to change the text collor only for one control in the dialog?
Thanks.
avivhal
|
|
|
|
|
How about surrounding the call with:
if(pWnd->GetDlgCtrlID() == IDC_EDIT1)
or switch the results out.
BD
"You know "that look" women get when they want sex? Me neither."
--Steve Martin
|
|
|
|
|
it is not correct.
you must call SetTextColor() inside of OnPaint() of your control
includeh10
|
|
|
|
|
Hi
Check the MSDN fot CWnd::OnCtlColor, it even has a example of what you are asking. You just have to verify the message is for the control you want to change, otherwise do nothing.
Extracted form the MSDN
HBRUSH CZilchDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
<big>
if (pWnd->GetDlgCtrlID() == IDC_MYSTATIC)
{
pDC->SetTextColor(RGB(255, 0, 0));
pDC->SetBkMode(TRANSPARENT);
hbr = m_brush;
}
return hbr;
}
Fabian
|
|
|
|
|
Thanks now its working fine,
I dont know how I missed this example in the MSDN (should have thought of it myself anyway), I only found a very general one with no reference as to the caller.
Is it possible maybe to call SetTextColor from outside OnCtlColor?
I tried it in various places and handlers but it did not seem to work(including in the OnPaint handler).
Maybe the attributes set for the DC fonts color are blocked when called from outside this segment of code...
Thanks again.
avivhal
|
|
|
|
|
hi all,
i need good docs about jpeg format, i have to create my own file format for compressing bmp file based on jpeg.
all i have are poor jpeg docs from internet.
thanks for any link to better docs of jpeg format
cheers
includeh10
|
|
|
|
|
Try:
The Programmer's File Format Collection.
http://www.wotsit.org/[^]
* Don't wish it was easier, wish you were better! *
|
|
|
|
|
it looks useful.
thanks
includeh10
|
|
|
|
|
I forgot to mention yesterday, you can get latest info about JPEG from the organization's official site too:
http://www.jpeg.org[^]
* Don't wish it was easier, wish you were better! *
|
|
|
|
|
Can someone point me to an artical that shows you how to draw gradients on a DC?
|
|
|
|
|
Hi
Check GradientFill() on the Win32 API documentation.
Fabian
|
|
|
|
|
you can do follow:
void CBMSButton::GradientFillRect(HDC hDC, RECT& rc, COLORREF crLight, COLORREF crDark)
{
TRIVERTEX vert[2];
GRADIENT_RECT gRect;
vert [0].x = rc.left;
vert [0].y = rc.top;
vert [0].Red = GetRValue(crLight) << 8;
vert [0].Green = GetGValue(crLight) << 8;
vert [0].Blue = GetBValue(crLight) << 8;
vert [0].Alpha = 0x0000; // It's no use for GradientFill
vert [1].x = rc.right;
vert [1].y = rc.bottom;
vert [1].Red = GetRValue(crDark) << 8;
vert [1].Green = GetGValue(crDark) << 8;
vert [1].Blue = GetBValue(crDark) << 8;
vert [1].Alpha = 0x0000;
gRect.UpperLeft = 0;
gRect.LowerRight = 1;
GradientFill(hDC, vert, 2 , &gRect, 1, GRADIENT_FILL_RECT_V);
}
You must import library:
#pragma message(" Automatically linking with MSIMG32.LIB library")
#pragma comment(lib, "MSIMG32.LIB")
|
|
|
|
|
Hi Dear...Try this..
----------------------------------------
CRect rect,rcClient;
GetClientRect(rcClient);
rect = rcClient;
int r1=32,g1=108,b1=244; //Any start color
int r2=5,g2=55,b2=165; //Any stop color
for(int i=0;i<rect.width();i++)
{=""
="" int="" r,g,b;
="" r="r1" +="" (i="" *="" (r2-r1)="" rect.width());
="" g="g1" (g2-g1)="" b="b1" (b2-b1)="" pdc-="">FillSolidRect(i,0,1,rect.Height(),RGB(r,g,b));
}
-------------------------------------------
This is not mine code, I'm also user of this code...but work nice...
OK! Good Bye
---Sumit Kapoor--- sumit_kapoor1980@hotmail.com
|
|
|
|
|
yes, i found that artical earlier today, and i got it to work, but i had to put the code in the OnPaint overide
but there is one thing i dont get about this formula
r1 + (i * (r2-r1) / rect.Width());
i know what it does, and why its needed, but i dont understand how the writer came up with it.
|
|
|
|
|
Actually...
The writer do very nice thing in this code..
as u can see.. we ca make shading from any color to other in fix area.. this is only possible if we change color according to side of area..that is what he is doing..
change color but with eyes on area..
OK bye...
Never consider anything Impossible before trying to solve that..---Sumit Kapoor---
|
|
|
|
|
hi..
for loop in above code consider < as HTML TAG
so replace that with:
for(int i=0;i<rect.Width();i++)
---Sumit Kapoor---
|
|
|
|
|
|
Hi!
How can I create Controls in a CView Class ???
Please Help
MFG
RedDragon
Unix and C are the ultimate computer viruses.
Visit me: www.programming.info.ms
|
|
|
|
|
|
you can add any controls to CView with style WS_CHILD and the CView as its parent - the control can be CDialog also if use function Create() - not DoModal().
cheers
includeh10
|
|
|
|