|
Dear Excellence:
Suppose I've created on Bitmap, that says IDB_A, and how to get the Filename and it's path name from the code?
Thanks you all.
Morris
Morris Pan
|
|
|
|
|
Huh?
Once it's compiled into the .RES and linked into your .EXE or .DLL, there isn't a filename (and hence pathname). In the IDE you can select the bitmap, right-click and get the properties which include the pathname, which is the bitmap that will be IDB_A.
(Unless, of course you're talking about .NET resources, where the same may not be true).
Steve S
|
|
|
|
|
Dear Steve, thanks for your direction.
Got it.
Rgds
Morris
Morris Pan
|
|
|
|
|
Dear Excellence:
I want to move the bitmap in Dialog by presseing button, can you show me how to do it?
Thanks.
Morris
Morris Pan
|
|
|
|
|
In the handler for the button press, put something along these lines:
RECT stNewPosition;
// setup the new position for the bitmap (this can also resize it)
stNewPosition.top = 50;
stNewPosition.left = 50; // etc...
// this moves the bitmap only
GetDlgItem(IDB_YOUR_BITMAP)->MoveWindow(&stNewPosition, TRUE);
I think you can move the image off your dialog with this - effectively making it vanish so beware.
Regards,
Simon
|
|
|
|
|
Dear Simon :
Got it.
Many thanks.
Morris
Morris Pan
|
|
|
|
|
Dear Friend:
Thank you first.
It comes another question for me.
How come if I want to move Bitmap by implementing the DC ? Can you please show me the way?
Thanks
Morris
Morris Pan
|
|
|
|
|
If by DC, you mean device context, I am sorry but I don't know as much about this as I always use move window.
However, I know to get the device context you would do:
CDC * pDeviceContext = NULL;
pDeviceContext = GetDlgItem(IDC_YOUR_CONTROL)->GetDC();
Then you'll have to look in the MSDN for a CDC function that moves the image.
Regards,
Simon
|
|
|
|
|
I want to hide a toolbar by unchecking the menu item view->toolbar...the toolbar which i want to handle is userdefined ie its created by me using CToolBar.How do i do it?
|
|
|
|
|
i'm not sure if i got that right. you've got a CToolBar obj and want to hide / show it?
use CWnd::ShowWindow() with SW_SHOW / SW_HIDE.
hope this helps
|
|
|
|
|
Hi..
You are absolutely right!
I have a CToolBar object which needs to be hide/show as we click on menu item VIEW->ToolBar...i tried with ShowWindow(SW_HIDE),but its making the toolbar inactive instead of hiding.
Could you help me to solve this issue.
|
|
|
|
|
i've tried it and it works.
// your obj
CToolBarCtrl m_toolbar;
VERIFY( m_toolbar.Create(WS_CHILD | WS_VISIBLE | CCS_NOPARENTALIGN |
CCS_NORESIZE | TBSTYLE_FLAT | TBSTYLE_TOOLTIPS, CRect(10, 10, 100, 100),
this, AFX_IDW_TOOLBAR) );
// later on
m_toolbar.ShowWindow(SW_HIDE);
i rather use the CToolBarCtrl class, but if you don't want to, you can use CToolBar::GetToolBarCtrl() to get the CToolBar's underlying CToolBarCtrl class.
|
|
|
|
|
Hi Philipp Roesch,
This is the code iam following...
IN .H FILE
CToolBar m_Annot;
IN .CPP FILE(OnCreate() function)
if (!m_Annot.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_ALIGN_LEFT
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY) ||
!m_Annot.LoadToolBar(IDB_BITMAP10))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
IN THE MENU HANDLING FUNCTION WHERE I NEED TO SHOW AND HIDE TOOLBAR
m_Annot.ShowWindow(SW_HIDE);
I tried to use CToolBar::GetToolBarCtrl(), but its not working....
|
|
|
|
|
ahhh, ok!
write this:
IN .H FILE
CToolBar m_Annot;
IN .CPP FILE(OnCreate() function)
if (!m_Annot.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_ALIGN_LEFT
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY) ||
!m_Annot.LoadToolBar(IDB_BITMAP10))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
m_Annot.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_Annot);
IN THE MENU HANDLING FUNCTION WHERE I NEED TO SHOW AND HIDE TOOLBAR
m_Annot.ShowWindow(SW_HIDE);
|
|
|
|
|
HI PHILIPP ROESCH,
THANKS A LOT FOR YOUR SUGGESTION.NOW ITS WORKING.
BYE..
|
|
|
|
|
Hi,
Is it somehow possible to have the horizontal scrollbar always visible in my listctrl?
Or actually the problem is that with n fixed length columns it looks ugly if I leave room for the scrollbar which isn't there (kind of a (n+i)th column). And if I don't reserve that space for it, it looks ugly when the scrollbar appears because also the vertical scrollbar is shown.
Which solution would be good style in this situation?
|
|
|
|
|
Hi,
Is it somehow possible to have the horizontal scrollbar always visible in my listctrl?
Or actually the problem is that with n fixed length columns it looks ugly if I leave room for the scrollbar which isn't there (kind of a (n+i)th column). And if I don't reserve that space for it, it looks ugly when the scrollbar appears because also the vertical scrollbar is shown.
Which solution would good style in this situation?
|
|
|
|
|
Hi. I am currently using MDI mfc programming for my application and I have used pDC->TextOut(.) to display certain text in one of the child window. However, when the other window is on top of the one with the text, when it is move away, the text disappear. How can I resolve this? Thank you for any advise.
|
|
|
|
|
Make sure that you are doing your drawing in the view's OnDraw(...) function.
If I remember correctly, that should solve your problem.
Happy Programming!
WWW::CodeProject::BNEACETP
|
|
|
|
|
How can I detect if a user clicked outside a modal dialog?
|
|
|
|
|
Use mouse hooking by calling SetWindowsHookEx
|
|
|
|
|
Or get "control" over the mouse by calling "SetCapture". When use clicks you will get the click in your OnLbnDown ... and you check the mouse position.
Normally if you don't need that click you should imediatelly release the mouse by: ReleaseCapture.
Tutu.
|
|
|
|
|
Hi,
how can i integrate MSDN with Visual Studio 6. VS6 is alreay installed. now i have installed MSDN but when i press F1 in VS6, it says no MSDN collection. plz guide how can i tell VS6 about MSDN.
thanks,
omar lodhi
|
|
|
|
|
Run Installation CD of VS 6.0 again U can skip reintalling the software again by making no changes in the installed and uninstalled Features. After successful installation the Software automatically ask for MSDN CD.
I knew other ways, but since I did it long time ago I can't tell U precise way.
Hope is helps
Cheers!!!!
Siddharth
|
|
|
|
|
great wrote:
how can i integrate MSDN with Visual Studio 6. VS6 is alreay installed. now i have installed MSDN but when i press F1 in VS6, it says no MSDN collection. plz guide how can i tell VS6 about MSDN.
Which version of MSDN have you installed. If it is after October 2002, then it won't integrate with VS6, it only integrates with VS.NET and later.
Michael
But you know when the truth is told,
That you can get what you want or you can just get old,
Your're going to kick off before you even get halfway through.
When will you realise... Vienna waits for you? - "The Stranger," Billy Joel
|
|
|
|