Thursday, February 4, 2021

PAINT event research

PAINT event research

    MY Focus

  1. Classes for computational geometry
  2. Some classes and utility functions for general computational geometry

    My Note look at it and reuse it with MFC OPENGL utility class to build my own classes.

  3. Creating Custom Controls
  4. In a previous article I demonstrated subclassing a windows common control in order to modify its behaviour or extend its functionality. Sometimes you can only push the windows common controls so far. An example I came across was the common issue of needing a grid control to display and edit tabular data. I subclassed a CListCtrl and extended it to allow subitem editing, multiline cells, sort-on-click headers and a myriad of other features. However, deep down it was still a list control and there came a point where I seemed to be writing more code to stop the control performing actions than I was to actually make it do something.

    I needed to start from scratch, working from a base class that provided only the functionality I needed without any of the features (or liabilities) that I didn't need. Enter the custom control.

  5. Create your own controls - the art of subclassing
  6. An introduction to subclassing the Windows common controls using MFC

    Scrolling and Painting

  7. ScrollCall
  8. ScrollCall is a demo program that takes a sample of Windows standard controls, along with a standard GDI image, and arranges them on a Device Context (or DC), in a window. Depending on the dimensions of the image, and the size of the containing window, horizontal and/or system scrollbars become visible, to enable scrolling for the image and controls. Thus ScrollCall is as at least as much focused on sizing as it is scrolling, and both offer unique challenges for the programmer, as will be seen in the following sections.

  9. Guide to WIN32 Paint for Intermediates
  10. Guide to understanding how Windows generates WM_PAINT messages, manages the update region for a window, and how to use all common type DCs.

  11. Guide to WIN32 Paint for Beginners
  12. In reading the forums and answering the questions, I have found that many beginners would like to learn the fundamental concepts of painting in WIN32 programs. Developing applications for windows can be challenging and frustrating. it can also be rewarding if you know some of the basic techniques that are required to take advantage of the WIN32 operating system. This tutorial is for beginners, and will cover the basic techniques and knowledge required to get started with painting in WIN32.

    The code and the concepts are all at the SDK level, as most of the other techniques that are used to paint to windows are based on the SDK. The WIN32 SDK is used inside of the MFC and ATL/WTL objects that represent those frameworks. I believe the more you know about the base technology, the SDK, the more you can take advantage of the frameworks that are written to encapsulate the technology. In order to help developers that are developing in MFC and WTL, the corresponding classes from those frameworks will be explained in the appropriate sections.

    This tutorial is the first in a series of five. This one is for beginners, the next three will cover more advanced topics at the intermediate level, and the final tutorial will cover WIN32 paint internals at the advanced level.

  13. Guide to Win32 Memory DC
  14. Eons ago in computer time, I left-off with an article called Guide to Win32 Paint for Intermediates. That article described the basics of the WM_PAINT message, as well as how to use most of the different types of Win32 Device Contexts (DC). This article will describe the Memory DC. The Metafile DC will still be ignored in this article.

    My previous articles have been written with WTL. I still prefer to do Win32 development with WTL. However, the demonstration source code provided will be raw C/C++ Win32 calls and window management. This is to simplify the code that you are looking at, and eliminate a code dependency.

  15. Guide to WIN32 Regions
  16. Regions are a resource in windows that are very useful. They are device independent, which means that a device context (DC) is not needed to create or use one. However, there are many functions in the WIN32 GDI that require a region.

    Some of the useful places for a region are:

    1. Update Region, Paint
    2. Clipping, Paint
    3. Hit Testing
    4. Define window shape, Irregular Shaped Windows

    Many of the functions that relate to regions are very simple, and need very little explanation, in fact, the definition from MSDN is adequate enough to explain these functions. However, some of the functions are a little more difficult to understand and master, therefore extra details have been added to explain these functions. A few diagrams may accompany the explanation as well.

  17. A Guide to WIN32 Clipping Regions
  18. Clipping is a tool that can be very useful when painting complex user interfaces for any type of computer graphics display. There are two types of clipping in the subject of computer graphics, clipping to improve performance, and clipping for effect. This article will focus on how clipping is implemented in the WIN32 API, specifically within device contexts (DC)s.

    While some of the discussion in this tutorial may only be of interest to developers who seek advanced knowledge on the WIN32 clipping regions, the bulk of this guide is set at an intermediate level. Also, to know many of the secrets behind the structure and organization of the clipping regions will allow you to make design decisions that will allow you to more readily exploit these features.

    Much of the knowledge that was gained for this article was learned from the book Windows Graphics Programming by Feng Yuan. The example that is presented is also inspired by a demonstration program in that book. The demo program has been developed in the Windows SDK because the code is so simple.

    Another Series

  19. Custom Controls in Win32 API: Scrolling
  20. Many controls are designed to present some dynamic contents, or larger amount of data which cannot fit into the control or a dialog. In such cases, the controls often need to be equipped with scrollbars so that user can navigate within the data. Standard controls like list view or tree view can serve as prime examples of this approach.

    Windows API directly supports scrollbars within every single window and in the todays article we are going to show how to take advantage of it.

    Note that in COMCTL32.DLL, Windows also offers a standalone scrollbar control but we won't cover it here. Once you understand the implicit scrollbar support we will talk about, usage of the standlone scrollbar control becomes very simple and straightforward.

  21. Custom Controls in Win32 API: The Basics
  22. A large portion (if not all) of textbooks and tutorials about Win32 API programming touch also the topic of implementing a custom control. However AFAIK, there is no really comprehensive source (or at least none known to me) covering more than just the very basics of this topic.

    Most of such sources just provide some information on how to register a new window class, a trivial information about a few messages, most notably WM_PAINT, and then they switch to another topic. If you have ever tried to implement your own non-trivial control, I'm pretty sure you can agree with me that the implementor of the control must know much more, and that many traps are awaiting on the way.

    This article is intended as a first part of a series which will eventually try to cover the topic more thoroughly, including best practices, which you will hopefully find useful in order to implement good custom controls, which are easy to use by application developers, which fit into the Windows look and feel and which contribute to good applications.

    As this is the first part of the series, it will summarize the basics, and hence it will eventually be just a variant of the other sources I criticized in the previous sentences. I can only hope that the dear readers will forgive me for the slow start.

  23. Custom Controls in Win32 API: The Painting
  24. In the previous article, we learned the very basics of custom control implementation. Today, we take a closer look at control painting. This topic is quite important because successful controls must look nice and they must fit into the Windows environment. This task is not as simple as it sounds, especially if you consider that most applications support more than one particular Windows version, and that in the last 10 years, almost every Windows version changes the default visual appearance of its controls.

  25. Custom Controls in Win32 API: Visual Styles
  26. The last time we discussed the basics of custom controls' painting. Today, we will continue in the same direction and we will explore visual styles (a.k.a. XP theming).

    For creation of high quality custom controls, using this API properly is essential, yet a quite complex task, so this article is longer than its predecessors and I kindly ask my readers for some patience when reading it. It will take some time before we really start using the API because first of all, we must take a look at Windows theming from a somewhat broader perspective.

  27. Custom Controls in Win32 API: Standard Messages
  28. In previous articles we engaged in painting the controls. Today, we are going to pay some attention to handling many messages which mediate interaction between the control, its dialog or other parent window, and also between the control and the operating system itself.

    Note that, as all the articles in this series, this is not a reference documentation. This article is not meant as a replacement of MSDN. It is meant as complementary to it. MSDN often describes what the message is about, how its parameters are passed to it via WPARAM and LPARAM and I cannot see any sense in repeating it here. Instead, this article provides just an overview of messages controls often need to implement, with some hints how to do that from point of view of the control, not application attempting to just send the message to a control.

  29. ustom Controls in Win32 API: Control Customization
  30. This series is about implementation of custom controls. However, implementing new control from scratch is often a lot of work, and in many cases the desired effect can also be achieved by augmenting behavior, look or both of an existing control, often with much less effort. In today's article we will take a look on several techniques how to customize existing controls.

    In addition, the topic is also interesting when you are implementing new control from scratch: Good controls allow the applicatoion some level of customization, and some customization techniques do require some support from the control itself. Hence, we will also discuss how to implement such support in a new control.

    Note that there is no strict boundary between "customizing a control" and "using a control". The two cases overlap and different people may have different opinion where one ends and the other one begins. Actually, even setting of a control style (e.g. instructing the control to paint differently) can be understood as a simple example of control customization. For our purposes, we will use the term "control customization" for augmenting the control's look or behavior, which involves a (non-trivial) code on the application side.

  31. Custom Controls in Win32 API: Encapsulation of Customized Controls
  32. But if your customized control needs to be reused in multiple dialogs, if its handling in parent window's code is complex, if the dialog procedure is complicated on its own, if your dialog procedure needs to understand internal details of logic in the control although it has nothing to do with the higher logic of the application, then the encapsulation may provide you interesting benefits.

    So, what does the encapsulation for the customized control actually means? It means that every logic we want to mentally understand as an implementation of the control, goes out from the parent window procedure, that it is separated from it. If you once more take a look on all customization techniques presented in the previous article, you may notice that the parent window procedure actually has to handle some notifications sent by the customized control.

  33. Custom Controls in Win32 API: Scrolling
  34. Many controls are designed to present some dynamic contents, or larger amount of data which cannot fit into the control or a dialog. In such cases, the controls often need to be equipped with scrollbars so that user can navigate within the data. Standard controls like list view or tree view can serve as prime examples of this approach.

    Windows API directly supports scrollbars within every single window and in the todays article we are going to show how to take advantage of it.

    Note that in COMCTL32.DLL, Windows also offers a standalone scrollbar control but we won't cover it here. Once you understand the implicit scrollbar support we will talk about, usage of the standlone scrollbar control becomes very simple and straightforward.

  35. This is a paragraph.

  36. This is a paragraph.

No comments:

Post a Comment