|
Hi,
How can I add a circle on top of the bitmap image?
I added the following code to draw a rectangle on top of bitmap image. But rectangle is underneath of the BMP image.
CCLientDC pDC(this);
pDC.MoveTo(100,100);
pDC.Rectangle(20,20,30,30);
Please help me.
thanks in advance
Ravi
|
|
|
|
|
is it just for drawing purpose? or do you want to save it to the file?
it is easy to place a rectangle over bitmap. first draw teh bitmap using BitBlt or StretchBlt, then draw the rectangle over it. it will work
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
My Blog | Understanding State Pattern
|
|
|
|
|
Where do you use these codes?
|
|
|
|
|
Hi Sarath,
Following is the code ... I'm new to VC++/MFC.
m_hBmpNew = (HBITMAP) LoadImage(AfxGetInstanceHandle(),
"bng4.bmp",IMAGE_BITMAP,
0, // desired width
0, // desired height
LR_LOADFROMFILE);
if( m_hBmpNew == NULL ){
AfxMessageBox("Load Image Failed");}
// put the HBITMAP info into the CBitmap (but not the bitmap itself)
else{
m_st1.GetClientRect( &rectStaticClient );
rectStaticClient.NormalizeRect();
m_size.cx=rectStaticClient.Size().cx;
m_size.cy=rectStaticClient.Size().cy;
m_size.cx = rectStaticClient.Width(); // zero based
m_size.cy = rectStaticClient.Height(); // zero based
// Convert to screen coordinates using static as base,
// then to DIALOG (instead of static) client coords
// using dialog as base
m_st1.ClientToScreen( &rectStaticClient );
ScreenToClient( &rectStaticClient);
InvalidateRect(&rectStaticClient);
// Added to draw a rectangle
CCLientDC pDC(this);
pDC.MoveTo(100,100);
pDC.Rectangle(100,100,110,110);
i'm loading bitmap image using LoadImage(). Rectangle image is coming underneath of the bitmap image.
Thanks & regards
Ravi
|
|
|
|
|
well first i'm not sarath
Is this good or no
<br />
#include AtlImage.h<br />
CImage m_Image;<br />
m_Image.Load("c:\\1.jpg");<br />
<pre><br />
void CAnswerDlg::OnPaint() <br />
{<br />
CPaintDC pDC(this);
CRect Rect;<br />
GetWindowRect(Rect);<br />
ScreenToClient(Rect);<br />
m_Image.BitBlt(pDC.m_hDC,Rect.left,Rect.top,Rect.right,Rect.bottom,0,0);<br />
pDC.MoveTo(100,100);<br />
pDC.Rectangle(100,100,210,210); <br />
}<br />
|
|
|
|
|
Hi Whitesky,
First of all thanks for your reply.
Actually i want to load BMP image of size 4096x4096.So for that i need scroll bar properties to see the entire image.
Same image, i want draw a rectangle which will move according to the scroll bar.
How can i do this?
Thanks for ur help.
Regards
Ravi
|
|
|
|
|
|
Sorry for the delay.
hope you got the answer from WhiteSky
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
My Blog | Understanding State Pattern
|
|
|
|
|
Thankyou very much WhiteSky and Sarath.
Ravi
|
|
|
|
|
Hi to all,
I am Developing a Dialog based application, to which i have applied a skin.
after applying the skin i could not able to Activate the Main Menu through keyboard, But i can with mouse. i have Created the Menu filed as
&File->
&Connect
&Disconnect
E&xit (Alt+x)Accelerator
i am able to handle the accelerators and also the Menu(through Mouse)
But unable to Access the Menu items by keyboard like Alt F to activate File Menu etc,....
plz solve this as i need it urgently.
Thanks in Advance
-- modified at 8:34 Friday 4th August, 2006
Gopinath MV
|
|
|
|
|
Did you ever find a solution to this? I have the same problem!
|
|
|
|
|
Hi to all,
I need to establish a connection to a server through https protocol,
can any one give some idea, how to do it in VC++ MFC.
i need to establish a connection to the server and retrive a file.
Very urgent, Plz help me.
Thanks in advance.
Gopinath MV
|
|
|
|
|
either you can use XMLHTTP class (easiest) or elase use WinInet APIs.
cheers..Milton KB
|
|
|
|
|
Thanks Milton,
Can you tell me how can i use WinInet API or
Plz give me some link related to that.
Thank you very much.
Gopinath MV
|
|
|
|
|
|
Thanks Milton
for such a useful resource. its so helpful.
Gopinath MV
|
|
|
|
|
Hi,
I'm writing an 3D editor and I'm trying to get my viewport arrangement running.
I thought I should create it like this:
CMainWnd (CWnd)
-- CViewport x 4 (CView)
---- CViewportControl (CFormView)
---- CCameraView (CView. My CD3D9View actually..)
I then place four CViewport in a splitter window. The problem is that i don't know how to place the CViewportControl FormView inside the CViewport view. For some reason I had no problems with creating the CCameraView but the CFormView is a b**ch... I successfully added it with an odd hack but whenever I clicked it the came crashed with an odd assertion. How do I create it when there is no "Create()"?
Daniel
|
|
|
|
|
u really need a view inside a view. if so it has to be in a splitter again. thats teh right approch. or else go for a dockable style dialog inside a view.
what do u think?
Milton KB
|
|
|
|
|
The thing is that I'm a total newbie with MFC so I don't really know how to do it. The CViewport "view" doesn't have to be a view I suppose, only the CCameraView has to be a view since it's the only part of the "framework" that actually display data from the document. What class should i derive CViewport from instead and how do I add controls (a combo and a checkbox) to a dockable toolbar?
Could anyone guide me how I should structure the classes to make a viewport window like the ones you see in 3dsmax, maya etc.
I hope my questions doesn't sound too confusing, though I AM really confused about MFC. Whatever I do seems to cause assertions and trace errors or odd memory exceptions
DH
|
|
|
|
|
I just realized after typing my response that the creation of the sub-view wasn't the problem. The problem was with creating the "control panel" inside each viewport from my dialog resource. How the heck do I do that?
|
|
|
|
|
Tengil99 wrote: I then place four CViewport in a splitter window.
So do you have this part working?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Yeah. But each frame in the splitter (2x2) is a CViewport which I derive from CView. Shoulw it really be derived from a CView when it's not hosting and "viewing code" in itself, but only exists as a host frame of a control bar for the viewport and the real view (CCameraView)?
I know I'm making this hard to understand What I want is the exact same feature as in 3dsmax. 4 viewports in a splitter. Each viewport should contain a combobox where you can select what view/camera that will be used. There will also be a button there to toggle maximization of the viewport. Below this "control bar" the actual view will placed.
I started with MFC just a couple of days ago so I really don't know how to construct this kind of layout.
|
|
|
|
|
I've only used a splitter window a few times and they were both 1Rx2C. Both panes had a CView -derived object in it (one was a CListView and the other was a CTreeView ). I've seen examples of more, however. In those, the main splitter window had two panes, both of which were CSplitterWnd objects. Now you have two splitter windows (inside the one main splitter window), with two panes each. In those four panes can be whatever CView -derived objects you need. Make sense?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
But can I create something else than a CView derived object in a splitter window pane?
What class is used for generic window/panels? Is it CWnd?
Can I add a CWnd to a splitetr pane and then add an additional CWnd inside that CWnd? I'm at work atm so I can't test for myself :P
-- modified at 12:10 Friday 4th August, 2006
|
|
|
|
|
Tengil99 wrote: But can I create something else than a CView derived object in a splitter window pane?
Maybe, but having never done otherwise, I can't say for sure.
Tengil99 wrote: What class is used for generic window/panels? Is it CWnd?
A CView -derived object, I presume.
Tengil99 wrote: Can I add a CWnd to a splitetr pane and then add an additional CWnd inside that CWnd?
That's what I eluded to in my last response. The main splitter window had two panes, each of which was a CSplitterWnd object. Both of those splitter windows had two panes, and the resulting four panes held other (CView ) objects.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|