Thanks for the response, your answers to questions 2 and 3 were cool, I didn`t spot the 16x16 icon and thats why I could change the icon for the app, but not the icons in the app. I would still like to know if text backgrounds and transparency is possible? I would be very surprised if it weren't. Many Thanks Bernhard, Alan. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:
Chambers
Posts
-
3 simple questions -
3 simple questionsHi all, I have three simple questions that I just cannot solve : 1. How do I draw text with a transparent background? I have created a CFont structure (with appropriate colour, font and size), but don`t know how to draw its background transparently (it draws the text in a white box and pastes it to the screen) 2. How do I change the MFC default icons that appear in the top left hand corner of the Mainframe and Child frame respectively? 3. How do I change the line that says "MFC Application" when looking at the file in Windows Explorer? Be grateful if someone could help me out, cheers guys, Alan. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:
-
How to set MDIChildFrame title case different view?The Child Windows of MFC use the title of the associated document as the title of the window frame (automatically). To change the title of the window frame, all you need to do is change that in the document using :
pDoc->SetTitle(WHATEVER_YOU_WANT);
and you should notice that the title in the window frame has been automatically updated to reflect this. P.S. make sure you get the active document (pDoc) by using the GetActiveDocument() member function of the CHILD frame or view. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:
-
How can I print a bitmap file ?Thanks Christian, I`ve managed to get it going now, just hope it works on other PC's, wish me luck, Many Thanks, Alan. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:
-
How can I print a bitmap file ?Christian, can you explain your answer a little bit more, cos I have had this problem on my app. I managed to fix it by stretchblt'ing it with an offset, however this only worked for my PC. I recently tested it on someone else's PC and it was like a postage stamp despite my offset. Again, ur input would be much appreciated, Alan. P.S. did u fix that problem you had with the min/max track size of the child window (where it wouldn`t resize below a 100?) cos I posted a reply, but I think u must've solved it by that time. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:
-
Changing the size of the window?Took me a while to get it going, but it worked an absolute treat, thank you for the response Norm. Much Appreciated, Alan. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:
-
Changing the size of the window?Hi all, I have a small crappy problem. When I load a bitmap I retrieve its width and height, and I want to make the screen view the exact same size. However, I also want to prevent the frame being resized over this size, and so I have managed to implement a system which takes care of it. However, all of the code is situated in the Child Frame class, where the maximum tracking sizes are specified. I then go on to use SetWindowRect(). The problem I get though, is that when using SetWindowRect() the whole width of the window AND frame is set the bitmap dimensions, which means part of the bitmap is obsured by the frame. I have implemented my own offset (to account for the frame), and it works on my computer (or any other with a 19inch monitor), the trouble is I have to demo my app on the computers in Uni, and their monitors are 15inches (and I run XP, they run win2k which means the border sizes are different too), which means the frame will be out of sync with the image (I have tested this). Anyway, how could I get it to set the window and view to the right size? Can I obtain a border offset value? or is there a better way of achieving what I want? Cheers all, Alan. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:
-
Is there a round function?Hi all, I want to round a float/double number (to an integer)so that when its less than number.5 it is rounded down and when its greater than or equal to number.5 round up. At the moment I have discovered ceil and floor, but these are no good, as it is an either or solution. VB has a dedicated round function, is there one in VC++? cheers all Alan. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:
-
How do i create a simple grid control?Hi again, you`ll be glad to know that I finally finished the damn programming, yay :-D . I used the CDualGridCtrl that was on this web-site (I forget the author, but whoever he/she is thanks - there will be a mention in the final project). I would have liked to use Chris's grid control, but as you said, it can accomodate all my needs with a few hours invested. I didn`t have a few hours to invest as I have to have some sort of draft ready by Monday, and I didn`t want to p*ss about on a part of the project which is insignificant, yet necessary. But thanks to all who helped, Speak soon, Alan. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:
-
Draw text without HDC, possible?There are two main things which could cause flickering : 1.) Not using a memory HDC/CDC when updating the bitmap or text. 2.) Not overriding OnEraseBkgnd in your View class. The problem is probably caused by no.1 since otherwise your whole bitmap would flicker upon refresh too. What I think maybe happening is your program is drawing the bitmap directly to the screen, quickly followed by the text. This leaves a very very short period in which you see just the bitmap, thus a flickering effect is caused. What I recommend you do is create a new CDC called SrcDC, and use CreateCompatibleDC(NULL), and select the bitmap into it. I would then create another dc called DestDC (in same way), and BitBlt the SrcDC to the DestDC. I would then draw the text onto the DestDC (this has the effect of drawing onto the class) using DestDC's TextOut() function, before *finally* BitBlt'ing the DestDC to the screens *pDC that is found in your OnDraw routine. Basically *only* the final image should be drawn to the screen in 1 BitBlt, there shouldn`t be any other routines which draw to the same *pDC after this or else flickering may occur. Hope this helped, Alan. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:
-
How do i create a simple grid control?Hi all, this is the last part of my project before I start the write up, and I`m finding it a bit frustrating. All I want is control that acts like a grid. That is, I want a big square on my square which is divided up into columns and rows and holds UINT's. This control must be dynamic, i.e. when I click on the adjust IncCol/IncRow CSpin thingy (a problem Ravi helped me out on, see below), the number of columns/rows will increase *within* the square as necessary (the current fields will have to change size accordingly to accomodate the new row/column). Delphi has something called a TStringList, which is pretty much what I need, except it uses strings instead of UINT's. I have tried using many edit boxes, and then creating them/deleteing them as necessary, but the code is woefully complicated. I just want a nice simple solution (I don`t need it to change colour etc. etc.) to represent a resizable grid of integers, which can be read from and directly edited to much the same fields of a database. If anyone could help, or give me some ideas, I would well appreciate it, could I get this crappy project done and go out there and get a job.:-D Thanks All, Alan. P.S. I have had a look at Chris's grid control, and it is too heavy duty for what I need. From my understanding it seems to draw the grid manually, which would mean me spending a lot of time on this, which is exactly what I don`t want to do. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:
-
How to "attach" a CScrollBar to a editbox?I found an easier way. MSDN help says that, by default, the CSpin thingy's range is set to Min:100 Max:0, and by clicking the down arrow sends the current value nearer the minimum value, which is why it goes up, its heading for 100. All I did to get it to work properly was call :
CDialog::DoDataExchange(etc.)
{
... min , max
myCSpinThingy.SetRange(0 , 10);
}and it worked no problem. Just thought I`d let you know, since I wouldn`t have got there in the end if it weren't for you, Cheers Ravi, Alan. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:
-
How to "attach" a CScrollBar to a editbox?Right, I`ve managed to get them linked, finally. I had to enter the resource editor and swap the order of the ids around because it kept attaching to the save button i had (which is exactly what you said to do Ravi). However, the numbers go UP when i press the DOWN button, and visa versa. How do I swap them around, so that the up button makes the integer go UP, not blinking down? Cheers for your help getting me this far Ravi, Alan. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:
-
How to "attach" a CScrollBar to a editbox?What do I set the "Auto Buddy" too? the ID value of the edit box I presume? If this is right don`t worry about answering it, I`ll delete it if it works now. Thanks again, Alan. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:
-
How to "attach" a CScrollBar to a editbox?Cheers for the response. OK, I see where your going with this, but I`m still unsure as to how to link it to the edit box? I`m using a dialog box to house this control. I have so far placed the edit box and the CSpinButtonCtrl on the dialog. I have created variables for both in the dialog framework (for the CSpin a DDX control is used). Do I still have to "create" the CSpin thingy? or do I link it some other way? Many Thanks, Alan. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:
-
Can you have ranges in a switch statement?In response to your answers : 1. Yep, thats why I asked if you could do it in C++. 2. Its definately the easiest function, and the most appropriate for what I want. 3. I am seriously thinking of doing your OnPaint overriding advice, cos I've had a look at Chris's non-MFC code, and I must be honest, I`m struggling to understand it. Thanks for your response though, Alan. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:
-
How to "attach" a CScrollBar to a editbox?Hi all, I just want to know what the easiest way is to have an edit box (which represents an integer, say width/height) and the arrow buttons, which upon pressing up increments the editbox value by one, and upon pressing down decrements the editbox by one? I have tried mercilessly to do this, but alas I have failed. Thanks guys, Alan. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:
-
Can you have ranges in a switch statement?Thanks for the responses guys, especially for the Grid control link (Jon) cos its pretty much what I need (i need a simplified version, but I`ll just cut it down to that). I didn`t think you could have the ranges in a switch statement (since there are no books that describe how to) so thanks to both Alvaro and Jon for reaffirming my doubts. Oh and thanks to Chris Mauder for actually producing the Grid Control and making it freely available. Cheers guys, Alan. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:
-
Mid life crisisWell done for winning Christian. I`m not sure who John is, but I voted a good few times in response to your help, hope this sheds a little respect on your win! Alan. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:
-
Can you have ranges in a switch statement?Michael your answer to question was Perfect! What a weird name to call it though? I was looking through the MSDN help for IsMaximized etc etc.., ah well you live and learn, Thanks for the response Michael, Alan. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad: