|
First I will try to solve the simple problem ("am able to rotate the rectangle by the required degrees
although a part of the rectangle is hidden"). I think every object should be rotated around it's top-left vertex. In this case I use two functions which prepare DC state to draw the object:
// Set device context to new state:
// every object drawn after call to this function will be rotated
// to nAngle degrees around (x, y) point.
// Rotation direction: positive - clockwise
//
void CWorldTransform2View::SetRotation(CDC* pDC,
int x,
int y,
int nAngle) // degrees
{
double dAngle = nAngle * PI_X_2 / 360.0; // PI_X_2 is pi*2
XFORM xForm;
xForm.eM11 = (FLOAT) cos(dAngle);
xForm.eM12 = (FLOAT) sin(dAngle);
xForm.eM21 = (FLOAT) (-sin(dAngle));
xForm.eM22 = (FLOAT) cos(dAngle);
xForm.eDx = (FLOAT) 0.0;
xForm.eDy = (FLOAT) 0.0;
int x1, y1;
x1 = (int) ( (x * cos(dAngle)) - (y * sin(dAngle)) );
y1 = (int) ( (x * sin(dAngle)) + (y * cos(dAngle)) );
GetViewportOrgEx(pDC->m_hDC, &m_PointOrigin);
SetViewportOrgEx(pDC->m_hDC, -x1 + x, -y1 + y, NULL);
m_nGraphicsMode = GetGraphicsMode(pDC->m_hDC);
SetGraphicsMode(pDC->m_hDC, GM_ADVANCED);
GetWorldTransform(pDC->m_hDC, &m_xForm);
SetWorldTransform(pDC->m_hDC, &xForm);
}
// Restore device context to the state is was before call to SetRotation
void CWorldTransform2View::RestoreDC(CDC* pDC)
{
SetWorldTransform(pDC->m_hDC, &m_xForm);
SetGraphicsMode(pDC->m_hDC, m_nGraphicsMode);
SetViewportOrgEx(pDC->m_hDC, m_PointOrigin.x, m_PointOrigin.y, NULL);
}
I hope this will help you to draw (if you have such problem).
To solve the second problem you need derive new class from drawing object you need to rotate (for example, CDrawRect) and add to it member m_nRotationAngle. After this rewrite all class functions using this angle. For example, function CDrawRect::GetHandle returns point. In your class you should rotate this point around rectangle's top-left vertex (some math...) and after this return it. Function Draw should draw the object with rotation angle (this is the problem you always solved, I beleive). Function MoveHandleTo should first rotate point (parameter) to -m_nRotationAngle degrees and after this work as usual (at least, such it seems to me now...). Function Intersects should work with region rather than rectangle etc.
So, you have some work for a couple of days or more, good luck.
|
|
|
|
|
Who knows, how to perform a migration from VC6 code to GNU C++ (from Slackware Linux 7.10 distribution) with minimum rewriting. Any ideas? My application is not a console one
. and uses:
1. MFC Cdialog
2. Subclassed dialog amd buttons from BCGControlBar and other libs
3. DAO
Thanks!
|
|
|
|
|
Sergei Yevseyev wrote:
MFC Cdialog
You are going to need a MFC alternative for Linux. I don't know of any though
Sergei Yevseyev wrote:
Subclassed dialog amd buttons from BCGControlBar and other libs
Doesn't sound promising. Contact the makers and see if there is a Linux port. Although if they are subclassed from MFC it doesn't sound promising.
Sergei Yevseyev wrote:
DAO
I don't know anything about this but I would think there is a Linux alternative.
I would suggest you start over in terms of GUI.
- Matt Newman
- Matt Newman
-Sonork ID: 100.11179:BestSnowman
|
|
|
|
|
Well, I'm afraid you are in trouble. There is no MFC for Linux, and you'll have to rewrite your applications. I suggest you use some OS-independent library like wxWindows.
Anyway, why would you port your GUI application to Linux? Less then 5% of PC users run Linux on their desktop computers?
I vote pro drink
|
|
|
|
|
|
Sergei, we use Tcl/TK to build cross platform GUIs. All the non-GUI code is built as libraries (DLL/so) that are linked into Tcl.
/ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
What about wxWindows (http://www.wxwindows.org/)?
It works on both Windows, Linux, MacOS, and several others, I'm sure.
I've toyed around with it, and it works nicely.
"If ye love wealth better than liberty, the tranquility of servitude better than the animating contest of freedom, go home from us in peace. We ask not your counsels or your arms. Crouch down and lick the hands which feed you. May your chains set lightly upon you, and may posterity forget that ye were our countrymen."
--Samuel Adams
|
|
|
|
|
I have created an interface to a recordset within a dialog. i have now created another dialog for reporting. How can i access the recordset from that dialog. i have tried including the header, and defining the recordset external. i think i am just missing a step. thank you for any help on this.
|
|
|
|
|
You need to open the recordset from a extarnal class to your dialogs, for example in the app class.... In this way the recordset can be open from any dialog and readed from any dialog....
Best Regards....
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
i used the wizard to create my app. it placed the following in my view to init the recordset.
m_pSet = &GetDocument()->m_tDSMSet;
CRecordView::OnInitialUpdate();
in my view header i have
class CTDSMSet;
.....
CTDSMSet* m_pSet;
i have been able to move the class declaration to my app header but nothing else with out errors. do you know if there is any documentation on moveing everything to the app class from a view class? or am i just looking to hard at this configuration maybe?
|
|
|
|
|
Always I prefer no use CRecordView, I prefer to declare de Database class and recordset in a public class for all classes in my application.... You need to see how can get access to the view from any dialog or other classes....
Try to get access to the View using AfxGetMainWnd();
Best Regards....
Happy new year!!!
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
the MSDN said you can not DRAW in OnUpdate() function, which is called by OnInitialUpdate by default
one is the other who absorbs the thoughts of others
|
|
|
|
|
who knows the answer , please tell me
thanks
one is the other who absorbs the thoughts of others
|
|
|
|
|
You can draw, provided you can get a DC;
CClientDC dc(this);
However, there's a good chance that the window is not visible yet, so drawing into it will not be very useful. A better idea is to use the class as it was intended; initialize any data necessary for drawing in OnInitialUpdate() , updated it in OnUpdate() , and draw it in OnDraw() . OnDraw() will be called when the window is shown and first needs to be updated, so if you place your drawing code there, the view will act as desired.
i ain't happy, i'm feeling glad; i got sunshine in a bag; i'm useless, but not for long; the future is coming on...gorillaz, clint eastwood
|
|
|
|
|
i set a breakpoint in first line of the OnDraw
but can not trace into the code
one is the other who absorbs the thoughts of others
|
|
|
|
|
Not sure what you mean now... The break point isn't getting hit?
i ain't happy, i'm feeling glad; i got sunshine in a bag; i'm useless, but not for long; the future is coming on...gorillaz, clint eastwood
|
|
|
|
|
How to get the data of a csv file ??
regards
Sonu
|
|
|
|
|
the target platform c:...xyz.dll does not match the current target platform
i am getting a error when i am executing a dialog based program which uses a dll that was developed in BC45 environment what does this error mean can any one help me
sudha
sudha
|
|
|
|
|
BC 4.5 uses BWCC.dll (16-bit one). Use Target to switch to 32-bit one OR rebuild Your broject by C++ Builder.
|
|
|
|
|
the target platform c:...xyz.dll does not match the current target platform
i am getting a error when i am executing a dialog based program which uses a dll that was developed in BC45 environment what does this error mean can any one help me
sudha
sudha
|
|
|
|
|
Subject :- Isn't there native support for PNG in Windows?
I've requoted my subject.
Christian and other GDI gurus...
This shocked me quite a bit.
I checked out the bitmap section on CP.
There are several classes available to display PNG files.
But I thought I should start from scratch and try and show a PNG first before I try to manipulate it.
Regards
GDI newbie Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Isn't there native support for PNG in Windows?
Using Win32 API? No.
You can probably work around this by fiddling with COM objects the Internet Explorer pollutes your system with, or you can use e.g. libpng [libpng.org]
/Mike
|
|
|
|
|
What's so special about PNG anyway?
What's wrong with JPG,BMP,GIF???
Why do people want PNG all of a sudden?
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
What's wrong with JPG,BMP,GIF???
JPG is complex and lossy.
BMP is basically a raw bit-dump, and as such the most bloated format you could use for off-line storage.
GIF is limited by evil patents.
PNG has no patent issues, has lossless compression and is just free.
Why do people want PNG all of a sudden?
All of a sudden? Well, one of the reasons could be that it has been a W3C standard (or was that "just" a recommendation?) for quite a few years now.
/Mike
|
|
|
|
|
Thanks for all that info.
The fact is right now I am in a sort of anti-PNG attitude for some personal-job-related reasons
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|