|
you need to do something like this.
for(int row=0;row<128;row+=3)
{
for(int col=0;col<128;col+=3)
{
ComputeSubMatrix(row,col);
}
} let me know if you have any doubts.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
Hi all
i am using RedrawWindow for ListControl on OnEraseBkgnd.
BOOL CTestDlg::OnEraseBkgnd(CDC* pDC)
{
GetDlgItem(IDC_LIST)->RedrawWindow();
CRect rect;
GetClientRect(&rect);
pDC->FillSolidRect(rect,RGB(250,273,354));
return TRUE;
}
Then i am getting Listcontrol boarder disappear.
Am i right or not?
There is any different way to use RedrawWindow() function?
Please help me.
Thanks in advance
|
|
|
|
|
Looks like you're trying to paint the control, and then immediately draw a solid rectangle over it.
RedrawWindow invalidates the client region of your window. The borders are not part of that region. Then the FillSolidRect code kicks in and fills the dialog background. Now the WM_PAINT from your RedrawWindow call comes to your list controls message pump, and it redraws the invalidated region, the client area, but not the border.
What behavior are you looking for?
|
|
|
|
|
What are you trying do? Looks like you are trying to change the background color. If that is the case handle WM_CTLCOLOR message.
|
|
|
|
|
Hi sir,
Thanks for all your help.I have found the solution.
I am reading all the character from combo and storing it in map.
then i am reading the character from combo and Find() in given whole map.
I am tryig this code
CString strValue;
CString strTemp;
m_CtrlComboID.GetWindowText(strValue);
std::map<CString,CString>::iterator it=m_mapId.begin();
m_CtrlComboID.ResetContent();
for(; it!=m_mapId.end(); it++)
{
strTemp = it->first;
strValue.MakeUpper();
if(strTemp.Find(strValue)==0)
m_PatientID.AddString(strTemp);
}
m_CtrlComboID.SetWindowText(strValue);
m_CtrlComboID.ShowDropDown()
the problem i am facing is,
1)The first string is getting set in the ComboBox.
2)when i type the first character in combo,it is getting the strings
related to the first character.
but i am not able to type in the second character,as the cursor is going in the first position.
The character which i have typed later is going first.
For Ex: First i will type the character as "P",
Second if i type "A" character in combo,its going before "P"
i.e "AP",but i need as "PA".
I am bit confused,
any suggestions
Thanks
Raj
|
|
|
|
|
You need to set the cursor position manually. If you are using MFC use CCoboBox::SetEditSel()[^] API, otherwise send the control the CB_SETEDITSEL[^] message. Set start and end char to be the length of your string.
|
|
|
|
|
Hi sir,
Its working fine,thanks for your help
Thanks
Raj
modified on Tuesday, June 29, 2010 12:32 AM
|
|
|
|
|
Hello,
Doe's anyone know how can I make a FullScrean listbox.
I need to have the option that the list box will be somtimes at fullscrean and somtimes at regular mode.
thanks in advence
|
|
|
|
|
Resize the ListBox using MoveWindow API while changing from full screen to regular mode and vice versa.
|
|
|
|
|
but how can I get the screan size?
|
|
|
|
|
Adding to the Niklas Lindquist suggestions in the below post
GetClientRect API helps to obtain the client area of the Window. Get the parent window's client area and resize listbox according to it or the way you want.
|
|
|
|
|
All you have to do is SetWindowPos[^] and use some kind of accelerator key combination to switch back and forth.
You might have to handle WM_MINMAXINFO[^] to allow the control to be larger than the actual screen if you want to hide borders. Alternatively, you could modify the window style to achieve the same.
The GetSystemMetrics[^] API will give you the size of the screen using the SM_CXFULLSCREEN and SM_CYFULLSCREEN parameters.
Disclaimer: there might be another way get the screen size to support multiple monitor systems.
|
|
|
|
|
thank you,
I tried it but I can't get the handle to the window i.e. the first parameter of GetSystemMetrics is CWnd* and I don't know how to get it.
can you please help me with this?
|
|
|
|
|
GetSystemMetrics has only one parameter which is an int.
GetSystemMetrics(SM_CXFULLSCREEN) and GetSystemMetrics(SM_CYFULLSCREEN) should work.
Which version of the API accepts a CWnd*?
|
|
|
|
|
sorry I had a mistake I ment that SetWindowPos accepts a CWnd* as parameter.
|
|
|
|
|
Use NULL (or nullptr) and add the flag SWP_NOZORDER at the end.
|
|
|
|
|
I insert this on the constructor of the dialog:
int x=GetSystemMetrics(SM_CXFULLSCREEN);
int y=GetSystemMetrics(SM_CYFULLSCREEN);
SetWindowPos(NULL,0,0,x,y,SWP_NOZORDER );
and its give me Debug Assertion Failed.
do you know what can be the resone?
thanks again
|
|
|
|
|
In your constructor the underlying window has not yet been created, and that's why the call fails. Put it in your OnInitDialog handler instead.
|
|
|
|
|
Thank you it's work wall!
|
|
|
|
|
For some reason I read the mis-spelling as FillScreaM, and I thought the OP wanted something to get immediate attention!
|
|
|
|
|
Including the bmp image as resource isn't secure (as anyone can tamper easily).
So, I form the raw bitmap data (excluding headers) at runtime using some obfuscated code. The image is 208 pixels wide and has a height of 97 pixels. It takes 24bits per pixel. I'm very weak in GDI. I got a code to display image from resource and I tried modifying. Unfortunately, it didn't work
I'm MFC free till now and would like to remain so
Plz let me know the right approach.
Here is what I tried:
HBITMAP bmpExercising;
BITMAP bitmap;
bmpExercising = CreateCompatibleBitmap(GetDC(myWind), 208, 97);
GetObject(bmpExercising, sizeof(bitmap), &bitmap);
bitmap.bmBits = buf;
bitmap.bmBitsPixel = 24;
bitmap.bmHeight = 97;
bitmap.bmWidth = 208;
bitmap.bmPlanes = 1;
HDC hDC, MemDCExercising;
PAINTSTRUCT Ps;
case WM_PAINT:
hDC = BeginPaint(hwnd, &Ps);
MemDCExercising = CreateCompatibleDC(hDC);
SelectObject(MemDCExercising, bmpExercising);
BitBlt(hDC, 10, 10, 208, 97, MemDCExercising, 0, 0, SRCCOPY);
DeleteDC(MemDCExercising);
DeleteObject(bmpExercising);
EndPaint(hwnd, &Ps);
break;
I want to do it without MFC
I'm using Visual C++ 2005 Professional. Windows XP Professional with SP3.
-
S.V.Kaushik
|
|
|
|
|
There are a number of errors, I will list a few.
Selecting a GDI object into your device context needs to be followed by the same object being selected out of the dc. In your case
HGDIOBJ oldbmp = ::SelectObject(dc, bmp);
::SelectObject(dc, oldbmp);
DeleteDC(dc);
Your paint code will only have a bitmap the first time it paints, since you delete the bitmap there. Delete your bitmap in WM_DESTROY handler instead.
Also:
Your blitting area is 10x10 less than your bitmap.
|
|
|
|
|
thanx for the info... will do the changes and post the result
-
S.V.Kaushik
|
|
|
|
|
look in the source of that great article.
CBitmapEx - Free C++ Bitmap Manipulation Class[^]
You can debug in the MFC code to view some details.
/* ************* After Calls to CreateWindow ********************* */
bmpExercising = CreateCompatibleBitmap(GetDC(myWind), 208, 97);
GetObject(bmpExercising, sizeof(bitmap), &bitmap);
//you cant modify this data in that way.
/*bitmap.bmBits = buf;
bitmap.bmBitsPixel = 24;
bitmap.bmHeight = 97;
bitmap.bmWidth = 208;
bitmap.bmPlanes = 1;*/
//use ::SetPixel() - API for every pixel one time
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Thanks a lot... This is exactly what i needed
-
S.V.Kaushik
|
|
|
|