Solved

How to Fix a size of CFormView in CSplitterWnd?

Posted on 2008-10-29
16
1,354 Views
Last Modified: 2013-11-20
Hi,
How to give Fixed Size for CFormViewin CSplitterWnd?..
0
Comment
Question by:srikadi
  • 7
  • 7
  • 2
16 Comments
 
LVL 13

Expert Comment

by:kaylanreilor
ID: 22831617
Once you know the coordinates your windows is supposed to render into, you can store these values as members of your class to use them to display the window in the OnPaint() event handler. You can also, for example, set them into OnSize().
0
 

Author Comment

by:srikadi
ID: 22837754
I haven given size in OnSize() but it is taking parent window size and the splitter is also moving..i need fixed size spliiter
thanx..
0
 
LVL 13

Expert Comment

by:kaylanreilor
ID: 22838447
So it's always the same answer :  when you know the coordinates use them in OnPaint().
OnSize() will be use if you need to recalculate them only.

The problem also is that I'm not sure to understand "fized size" because generally it is the contrary : you have to code something if you need resizing a control with the parent.
0
 

Author Comment

by:srikadi
ID: 22840236
Hi,
i did like this..but its not working..
i wanto to give size of splitter is (0,30).i have given like this
    m_nwSplitter2.CreateView(4,0, RUNTIME_CLASS(CTaskFormView), CSize (0,30), pContext);
void CTaskFormView::OnSize(UINT nType, int cx, int cy)
{
 CFormView::OnSize(nType, 0, 30);
 // TODO: Add your message handler code here
 
}
is this correct?
0
 
LVL 13

Expert Comment

by:kaylanreilor
ID: 22848382
No, it's not correct. OnSize() is used to get the new coordinates from the parameters and then, for example, as I previously said, you can store them to use them later on.
As I said several time, if you want to DRAW your window, do it in OnPaint().
0
 

Author Comment

by:srikadi
ID: 22848794
Hi,
sorry,iam very begginer..i don't know what to write under CPaint..
0
 
LVL 13

Expert Comment

by:kaylanreilor
ID: 22848923
I didn't talk about CPaint but the even handler OnPaint() !
Into that method you can use SetWindowPos for example. There are many way to draw a window. I propose you google after having read that : http://msdn.microsoft.com/en-us/library/a1yzfz6d(VS.80).aspx
0
 
LVL 13

Expert Comment

by:kaylanreilor
ID: 22848931
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:srikadi
ID: 22850090
thanx..but its works for all spliiterbars..but i want to give fixed size for some panes not all..
0
 
LVL 13

Expert Comment

by:kaylanreilor
ID: 22850339
Hell, but did you really read my post #22848923 ?

I didn't talk about CPaint but the even handler OnPaint() !
Into that method you can use SetWindowPos for example. There are many way to draw a window. I propose you google after having read that : http://msdn.microsoft.com/en-us/library/a1yzfz6d(VS.80).aspx
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 22853643
srikadi,
Normally, one does not need to anything at all.  The View is drawn inside of its splitter pane.  It is resized automatically if the splitter is moved.  You can verify this by creating a new project (with no special code for OnSize).
If I am not understanding your question then please describe it in more detail.  If necessary, provide screen shots that show what it looks like now and what you want it to look like.
0
 

Author Comment

by:srikadi
ID: 22864506
Hi,
i have 6 splitterbars which are fixed size.but i want to make 3 splitterbars are fixed.i want CFormview are fixed but not CListViews in screenshot.

Doc1.doc
0
 
LVL 13

Accepted Solution

by:
kaylanreilor earned 500 total points
ID: 22864944
Did you at least try to use SetWindowPos with the coordinates you want in OnPaint() as I said it 5 days ago or not ?!? I think it's the 3rd time that I tell you that and you still don't answer !!!
Do you want me to stop talking to you ?

So I repeat again for the 4th time now :

Let's do something in the even handler OnPaint() which react to the message WM_PAINT !
Into that method you can use SetWindowPos FOR EXAMPLE to DRAW your window. There are many way to draw a window. I propose you google after having read that : http://msdn.microsoft.com/en-us/library/a1yzfz6d(VS.80).aspx
0
 

Author Comment

by:srikadi
ID: 22865024
Hi kaylanreilor:
yes,i had tried this one when u said.sorry,i forgot to tell u that its not working..still the form resizing..i did this one with ur other suggestion http://www.codeproject.com/KB/splitter/splitteroverride.aspx..
but still i have some problem with this..
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 22865289
Try
CSplitterWnd::SetRowInfo
http://msdn.microsoft.com/en-us/library/0hx5wwce(VS.80).aspx

That will let you set a minimum row height. If proper values are set, then that will freeze the sizes.
By the way, in your example, you are setting the height to 30 which is very short -- hardly room for a CFormView...
0
 

Author Comment

by:srikadi
ID: 22892466
Hi DanRollins:
i think CSplitterWnd::SetRowInfo is also peforms same function as CSIZE().
the height 30 which i have given is ok..its not short..showing perfectly..
 
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
countEvens challenge 2 75
Controlling which port to download from 4 71
wordlen challenge 3 60
Path of Workbook 3 60
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now