|
Rotate and scale your polygon so that the hatching is transformed to a horizontal hatching with spacing 1. Then, for each segment of your polygon, points within it with integer y are hatching end points. Transform them back and you're done.
For a hatching angle θ and a spacing s, the resulting transformation is:
x' = ( x cos θ + y sin θ) / s,
y' = (-x sin θ + y cos θ) / s.
And the reverse transformation is:
x = ( x' cos θ - y' sin θ) · s,
y = ( x' sin θ + y' cos θ) · s.
Good luck.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
combobox has no getitemtext function?
i must save its copy as item's data?
t!
|
|
|
|
|
You must use GetLBText method:
CComboBox combo;
CString str;
combo.GetLBText( combo.GetCurSel(), str );
in "str" you have items data.
|
|
|
|
|
to get proper item's text depends on initial ownerdrawfixed flag
is it normal?
(btw. now i found mfc ignores later changes of CBS_OWNERDRAWFIXED for DrawItem (not)calls)
t!
|
|
|
|
|
problem found
with owner draw must have has strings too
fine day
t!
|
|
|
|
|
I have a CRichEditCtrl in a CView class. I need to know when the control gets the focus and I don't know how to do it.
This is what I've done so far:
//On MyView.h
afx_msg void OnStupidCtrlGetFocus(NMHDR* pNMHDR, LRESULT* pResult);
//On MyView.cpp
ON_NOTIFY(NM_SETFOCUS, ID_STUPIDRICHEDITCTRL, OnStupidCtrlGetFocus)
void CMyView::OnStupidCtrlGetFocus(NMHDR* pNMHDR, LRESULT* pResult)
{
//Do some work
}
But it doesn't work !!! what am I doing wrong ????
Thanks in advance..
|
|
|
|
|
Hi all,
I create a button dynamically but as it is now, I create the button ID myself like this cause in this case I can't use the editor to create it:
#define ID_MY_BUTTON 33333
But how do I ensure a unique ID for this dynamically created button?
/Tommy
|
|
|
|
|
You can use _APS_NEXT_CONTROL_VALUE. Resource editor store here value which will be given to the next created control - so values above this not used.
Acid will burn!
|
|
|
|
|
i afraid it is good for first control but not for system dialog or any ole ctrls
there he must search all parent's sub-windows or similar (?)
t!
|
|
|
|
|
Ok, so you mean that I can do like this:
m_pBtn->Create(_T("Button"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, CRect(0,0,19,14), this, _APS_NEXT_CONTROL_VALUE);
Because m_pBtn is not associated with a resource editor created control, it's createed from scratch and subclassed dynamically.
/T
|
|
|
|
|
This true only for first item, then you must increase value youreself:
m_pBtn->Create(_T("Button1"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, CRect(0,0,19,14), this, _APS_NEXT_CONTROL_VALUE+1);
m_pBtn->Create(_T("Button2"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, CRect(0,0,19,14), this, _APS_NEXT_CONTROL_VALUE+2);
You keeping unique values. You need do this only in one scope, so when you
create item with different's parent you can use same ID's:
m_pBtn->Create(_T("Button1"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, CRect(0,0,19,14), pWnd1, _APS_NEXT_CONTROL_VALUE);
m_pBtn->Create(_T("Button2"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, CRect(0,0,19,14), pWnd2, _APS_NEXT_CONTROL_VALUE);
There is no problem, couse different parent's: pWnd1, pWnd2.
Acid Will Burn!
|
|
|
|
|
|
Hi again,
What must I include in order to use the _APS_NEXT_CON... value?
|
|
|
|
|
I'm sort of a newbie when it come to Visual C++... and I'm having trouble on this project that requires me to convert a file type from a software my previous groupmates have developed into an AVI format.
What should I keep in mind when it comes to making a program/function/module that converts a file from one type to AVI?
|
|
|
|
|
What's the type ? Is it freeware ? We created a screen grabber that grabbed AVI in an afternoon once, using a MS sample. I can't remember the details, but you could look in MSDN. Also, if it's freeware, Virtua Dub is at Source Forge, and it's freeware ( but GPL, so no good if your code is commercial )
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Hello there,
I am having a class derived from CView. In which having combobox member which i am creating at the run time.I want to trap the keystrokes in the edit control of the combobox. I tried it with WM_KEYDOWN, but it doesn't work.Any other solution for this. Pls do mail.
Narendra
|
|
|
|
|
When I use unicode in my CRichEditView based class I can input Unicode characters only from keyboard, and when I try input its by function SetWindowText every character, which takes code after FF, printing as two different character, how I can correct this.
|
|
|
|
|
Hi
I have asked this before and i got som answers, Thanks
I will send a stored procedures to the Sql server with ADO, the stored procedure will have som parameters like this:
_bstr_t bstrCreate ( L"Create proc AdoTestA "
L"as "
L"Declare @pkMbtID varchar(50),"
L"@MbtType varchar(50)"
L"INSERT INTO MBT (pkMbtID, MbtType) Values (@pkMbtID, @MbtType)"
L"return");
It seems unnecessary to send the parameters with create parameter or refresh after sending the stored procedure.
Is there a way that i can invoke the parameters direct into the stored procedure abow.
Or isn't that possible?
/Bigge
|
|
|
|
|
I have CEdit derived class, in wich I want perform some actions when caret position changes. How I can notify this happend?
|
|
|
|
|
Hi,
I need help to load a third party DLL in my program. This DLL is not registring through regsvr32.
|
|
|
|
|
For starters, look up LoadLibarary() and GetProcAddress(). If you're trying to use COM objects that are in the DLL, but aren't being registered properly, then you'll need to contact the author of the DLL.
--Mike--
http://home.inreach.com/mdunn/
Ford: How would you react if I said that I'm not from Guildford after all, but from a small planet somewhere in the vicinity of Betelguese?
Arthur: I don't know. Why, do you think it's the sort of thing you're likely to say?
|
|
|
|
|
Can you explain me a little about LoadLibrary. coz I don't know any functions in that DLL
|
|
|
|
|
LoadLibrary, just load's the dll, so you can call functions in it.
You need to have a function prototype to call a function in a dll.
Lets make a function that will register a com-dll (just like regsvr32.exe does):
typedef void (*f)(void);
BOOL MyFuncCallsADLL(TCHAR* szDll)
{
f pf; // our function pointer
HINSTANCE hDll = LoadLibrary(szDll);
if(hDll == NULL)
return FALSE; // we couldnt load library
//get function address
pf = (f)GetProcAddress(hDll, _T("DllRegisterServer"));
if(pf == NULL)
{
FreeLibrary(hDll);
return FALSE; //we couldn locate the function
}
//lets call that method
pf();
FreeLibrary(hDll);
return TRUE;
}
|
|
|
|
|
I recently installed MDAC 2.6 and since have been unable to set up connections to either Access or FoxPro databases. I did install the Jet drivers afterward since they are not included in the MDAC installation. Does anyone know of a way to 'roll back' an MDAC installation.
MS has a program called ComCheck which is supposed to do this. It is supposed to have an option to "Reconfigure MDAC" on the file menu. Funny it isn't there!
Thanks,
ed
|
|
|
|
|
Hi there !
I have a somewhat large project, which consists out of 5 DLLs and an EXE.
Everything is compiled with MULTITHREADED DLL RTL, and exactly the same settings.. I am using Visual C 6.0 SP5 ( and V C 7.0 BETA 2 which exhibits the same behaviour )
Now I do the following: BATCH BUILD-> Build all Debug COnfigs:
Engine.dll / Debug
Support.dll / Debug
ModuleG.dll / Debug
ModuleS.dll / Debug
Game.exe / Debug
The 5th DLL is a 3rd party one which is also in debug mode ( mswin-ruby16.dll ( RUBY Scripting language )
Ok now I start my program, but it does not work ( It seems to have some errors in the scripting language interpreters.... it just doesnt execute script code ...)
NOW i do exactly the same thing again
Batch Build / all Debug configs etc ....
AND NOW THE THING WORKS !!! Perfectly smoothly ....
I am out of clues, basically every second build of my game works fine, the others not.. There is not a single change in build configuration I checked and double checked for that, the source code stays the same to the last point !!!! ( There are also no dynamic changes to the code, like vc macros (post build,pre link etc)
So no changes at all... Every sceond build works... but sometimes it's only the third one....
..
Any idea what that could be ? Since VC7.0 has the same behaviour i think it has to be something that I am doing...
|
|
|
|
|