M
MartinMCU
Hello all,
I have developed a database application with a moderate number of forms
(around 20). As part of each forms design, I have included a header section
with a label contral and a footer section with an image control. I have a
module that programatically sets various properties such as image souce, font
size, positions, etc that is called in each form's load event. So far, this
works great. However, each form already had the proper font set when the
label control in the header was sized. Thus, increasing the font size results
in clipping, defeating the entire purpose of my module. The whole point was
to be able to quickly and easily implement global graphic changes to the
application.
The problem I have with my module is this: upon calling
lblFormTitle.SizeToFit, the error number 2187 (This property is only
available in design view) is generated. I have set AllowDesignChanges to all
views, which does not solve the issue. I also tried to switch to designview
in the module code, which generated the error 2174 (You can't switch to a
different view at this time). This error makes sense, as otherwise, I think
an infinite loop would occur with the module switching to design view, then
switchng back to form view again, which calls the load event, which calls the
module, which calls... yeah, you get the idea. So, any thoughts? I have
considered building a separate routine that could be called only by a
developer to go through and programmatically alter the forms, but since it
only applies to main forms and not subforms, there doesn't seem to be a truly
elegant way of iterating through and doing this. Thanks,
Matt Martin
I have developed a database application with a moderate number of forms
(around 20). As part of each forms design, I have included a header section
with a label contral and a footer section with an image control. I have a
module that programatically sets various properties such as image souce, font
size, positions, etc that is called in each form's load event. So far, this
works great. However, each form already had the proper font set when the
label control in the header was sized. Thus, increasing the font size results
in clipping, defeating the entire purpose of my module. The whole point was
to be able to quickly and easily implement global graphic changes to the
application.
The problem I have with my module is this: upon calling
lblFormTitle.SizeToFit, the error number 2187 (This property is only
available in design view) is generated. I have set AllowDesignChanges to all
views, which does not solve the issue. I also tried to switch to designview
in the module code, which generated the error 2174 (You can't switch to a
different view at this time). This error makes sense, as otherwise, I think
an infinite loop would occur with the module switching to design view, then
switchng back to form view again, which calls the load event, which calls the
module, which calls... yeah, you get the idea. So, any thoughts? I have
considered building a separate routine that could be called only by a
developer to go through and programmatically alter the forms, but since it
only applies to main forms and not subforms, there doesn't seem to be a truly
elegant way of iterating through and doing this. Thanks,
Matt Martin