Home > Software engineering >  To excel in the command manulife using VB to do a line, online marking line Numbers 1 and 100 (strai
To excel in the command manulife using VB to do a line, online marking line Numbers 1 and 100 (strai

Time:09-20

This VB macro genuflect is begged,,,,,,,,,,,,,,,,,,,,,,

CodePudding user response:

Like I want to do a line for each line identifies the scale like myself to retrieve one line input the line of the journey and then enter mileage points on the line will change color or I just click the online at some point it can display his mileage

CodePudding user response:

In fact, this is not you want the same way as a horizontal scroll bar, maximum minimum value, then according to the value to determine where points, according to the point to determine a value, it's just you want to use line said, there is a section, if only draw lines as well as the middle period of change color is simple, but you have to response to the mouse click event that suggest custom controls,
Don't have time to write to you control code, simple position calculation method to you,

Assume that all you have to say numerical range between min and Max, abscissa line starting point marked xs end points for xe, said here, for example, is a horizontal line, if you draw a vertical bar or slash y coordinate algorithm and abscissa,
When you want to determine the position of a value v in the line, is actually find v position in numerical range, (v - min)/(Max - v) this is the value of the number field is divided into two sections after the proportion of these two paragraphs, accordingly we suppose that a coordinate xv it ude proportion is after dividing the line into two segments (xv - xs)/(xe - xv), because you are in the position of the values in the number of field lines, so the two proportion should be the same, ok, Max min xs xe is already can determine, then v and xv as long as know one another, can be solved equation,



CodePudding user response:

Give you a piece of code reference,
Save the chart as WinRAR document (name at random, and the extension is rar) can open, decompression,
Compressed packet contains two files, stress should be put together after,
Create a new Excel document, and then import the decompression in VBE varies UserForm1. FRM, running can see the effect again,
Numerical value range is 0 to 100,
This code is not handled many details, you need to revise to deal with,
Because the VBA form unit of measure is not "pixel", so the "visual effects" and "value" is difficult to be precise matching between
In addition if you want to be "labeled a domain", then calculate and adjust the width of the "cursor",
Anyway, don't know your specific idea, I'm guessing then "process application details," obviously unrealistic,


VBE varies does not support "custom controls", in fact this can use VB development of (or other languages) a ocx to use, may be able to achieve "best,"
, after all, this kind of treatment, the range of values, legitimacy and display can be carried out in accordance with the own thoughts "precise control" (if adopt the way of "graphic"),

CodePudding user response:

Forget to say:
Can legally in the text box input value (0-100), "cursor" automatically jump to the corresponding position;
Can also be left click on the "line", or left click and drag, "cursor" and value to follow changes,

CodePudding user response:

Use MSChart control,
  • Related